def testAppendUICommand(self): gui.init() settings = config.Settings(load=False) toolbar = ToolBar(self.frame, settings) uiCommand = dummy.DummyUICommand(menuText='undo', bitmap='undo') toolId = toolbar.appendUICommand(uiCommand) self.assertNotEqual(wx.NOT_FOUND, toolbar.GetToolPos(toolId))
def init(self, loadSettings=True, loadTaskFile=True): ''' Initialize the application. Needs to be called before Application.start(). ''' from taskcoachlib import config, i18n if self._options: iniFile = self._options.inifile else: iniFile = None self.settings = settings = config.Settings(loadSettings, iniFile) i18n.Translator(settings.get('view', 'language')) from taskcoachlib import gui, persistence, meta from taskcoachlib.domain import task self.wxApp.SetAppName(meta.name) self.wxApp.SetVendorName(meta.author) gui.init() if settings.getboolean('window', 'splash'): splash = gui.SplashScreen() else: splash = None self.taskFile = persistence.LockedTaskFile() self.autoSaver = persistence.AutoSaver(settings) self.taskRelationshipManager = task.TaskRelationshipManager( \ taskList=self.taskFile.tasks(), settings=settings) self.io = gui.IOController(self.taskFile, self.displayMessage, settings) self.mainwindow = gui.MainWindow(self.io, self.taskFile, settings, splash) if not self.settings.getboolean('file', 'inifileloaded'): self.warnUserThatIniFileWasNotLoaded() if loadTaskFile: self.io.openAfterStart(self._args) wx.SystemOptions.SetOptionInt("mac.textcontrol-use-spell-checker", settings.getboolean('editor', 'maccheckspelling')) self.registerSignalHandlers()
def init(self, loadSettings=True, loadTaskFile=True): ''' Initialize the application. Needs to be called before Application.start(). ''' self.__init_config(loadSettings) self.__init_language() self.__init_domain_objects() self.__init_application() from taskcoachlib import gui, persistence gui.init() show_splash_screen = self.settings.getboolean('window', 'splash') splash = gui.SplashScreen() if show_splash_screen else None # pylint: disable=W0201 self.taskFile = persistence.LockedTaskFile(poll=not self.settings.getboolean('file', 'nopoll')) self.__auto_saver = persistence.AutoSaver(self.settings) self.__auto_exporter = persistence.AutoImporterExporter(self.settings) self.__auto_backup = persistence.AutoBackup(self.settings) self.iocontroller = gui.IOController(self.taskFile, self.displayMessage, self.settings, splash) self.mainwindow = gui.MainWindow(self.iocontroller, self.taskFile, self.settings, splash=splash) self.__wx_app.SetTopWindow(self.mainwindow) self.__init_spell_checking() if not self.settings.getboolean('file', 'inifileloaded'): self.__close_splash(splash) self.__warn_user_that_ini_file_was_not_loaded() if loadTaskFile: self.iocontroller.openAfterStart(self._args) self.__register_signal_handlers() self.__create_mutex() self.__create_task_bar_icon() wx.CallAfter(self.__close_splash, splash) wx.CallAfter(self.__show_tips)
def init(self, loadSettings=True, loadTaskFile=True): ''' Initialize the application. Needs to be called before Application.start(). ''' self.initConfig(loadSettings) self.initLanguage() self.initPrinting() self.initDomainObjects() self.initApplication() from taskcoachlib import gui, persistence gui.init() showSplashScreen = self.settings.getboolean('window', 'splash') splash = gui.SplashScreen() if showSplashScreen else None # pylint: disable-msg=W0201 self.taskFile = persistence.LockedTaskFile() self.autoSaver = persistence.AutoSaver(self.settings) self.autoBackup = persistence.AutoBackup(self.settings) self.io = gui.IOController(self.taskFile, self.displayMessage, self.settings) self.mainwindow = gui.MainWindow(self.io, self.taskFile, self.settings, splash) if not self.settings.getboolean('file', 'inifileloaded'): self.warnUserThatIniFileWasNotLoaded() if loadTaskFile: self.io.openAfterStart(self._args) wx.SystemOptions.SetOptionInt( "mac.textcontrol-use-spell-checker", self.settings.getboolean('editor', 'maccheckspelling')) self.registerSignalHandlers()
def init(self, loadSettings=True, loadTaskFile=True): ''' Initialize the application. Needs to be called before Application.start(). ''' self.initConfig(loadSettings) self.initLanguage() self.initPrinting() self.initDomainObjects() self.initApplication() from taskcoachlib import gui, persistence gui.init() showSplashScreen = self.settings.getboolean('window', 'splash') splash = gui.SplashScreen() if showSplashScreen else None # pylint: disable-msg=W0201 self.taskFile = persistence.LockedTaskFile() self.autoSaver = persistence.AutoSaver(self.settings) self.autoBackup = persistence.AutoBackup(self.settings) self.io = gui.IOController(self.taskFile, self.displayMessage, self.settings) self.mainwindow = gui.MainWindow(self.io, self.taskFile, self.settings, splash) if not self.settings.getboolean('file', 'inifileloaded'): self.warnUserThatIniFileWasNotLoaded() if loadTaskFile: self.io.openAfterStart(self._args) wx.SystemOptions.SetOptionInt("mac.textcontrol-use-spell-checker", self.settings.getboolean('editor', 'maccheckspelling')) self.registerSignalHandlers()
def init(self, loadSettings=True, loadTaskFile=True): ''' Initialize the application. Needs to be called before Application.start(). ''' from taskcoachlib import config, i18n if self._options: iniFile = self._options.inifile else: iniFile = None self.settings = settings = config.Settings(loadSettings, iniFile) i18n.Translator(settings.get('view', 'language')) from taskcoachlib import gui, persistence, meta from taskcoachlib.domain import task self.wxApp.SetAppName(meta.name) self.wxApp.SetVendorName(meta.author) gui.init() if settings.getboolean('window', 'splash'): splash = gui.SplashScreen() else: splash = None self.taskFile = persistence.TaskFile() self.autoSaver = persistence.AutoSaver(settings) self.taskRelationshipManager = task.TaskRelationshipManager( \ taskList=self.taskFile.tasks(), settings=settings) self.io = gui.IOController(self.taskFile, self.displayMessage, settings) self.mainwindow = gui.MainWindow(self.io, self.taskFile, settings, splash) if loadTaskFile: self.io.openAfterStart(self._args)
class wxTestCase(TestCase): # pylint: disable=W0404 app = wx.App(0) frame = TestCaseFrame() from taskcoachlib import i18n i18n.Translator('en_US') from taskcoachlib import gui gui.init() def tearDown(self): super(wxTestCase, self).tearDown() self.frame.DestroyChildren() # Clean up GDI objects on Windows
class wxTestCase(TestCase): app = wx.App(0) frame = wx.Frame(None, -1, 'Frame') from taskcoachlib import gui gui.init() def setUp(self): pass def tearDown(self): super(wxTestCase, self).tearDown() self.frame.DestroyChildren() # Clean up GDI objects on Windows
def testAppendUICommand(self): gui.init() toolbar = ToolBar(self.frame, {}) uiCommand = dummy.DummyUICommand(menuText='undo', bitmap='undo') id = toolbar.appendUICommand(uiCommand) self.assertNotEqual(wx.NOT_FOUND, toolbar.GetToolPos(id))