Beispiel #1
0
 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)
Beispiel #2
0
 def testAddOneTaskWhenAutoSaveIsOn(self):
     self.settings.set('file', 'autoexport', '["Todo.txt"]')
     self.settings.set('file', 'autosave', 'True')
     autosaver = persistence.AutoSaver(self.settings)
     self.taskFile.tasks().append(task.Task(subject='Some task'))
     autosaver.on_idle(dummy.Event())
     self.assertEqual('Some task\n', file(self.txtFilename, 'r').read())
Beispiel #3
0
 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()
Beispiel #4
0
 def testImportOneTaskWhenAutoSaving(self):
     self.settings.set('file', 'autoimport', '["Todo.txt"]')
     self.settings.set('file', 'autosave', 'True')
     autosaver = persistence.AutoSaver(self.settings)
     with file(self.txtFilename, 'w') as todoTxtFile:
         todoTxtFile.write('Imported task\n')
     self.taskFile.tasks().append(task.Task(subject='Some task'))
     autosaver.on_idle(dummy.Event())
     self.assertEqual(2, len(self.taskFile.tasks()))
Beispiel #5
0
 def setUp(self):
     self.settings = DummySettings()
     self.taskFile = DummyTaskFile()
     self.autoSaver = persistence.AutoSaver(self.settings)
Beispiel #6
0
 def setUp(self):
     task.Task.settings = self.settings = config.Settings(load=False)
     self.taskFile = DummyTaskFile()
     self.autoSaver = persistence.AutoSaver(self.settings)