def __init__(self): singleton.modrana = self self.timing = [] self.addCustomTime("modRana start", startTimestamp) self.addCustomTime("imports done", importsDoneTimestamp) # constants & variable initialization self.dmod = None # device specific module self.gui = None self.GUIString = "" self.optLoadingOK = None self.d = {} # persistent dictionary of data self.m = {} # dictionary of loaded modules self.watches = {} # List of data change watches self.maxWatchId = 0 self.initInfo = { 'modrana': self, 'device': None, # TODO: do this directly 'name': "" } self.notificationTriggered = Signal() self.mapRotationAngle = 0 # in radians self.notMovingSpeed = 1 # in m/s # per mode options # NOTE: this variable is automatically saved by the # options module self.keyModifiers = {} # initialize threading threads.initThreading() # start timing modRana launch self.addTime("GUI creation") # add the startup handling core module self.startup = startup.Startup(self) self.args = self.startup.getArgs() # handle any early tasks specified from CLI self.startup.handleEarlyTasks() # early CLI tasks might need a "silent" modRana # so the startup announcement is here log.info(" == modRana Starting == ") # load the version string (needs to be done here # as PWD might change after the paths module is # imported, for example when running # with the Qt 5 GUI) paths.loadVersionString() version = paths.VERSION_STRING if version is None: version = "unknown version" log.info(" %s" % version) log.info(" Python %s" % platform.python_version()) # load the device module now as it might override # the default profile directory, so it needs to be # before ve init the core paths module self._loadDeviceModule() # initialize the paths handling core module self.paths = paths.Paths(self) # add the configs handling core module self.configs = configs.Configs(self) # load persistent options self.optLoadingOK = self._loadOptions() self._optionsLoaded() # check if upgrade took place if self.optLoadingOK: savedVersionString = self.get('modRanaVersionString', "") versionStringFromFile = paths.VERSION_STRING if savedVersionString != versionStringFromFile: log.info("possible upgrade detected") self._postUpgradeCheck() # save current version string self.set('modRanaVersionString', paths.VERSION_STRING) # load all configuration files self.configs.loadAll() # start loading other modules # handle tasks that require the device # module but not GUI self.startup.handleNonGUITasks() # then the GUI module self._loadGUIModule() # and all other modules self._loadModules() # startup done, log some statistics self._startupDone()
def __init__(self): singleton.modrana = self self.timing = [] self.addCustomTime("modRana start", startTimestamp) self.addCustomTime("imports done", importsDoneTimestamp) # constants & variable initialization self.dmod = None # device specific module self.gui = None self.GUIString = "" self.optLoadingOK = None self.d = {} # persistent dictionary of data self.m = {} # dictionary of loaded modules self.watches = {} # List of data change watches self.maxWatchId = 0 self.initInfo = { 'modrana': self, 'device': None, # TODO: do this directly 'name': "" } # signals self.notificationTriggered = Signal() self.shutdown_signal = Signal() self.mapRotationAngle = 0 # in radians self.notMovingSpeed = 1 # in m/s # per mode options # NOTE: this variable is automatically saved by the # options module self.keyModifiers = {} # initialize threading threads.initThreading() # start timing modRana launch self.addTime("GUI creation") # add the startup handling core module self.startup = startup.Startup(self) self.args = self.startup.getArgs() # handle any early tasks specified from CLI self.startup.handleEarlyTasks() # early CLI tasks might need a "silent" modRana # so the startup announcement is here log.info(" == modRana Starting == ") # load the version string (needs to be done here # as PWD might change after the paths module is # imported, for example when running # with the Qt 5 GUI) paths.load_version_string() version = paths.VERSION_STRING if version is None: version = "unknown version" log.info(" %s" % version) log.info(" Python %s" % platform.python_version()) os_release = self._get_os_release() if os_release: log.info(" %s", os_release) # load the device module now as it might override # the default profile directory, so it needs to be # before ve init the core paths module self._load_device_module() # initialize the paths handling core module self.paths = paths.Paths(self) # add the configs handling core module self.configs = configs.Configs(configs_dir=self.paths.profile_path) # load persistent options self.optLoadingOK = self._load_options() self._options_loaded() # check if upgrade took place if self.optLoadingOK: savedVersionString = self.get('modRanaVersionString', "") versionStringFromFile = paths.VERSION_STRING if savedVersionString != versionStringFromFile: log.info("possible upgrade detected") self._post_upgrade_check() # save current version string self.set('modRanaVersionString', paths.VERSION_STRING) # load all configuration files self.configs.load_all() # start loading other modules # handle tasks that require the device # module but not GUI self.startup.handle_non_gui_tasks() # then the GUI module self._load_gui_module() # and all other modules self._load_modules() # startup done, log some statistics self._startup_done()
# This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. import os import tempfile import time import unittest from core import voice from core import threads threads.initThreading() class TestVoiceGenerator(unittest.TestCase): def setUp(self): self.generator = voice.VoiceGenerator() def _test_an_engine(self, engine): """Test individual voice engines.""" if not engine.supports("en"): return handle, fname = tempfile.mkstemp(dir=self.generator._tmpdir) engine("en").make_wav("just testing", fname) self.assertTrue(os.path.isfile(fname)) self.assertTrue(os.path.getsize(fname) > 256)