示例#1
0
    def setUp(self):
        super(EffortViewerAggregationTestCase, self).setUp()
        self.settings = config.Settings(load=False)
        self.settings.set('effortviewer', 'aggregation', self.aggregation)

        self.task = task.Task('Task')
        self.task.addEffort(
            effort.Effort(self.task, date.DateTime(2008, 7, 16, 10, 0, 0),
                          date.DateTime(2008, 7, 16, 11, 0, 0)))
        self.task.addEffort(
            effort.Effort(self.task, date.DateTime(2008, 7, 16, 12, 0, 0),
                          date.DateTime(2008, 7, 16, 13, 0, 0)))
        self.task.addEffort(
            effort.Effort(self.task, date.DateTime(2008, 7, 17, 1, 0, 0),
                          date.DateTime(2008, 7, 17, 2, 0, 0)))
        mostRecentPeriod = (date.DateTime(2008, 7, 23, 1, 0, 0),
                            date.DateTime(2008, 7, 23, 2, 0, 0))
        self.task2 = task.Task('Task2')
        # pylint: disable-msg=W0142
        self.task.addEffort(effort.Effort(self.task, *mostRecentPeriod))
        self.task2.addEffort(effort.Effort(self.task2, *mostRecentPeriod))

        self.taskFile = persistence.TaskFile()
        self.taskFile.tasks().extend([self.task, self.task2])
        self.viewer = self.createViewer()
