Skip to content

Commit b37190d

Browse files
committed
* avoid importing add-on modules on installTasks.py, this should fix #85.
* now the availability of the libraries should be detected properly during add-on installation. * small correction on _settingsDB.py
1 parent 9f13012 commit b37190d

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

addon/installTasks.py

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
# -*- coding: UTF-8 -*-
22
#Copyright (C) 2009 - 2019 David CM, released under the GPL.
33
# Author: David CM <[email protected]> and others.
4+
45
# note: this file doesn't get settings from the base profile to avoid issues when updating from older versions.
6+
57
from logHandler import log
6-
from synthDrivers._settingsDB import appConfig, DEFAULT_LIB_FOLDER
7-
import globalVars, gui, os, shutil, wx, addonHandler
8+
9+
import config, globalVars, gui, os, shutil, wx, addonHandler
10+
811
addonHandler.initTranslation()
912

1013

@@ -20,19 +23,26 @@ def preserveFiles(addonName, folder):
2023
shutil.rmtree(tempFolder)
2124
os.rename(absFolderPath, tempFolder)
2225

23-
msg=""
24-
if not os.path.exists(os.path.join(os.path.dirname(__file__), 'synthDrivers', appConfig.TTSPath, appConfig.dllName)):
25-
# Translators: the message shown if the driver can't find libraries during installation.
26-
msg = _("""The synthesizer won't be available until you set IBMTTS files. NVDA won't show this synthesizer in teh synthesizers lists because you need to set the IBMTTS files location first.
27-
To do it open the NVDA settings dialog, select IBMTTS category and use the "Browse for IBMTTS library" button to select the IBMTTS files folder.\n""")
26+
try:
27+
TTSPath = config.conf['ibmeci']['TTSPath']
28+
dllName = config.conf['ibmeci']['dllName']
29+
except:
30+
TTSPath = "ibmtts"
31+
dllName = "eci.dll"
2832

2933

3034
def onInstall():
3135
try:
32-
preserveFiles("IBMTTS", fr"synthDrivers\{DEFAULT_LIB_FOLDER}")
36+
preserveFiles("IBMTTS", r"synthDrivers\ibmtts")
3337
except:
3438
log.warning("error backing data", exc_info=True)
35-
if msg != "":
36-
gui.messageBox(msg,
39+
40+
if not os.path.exists(os.path.join(os.path.dirname(__file__), 'synthDrivers', TTSPath, dllName)):
41+
# Translators: the message shown if the driver can't find libraries during installation.
42+
msg = _("""The synthesizer won't be available until you set IBMTTS files. NVDA won't show this synthesizer in teh synthesizers lists because you need to set the IBMTTS files location first.
43+
To do it open the NVDA settings dialog, select IBMTTS category and use the "Browse for IBMTTS library" button to select the IBMTTS files folder.\n""")
44+
gui.messageBox(
45+
msg,
3746
# Translators: title of message box when user is installing NVDA
38-
_("IBMTTS driver for NVDA"), wx.OK)
47+
_("IBMTTS driver for NVDA"), wx.OK
48+
)

addon/synthDrivers/_settingsDB.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@
44
#synthDrivers/settingsDB.py
55

66
from ._configHelper import configSpec, registerConfig, boolValidator
7-
DEFAULT_LIB_FOLDER = 'ibmtts'
87

98
# Add-on config database
109
@configSpec("ibmeci")
1110
class _AppConfig:
1211
dllName = ("string(default='eci.dll')", True)
13-
TTSPath = ("string(default=DEFAULT_LIB_FOLDER)", True)
12+
TTSPath = ("string(default='ibmtts')", True)
1413
autoUpdate = ('boolean(default=True)', True, boolValidator)
1514
appConfig = registerConfig(_AppConfig)
1615

0 commit comments

Comments
 (0)