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.MFC
src/documentation/
src/com_cache/

View File

@ -1,6 +1,9 @@
# -*- coding: utf-8 -*-
import sys
import fix_requests
import fix_win32com
def setup():
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
import win32com
import paths
win32com.__gen_path__=paths.data_path(u"com_cache")
win32com.__gen_path__=paths.com_path()
import sys
import os
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.")
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
if hasattr(sys, "frozen"):
fixes.setup()
import logger
import platform
import languageHandler
import widgetUtils
import paths
import config
import output
import logger
import logging
import keys
import application

View File

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

View File

@ -65,3 +65,16 @@ def locale_path():
@merge_paths
def sound_path():
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