示例#2
0
 def setUp(self):
     super(CategoryEditorTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.categories = self.taskFile.categories()
     self.categories.extend(self.createCategories())
     self.editor = self.createEditor()
示例#3
0
 def setUp(self):
     super(MainWindowTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     self.setSettings()
     self.taskFile = persistence.TaskFile()
     self.mainwindow = MainWindowUnderTest(DummyIOController(),
                                           self.taskFile, self.settings)
 def setUp(self):
     super(AttachmentEditorTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.attachments = attachment.AttachmentList()
     self.attachments.extend(self.createAttachments())
     self.editor = self.createEditor()
示例#5
0
 def setUp(self):
     self.settings = task.Task.settings = config.Settings(load=False)
     self.file = StringIO.StringIO()
     self.writer = persistence.TodoTxtWriter(self.file, 'whatever.tsk')
     self.settings.set('taskviewer', 'treemode', 'False')
     self.taskFile = persistence.TaskFile()
     self.viewer = gui.viewer.TaskViewer(self.frame, self.taskFile, self.settings)
示例#6
0
 def setUp(self):
     task.Task.settings = self.settings = config.Settings(load=False)
     self.exporter = persistence.AutoImporterExporter(self.settings)
     self.taskFile = persistence.TaskFile()
     self.tskFilename = 'autoexport.tsk'
     self.txtFilename = 'autoexport.txt'
     self.taskFile.setFilename(self.tskFilename)
示例#7
0
 def setUp(self):
     settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     attachments = attachment.AttachmentList()
     self.viewer = gui.viewer.AttachmentViewer(self.frame, self.taskFile, 
         settings, attachmentsToShow=attachments, 
         settingsSection='attachmentviewer')
示例#8
0
 def setUp(self):
     super(CategoryViewerTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.categories = self.taskFile.categories()
     self.viewer = gui.viewer.CategoryViewer(self.frame, self.taskFile, 
                                             self.settings)
示例#9
0
 def testLocalNoteViewerForItemWithoutNotes(self):
     taskFile = persistence.TaskFile()
     taskFile.notes().append(note.Note())
     viewer = gui.viewer.NoteViewer(self.frame,
                                    taskFile,
                                    config.Settings(load=False),
                                    notesToShow=note.NoteContainer())
     self.failIf(viewer.presentation())
示例#10
0
 def setUp(self):
     super(TemplatesDialogTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.editor = TemplatesDialogUnderTest(self.settings,
                                            self.frame,
                                            'title',
                                            raiseDialog=False)
示例#11
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()
示例#12
0
 def setUp(self):
     super(EditorTestCase, self).setUp()
     task.Task.settings = self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.taskList = task.filter.ViewFilter(self.taskFile.tasks())
     self.task = task.Task('task')
     self.taskList.append(self.task)
     self.editor = self.createEditor()
示例#13
0
 def testNotImplementedError(self):
     try:
         gui.viewer.base.Viewer(self.frame,
                                persistence.TaskFile(),
                                None,
                                settingsSection='bla')
         self.fail('Expected NotImplementedError')  # pragma: no cover
     except NotImplementedError:
         pass
示例#14
0
 def setUp(self):
     super(TaskCalendarViewerTest, self).setUp()
     task.Task.settings = self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.frame.taskFile = self.taskFile
     self.viewer = gui.viewer.task.CalendarViewer(self.frame, self.taskFile, 
                                                  self.settings)
     self.originalTopWindow = wx.GetApp().TopWindow
     wx.GetApp().TopWindow = self.frame  # uiCommands use TopWindow to get the main window
示例#15
0
 def createViewer(self):
     viewer = FilterableViewerForTasksUnderTest()
     # pylint: disable=W0201
     viewer.taskFile = persistence.TaskFile()
     viewer.settings = self.settings
     viewer.settingsSection = lambda: 'taskviewer'
     presentation = viewer.createFilter(viewer.taskFile.tasks())
     viewer.presentation = lambda: presentation
     return viewer
示例#16
0
 def setUp(self):
     super(HTMLWriterTestCase, self).setUp()
     task.Task.settings = self.settings = config.Settings(load=False)
     self.fd = StringIO.StringIO()
     self.writer = persistence.HTMLWriter(self.fd, self.filename)
     self.taskFile = persistence.TaskFile()
     self.task = task.Task('Task subject')
     self.taskFile.tasks().append(self.task)
     self.viewer = self.createViewer()
示例#17
0
    def setUp(self):
        super(EffortViewerRenderTestMixin, self).setUp()
        task.Task.settings = self.settings = config.Settings(load=False)
        self.settings.set('effortviewer', 'aggregation', self.aggregation)

        self.taskFile = persistence.TaskFile()
        self.task = task.Task('task')
        self.taskFile.tasks().append(self.task)
        self.midnight = date.Now().startOfDay()
        self.viewer = self.createViewer()
 def setUp(self):
     super(NoteViewerTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.note = note.Note()
     self.taskFile.notes().append(self.note)
     self.viewer = gui.viewer.NoteViewer(self.frame,
                                         self.taskFile,
                                         self.settings,
                                         notesToShow=self.taskFile.notes())
示例#19
0
 def setUp(self):
     super(EditorTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.items = base.filter.SearchFilter(self.taskFile.notes())
     self.item = note.Note(subject='item')
     self.items.append(self.item)
     self.editor = EditorUnderTest(self.frame, [self.item], self.settings,
                                   self.items, self.taskFile)
     self.appearance = self.editor._interior[-1]
示例#20
0
 def setUp(self):
     super(ViewerIteratorTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     task.Task.settings = self.settings
     self.taskFile = persistence.TaskFile()
     self.taskList = self.taskFile.tasks()
     self.notebook = widgets.AuiManagedFrameWithNotebookAPI(self.frame)
     self.viewer = self.createViewer()
     self.viewer.showTree(self.treeMode == 'True')
     self.viewer.sortBy('subject')
示例#21
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()
示例#22
0
 def setUp(self):
     super(AttachmentEditorTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.attachment = attachment.FileAttachment('Attachment')
     self.attachments = attachment.AttachmentList()
     self.attachments.append(self.attachment)
     self.editor = gui.dialog.editor.AttachmentEditor(
         self.frame, self.attachments, self.settings, self.attachments,
         self.taskFile)
示例#23
0
 def setUp(self):
     super(TaskEditorTestCase, self).setUp()
     task.Task.settings = self.settings = config.Settings(load=False)
     self.tomorrow = date.Now() + date.oneDay
     self.yesterday = date.Now() - date.oneDay
     self.taskFile = persistence.TaskFile()
     self.taskList = self.taskFile.tasks()
     self.effortList = self.taskFile.efforts()
     self.taskList.extend(self.createTasks())
     self.editor = self.createEditor()
示例#24
0
 def setUp(self):
     super(ViewerIteratorTestCase, self).setUp()
     self.settings = config.Settings(load=False)
     task.Task.settings = self.settings
     self.taskFile = persistence.TaskFile()
     self.taskList = self.taskFile.tasks()
     self.window = AuiManagedFrameWithDynamicCenterPane(self.frame)
     self.viewer = self.createViewer()
     self.settings.setboolean(self.viewer.settingsSection(), 'treemode',
                              self.treeMode == 'True')
     self.viewer.sortBy('subject')
示例#25
0
 def setUp(self):
     super(ViewerTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.task = task.Task('task')
     self.taskFile.tasks().append(self.task)
     self.window = Window(self.frame)
     self.viewerContainer = gui.viewer.ViewerContainer(
         self.window, self.settings)
     self.viewer = self.createViewer()
     self.viewerContainer.addViewer(self.viewer)
示例#26
0
def generate(nrCategories=20, nrTasks=250):
    task.Task.settings = config.Settings(load=False)
    taskFile = persistence.TaskFile()
    taskFile.setFilename('generated_taskfile.tsk')
    tasks = taskFile.tasks()
    categories = taskFile.categories()
    for index in range(nrCategories):
        categories.append(generateCategory([str(index)]))
    for index in range(nrTasks):        
        tasks.append(generateTask([str(index)], categories))
    taskFile.save()
示例#27
0
 def setUp(self):
     super(ViewerTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.task = task.Task()
     self.taskFile.tasks().append(self.task)
     self.notebook = widgets.AuiManagedFrameWithNotebookAPI(self.frame)
     self.viewerContainer = gui.viewer.ViewerContainer(
         self.notebook, self.settings, 'mainviewer')
     self.viewer = self.createViewer()
     self.viewerContainer.addViewer(self.viewer)
示例#28
0
 def setUp(self):
     super(UpdatePerSecondViewerTestsMixin, self).setUp()
     task.Task.settings = self.settings = config.Settings(load=False)
     self.settings.set('taskviewer', 'columns', "['timeSpent']")
     self.taskFile = persistence.TaskFile()
     self.taskList = task.sorter.Sorter(self.taskFile.tasks(), sortBy='dueDateTime')
     self.updateViewer = self.createUpdateViewer()
     self.trackedTask = task.Task(subject='tracked')
     self.trackedEffort = effort.Effort(self.trackedTask)
     self.trackedTask.addEffort(self.trackedEffort)
     self.taskList.append(self.trackedTask)
示例#29
0
 def setUp(self):
     super(CategoryEditorTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.categories = self.taskFile.categories()
     self.categories.extend(self.createCategories())
     self.editor = gui.dialog.editor.CategoryEditor(self.frame,
                                                    list(self.categories),
                                                    self.settings,
                                                    self.categories,
                                                    self.taskFile)
示例#30
0
 def setUp(self):
     super(EffortViewerStatusMessageTest, self).setUp()
     self.settings = config.Settings(load=False)
     self.taskFile = persistence.TaskFile()
     self.task = task.Task()
     self.taskFile.tasks().append(self.task)
     self.effort1 = effort.Effort(self.task, date.DateTime(2006, 1, 1),
         date.DateTime(2006, 1, 2))
     self.effort2 = effort.Effort(self.task, date.DateTime(2006, 1, 2),
         date.DateTime(2006, 1, 3))
     self.viewer = EffortViewerUnderTest(self.frame, self.taskFile,  
         self.settings)