Coverage for modules/org/openteacher/logic/execute/execute : 76%
Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
|
#! /usr/bin/env python3 # -*- coding: utf-8 -*-
# Copyright 2011-2013, Marten de Vries # # This file is part of OpenTeacher. # # OpenTeacher is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # OpenTeacher 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 OpenTeacher. If not, see <http://www.gnu.org/licenses/>.
"""When OpenTeacher is run, this module sets a profile, controls enabling of all modules in the current profile, and sends an event (``startRunning``) when that's done so other modules can take over control at the right time.
In other words, this module controls the complete execution of OpenTeacher from the moment on the moduleManager is initialized.
"""
self._mm.mods(type="event"), ) self._mm.mods(type="settings"), self._mm.mods(type="translator"), )
raise ValueError("There has to be exactly one module installed with signature %s." % ((args, kwargs),))
def _profileIfUnspecified(self): #convert deprecated profiles to their aliases that exist today. "wordsonly": "words-only" }.get(value, value)
#enable printing a stacktrace in the case of a segfault if #supported. except (ImportError, AttributeError): pass
#load the settings module and its dependencies (currently one) except ValueError: self._profileSetting = {"value": DEFAULT_PROFILE} else: "internal_name": "org.openteacher.execute.startup_profile", "type": "profile", "defaultValue": DEFAULT_PROFILE, "callback": { "args": (), "kwargs": {"type": "execute"}, "method": "_settingChanged", } })
"nargs": "?", "default": self._profileIfUnspecified, "type": str, "help": "Start OpenTeacher with the PROFILE profile. Don't know which profiles are included? I'll give away one: 'help' ;).", }) "action": "store_true", "help": "Enable debugging messages. Useful for developers and bug reporters only." }) #remove the args we parsed from sys.argv
#setup logging
#setup the modules module
#build events used by other mods
#enable all other mods
#setup translation except IndexError: pass else:
except IndexError: _, ngettext = str, lambda a, b, n: a if n == 1 else b else: self._mm.resourcePath("translations") )
"name": _("Profile"), "category": _("General"), "subcategory": _("Profile"), })
try: dialogShower = self._modules.default("active", type="dialogShower") settingsDialog = self._modules.default("active", type="settingsDialog")
dialogShower.showMessage.send(settingsDialog.tab, "Restart OpenTeacher for this setting to take effect.") except IndexError: #no guarantees can be made for these modules... pass
|