diff --git a/knossos/center.py b/knossos/center.py index 14f76575..729ead8f 100644 --- a/knossos/center.py +++ b/knossos/center.py @@ -24,7 +24,7 @@ # The version should follow the http://semver.org guidelines. # Only remove the -dev tag if you're making a release! -VERSION = '0.9.3' +VERSION = '0.9.4' UPDATE_LINK = 'https://fsnebula.org/knossos' INNOEXTRACT_LINK = 'https://dev.tproxy.de/knossos/innoextract.txt' DEBUG = os.getenv('KN_DEBUG', '0').strip() == '1' diff --git a/knossos/clibs.py b/knossos/clibs.py index 57c1b874..077a7213 100644 --- a/knossos/clibs.py +++ b/knossos/clibs.py @@ -25,8 +25,6 @@ from . import center if sys.platform == 'win32': - from comtypes import client as cc - ENCODING = 'latin1' else: ENCODING = 'utf8' @@ -417,7 +415,8 @@ def list_voices(): return [] try: - voice = cc.CreateObject('SAPI.SpVoice') + import win32com.client as cc + voice = cc.Dispatch('SAPI.SpVoice') return [v.GetDescription() for v in voice.GetVoices()] except Exception: logging.exception('Failed to retrieve voices!') @@ -429,8 +428,18 @@ def speak(voice, volume, text): return False try: - hdl = cc.CreateObject('SAPI.SpVoice') - hdl.Voice = hdl.GetVoices()[voice] + import win32com.client as cc + + hdl = cc.Dispatch('SAPI.SpVoice') + + # We always seem to receive an AttributeError when we try to access + # SetVoice the first time. It works the second time for whatever reason... >_> + try: + hdl.SetVoice + except AttributeError: + pass + + hdl.SetVoice(hdl.GetVoices()[voice]) hdl.Volume = volume hdl.Speak(text, 19) hdl.WaitUntilDone(10000) diff --git a/knossos/windows.py b/knossos/windows.py index b8255ed6..a1be8642 100644 --- a/knossos/windows.py +++ b/knossos/windows.py @@ -520,6 +520,8 @@ def _check_editable(self): except Exception: logging.exception('Failed to retrieve editable status for %s!' % mid) res[mid] = False + else: + res[mid] = False if not self.closed: self.updateEditable.emit(res) diff --git a/releng/windows/Knossos.spec b/releng/windows/Knossos.spec index ae9ae6b5..a9cabe5a 100644 --- a/releng/windows/Knossos.spec +++ b/releng/windows/Knossos.spec @@ -23,7 +23,7 @@ onefile = False him = ['knossos.parsetab'] debug = os.environ.get('KN_BUILD_DEBUG') == 'yes' is_x64 = platform.architecture()[0] == '64bit' -rthooks = ['fix-comtypes-rthook.py', 'version-rthook.py'] +rthooks = ['version-rthook.py'] if debug: rthooks.append('../../tools/common/debug-rthook.py') diff --git a/releng/windows/fix-comtypes-rthook.py b/releng/windows/fix-comtypes-rthook.py deleted file mode 100644 index fdf8213b..00000000 --- a/releng/windows/fix-comtypes-rthook.py +++ /dev/null @@ -1,6 +0,0 @@ -import os.path -import comtypes.client as cc - -cc.gen_dir = os.path.expandvars(r'$APPDATA\knossos\comtypes') -if not os.path.isdir(cc.gen_dir): - os.makedirs(cc.gen_dir) diff --git a/setup.py b/setup.py index f2cddbf3..65bedca4 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ data = stream.read() commit = data[:7] if commit == '0000000': - commit = data.split(' ')[1][:7] + commit = data.splitlines()[-1].split(' ')[1][:7] version += '+' + commit elif len(ref[0]) == 40: