Fixed some issues in the built version

This commit is contained in:
Manuel Cortez 2016-06-02 17:42:44 -05:00
parent 8e8922b78e
commit 5ac17087f4
7 changed files with 48 additions and 11 deletions

1
.gitignore vendored
View File

@ -7,3 +7,4 @@ src/bootstrap.exe
src/Microsoft.VC90.CRT src/Microsoft.VC90.CRT
src/Microsoft.VC90.MFC src/Microsoft.VC90.MFC
src/documentation/ src/documentation/
src/com_cache/

View File

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys
import fix_requests import fix_requests
import fix_win32com
def setup(): def setup():
fix_requests.fix() fix_requests.fix()
if hasattr(sys, "frozen"):
fix_win32com.fix()

View File

@ -0,0 +1,5 @@
import win32com.client
def fix():
if win32com.client.gencache.is_readonly == True:
win32com.client.gencache.is_readonly = False
win32com.client.gencache.Rebuild()

View File

@ -1,7 +1,7 @@
from pywintypes import com_error from pywintypes import com_error
import win32com import win32com
import paths import paths
win32com.__gen_path__=paths.data_path(u"com_cache") win32com.__gen_path__=paths.com_path()
import sys import sys
import os import os
sys.path.append(os.path.join(win32com.__gen_path__, ".")) sys.path.append(os.path.join(win32com.__gen_path__, "."))
@ -32,3 +32,9 @@ def load_com(*names):
raise com_error("Unable to load any of the provided com objects.") raise com_error("Unable to load any of the provided com objects.")
return result return result
def preexec():
global fixed
if fixed==False:
gencache._GetModule=patched_getmodule
fixed=True

View File

@ -3,13 +3,13 @@ import sys
import fixes import fixes
if hasattr(sys, "frozen"): if hasattr(sys, "frozen"):
fixes.setup() fixes.setup()
import logger
import platform import platform
import languageHandler import languageHandler
import widgetUtils import widgetUtils
import paths import paths
import config import config
import output import output
import logger
import logging import logging
import keys import keys
import application import application

View File

@ -1,28 +1,37 @@
# *- coding: utf-8 -*- # *- coding: utf-8 -*-
import logging as original_logging import logging as original_logging
logging = original_logging.getLogger('core.output') logger = original_logging.getLogger('core.output')
from accessible_output2 import outputs from accessible_output2 import outputs
import sys import sys
speaker = None speaker = None
retries = 0
def speak(text, interrupt=0): def speak(text, interrupt=0):
global speaker global speaker, retries
if not speaker: if not speaker:
setup() setup()
try:
speaker.speak(text, interrupt) speaker.speak(text, interrupt)
speaker.braille(text) except:
if retries < 5:
retries = retries + 1
speak(text)
# speaker.braille(text)
def setup (): def setup ():
global speaker global speaker
logging.debug("Initializing output subsystem.") logger.debug("Initializing output subsystem.")
try: try:
# speaker = speech.Speaker(speech.outputs.Sapi5()) # speaker = speech.Speaker(speech.outputs.Sapi5())
# else: # else:
speaker = outputs.auto.Auto() speaker = outputs.auto.Auto()
except: except:
return logging.exception("Output: Error during initialization.") logger.exception("Output: Error during initialization.")
def enable_sapi():
speaker = outputs.sapi.SAPI5()
def copy(text): def copy(text):
import win32clipboard import win32clipboard

View File

@ -65,3 +65,16 @@ def locale_path():
@merge_paths @merge_paths
def sound_path(): def sound_path():
return app_path(u"sounds") return app_path(u"sounds")
@merge_paths
def com_path():
global mode, directory
if mode == "portable":
if directory != None: path = os.path.join(directory, "com_cache")
elif directory == None: path = app_path(u"com_cache")
elif mode == "installed":
path = data_path(u"com_cache")
if not os.path.exists(path):
log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path)
return path