示例#1
0
 def setUp(self):
     task.Task.settings = self.settings = config.Settings(load=False)
     self.taskFile = dummy.TaskFile()
     self.iocontroller = gui.IOController(self.taskFile, lambda *args: None,
                                          self.settings)
     self.filename1 = 'whatever.tsk'
     self.filename2 = 'another.tsk'
示例#2
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)
示例#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()
示例#4
0
 def testCreate(self):
     taskFile = persistence.TaskFile()
     try:
         gui.dialog.syncpreferences.SyncMLPreferences(
             parent=None,
             iocontroller=gui.IOController(taskFile, None, None),
             title='Edit SyncML preferences')
     finally:
         taskFile.close()
         taskFile.stop()
示例#5
0
    def setUp(self):
        super(IOControllerOverwriteExistingFileTest, self).setUp()
        self.originalFileSelector = wx.FileSelector
        wx.FileSelector = lambda *args, **kwargs: 'filename without extension to trigger our own overwrite warning'
        self.originalMessageBox = wx.MessageBox

        def messageBox(*args, **kwargs):  # pylint: disable=W0613
            self.userWarned = True
            return wx.CANCEL

        wx.MessageBox = messageBox
        task.Task.settings = self.settings = config.Settings(load=False)
        self.taskFile = dummy.TaskFile()
        self.iocontroller = gui.IOController(self.taskFile, lambda *args: None,
                                             self.settings)
示例#6
0
 def testMerge(self):
     mergeFile = persistence.TaskFile()
     mergeFile.setFilename(self.filename2)
     mergeFile.tasks().append(task.Task(subject='Task to merge'))
     mergeFile.save()
     mergeFile.close()
     targetFile = persistence.TaskFile()
     iocontroller = gui.IOController(targetFile, lambda *args: None, 
                                     self.settings)
     iocontroller.merge(self.filename2)
     try:
         self.assertEqual('Task to merge', list(targetFile.tasks())[0].subject())
     finally:
         mergeFile.close()
         mergeFile.stop()
         targetFile.close()
         targetFile.stop()
示例#7
0
 def testCreate(self):
     gui.dialog.syncpreferences.SyncMLPreferences(
         parent=None,
         iocontroller=gui.IOController(persistence.TaskFile(), None, None),
         title='Edit SyncML preferences')