def _OnSelectFile(self, event):
     self.__backups.DeleteAllItems()
     for index, dateTime in enumerate(self.__manifest.listBackups(self.__filenames[event.GetIndex()])):
         self.__backups.InsertStringItem(index, render.dateTime(dateTime, humanReadable=True))
     self.__backups.SetColumnWidth(0, -1)
     self.__backups.Enable(True)
     self.__selection = (self.__filenames[event.GetIndex()], None)
Ejemplo n.º 2
0
 def _OnSelectFile(self, event):
     self.__backups.DeleteAllItems()
     for index, dateTime in enumerate(
             self.__manifest.listBackups(
                 self.__filenames[event.GetIndex()])):
         self.__backups.InsertStringItem(
             index, render.dateTime(dateTime, humanReadable=True))
     self.__backups.SetColumnWidth(0, -1)
     self.__backups.Enable(True)
     self.__selection = (self.__filenames[event.GetIndex()], None)
 def testCollapsedCompositeTaskShowsRecursivePlannedStartDateTime(self):
     self.taskList.extend([self.task, self.child])
     self.task.addChild(self.child)
     now = date.Now()
     self.child.setPlannedStartDateTime(now)
     self.task.setPlannedStartDateTime(date.DateTime())
     self.viewer.setSortByTaskStatusFirst(False)
     self.viewer.setSortOrderAscending(False)
     expectedDateTime = "(%s)" % render.dateTime(now, humanReadable=True) if self.treeMode else ''
     self.task.expand(False, context=self.viewer.settingsSection())
     self.assertEqual(expectedDateTime, self.getItemText(0, 1))
Ejemplo n.º 4
0
 def testCollapsedCompositeTaskShowsRecursivePlannedStartDateTime(self):
     self.taskList.extend([self.task, self.child])
     self.task.addChild(self.child)
     now = date.Now()
     self.child.setPlannedStartDateTime(now)
     self.task.setPlannedStartDateTime(date.DateTime())
     self.viewer.setSortByTaskStatusFirst(False)
     self.viewer.setSortOrderAscending(False)
     expectedDateTime = "(%s)" % render.dateTime(now, humanReadable=True) if self.treeMode else ''
     self.task.expand(False, context=self.viewer.settingsSection())
     self.assertEqual(expectedDateTime, self.getItemText(0, 1))
 def assertRenderedDateTime(self, expectedDateTime, *dateTimeArgs):
     renderedDateTime = render.dateTime(date.DateTime(*dateTimeArgs))
     if expectedDateTime:
         renderedParts = renderedDateTime.split(' ', 1)
         if len(renderedParts) > 1:
             renderedDate, renderedTime = renderedParts
             expectedDate, expectedTime = expectedDateTime.split(' ', 1)
             self.assertEqual(expectedTime, renderedTime)
         else:
             expectedDate, renderedDate = expectedDateTime, renderedDateTime
         self.assertEqual(expectedDate, renderedDate)
     else:
         self.assertEqual(expectedDateTime, renderedDateTime)
Ejemplo n.º 6
0
 def assertRenderedDateTime(self, expectedDateTime, *dateTimeArgs):
     renderedDateTime = render.dateTime(date.DateTime(*dateTimeArgs))
     if expectedDateTime:
         renderedParts = renderedDateTime.split(' ', 1)
         if len(renderedParts) > 1:
             renderedDate, renderedTime = renderedParts
             expectedDate, expectedTime = expectedDateTime.split(' ', 1)
             self.assertEqual(expectedTime, renderedTime)
         else:
             expectedDate, renderedDate = expectedDateTime, renderedDateTime
         self.assertEqual(expectedDate, renderedDate)
     else:
         self.assertEqual(expectedDateTime, renderedDateTime)
    def AddInnerContent(self, sizer, panel):
        idleTimeFormatted = render.dateTime(self._idleTime)
        sizer.Add(wx.StaticText(panel, wx.ID_ANY,
            _('No user input since %s. The following task was\nbeing tracked:') % \
                                idleTimeFormatted))
        sizer.Add(wx.StaticText(panel, wx.ID_ANY,
            self._effort.task().subject()))

        btnNothing = wx.Button(panel, wx.ID_ANY, _('Do nothing'))
        btnStopAt = wx.Button(panel, wx.ID_ANY, _('Stop it at %s') % idleTimeFormatted)
        btnStopResume = wx.Button(panel, wx.ID_ANY, _('Stop it at %s and resume now') % idleTimeFormatted)

        sizer.Add(btnNothing, 0, wx.EXPAND | wx.ALL, 1)
        sizer.Add(btnStopAt, 0, wx.EXPAND | wx.ALL, 1)
        sizer.Add(btnStopResume, 0, wx.EXPAND | wx.ALL, 1)

        wx.EVT_BUTTON(btnNothing, wx.ID_ANY, self.DoNothing)
        wx.EVT_BUTTON(btnStopAt, wx.ID_ANY, self.DoStopAt)
        wx.EVT_BUTTON(btnStopResume, wx.ID_ANY, self.DoStopResume)
Ejemplo n.º 8
0
    def AddInnerContent(self, sizer, panel):
        idleTimeFormatted = render.dateTime(self._idleTime)
        sizer.Add(wx.StaticText(panel, wx.ID_ANY,
            _('No user input since %s. The following task was\nbeing tracked:') % \
                                idleTimeFormatted))
        sizer.Add(
            wx.StaticText(panel, wx.ID_ANY,
                          self._effort.task().subject()))

        btnNothing = wx.Button(panel, wx.ID_ANY, _('Do nothing'))
        btnStopAt = wx.Button(panel, wx.ID_ANY,
                              _('Stop it at %s') % idleTimeFormatted)
        btnStopResume = wx.Button(
            panel, wx.ID_ANY,
            _('Stop it at %s and resume now') % idleTimeFormatted)

        sizer.Add(btnNothing, 0, wx.EXPAND | wx.ALL, 1)
        sizer.Add(btnStopAt, 0, wx.EXPAND | wx.ALL, 1)
        sizer.Add(btnStopResume, 0, wx.EXPAND | wx.ALL, 1)

        wx.EVT_BUTTON(btnNothing, wx.ID_ANY, self.DoNothing)
        wx.EVT_BUTTON(btnStopAt, wx.ID_ANY, self.DoStopAt)
        wx.EVT_BUTTON(btnStopResume, wx.ID_ANY, self.DoStopResume)
Ejemplo n.º 9
0
 def testPlannedStartDateTimeToday(self):
     today = date.Now()
     self.viewer.showColumnByName('plannedStartDateTime')
     self.task.setPlannedStartDateTime(today)
     self.expectInCSV(render.dateTime(today, humanReadable=False))
Ejemplo n.º 10
0
 def testActualStartDateTimeYesterday(self):
     yesterday = date.Yesterday()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(yesterday)
     self.expectInCSV(render.dateTime(yesterday, humanReadable=False))
Ejemplo n.º 11
0
 def testMissingModificationDateTime(self):
     self.viewer.showColumnByName('modificationDateTime')
     self.expectInHTML(
         render.dateTime(self.task.modificationDateTime(),
                         humanReadable=False))
     self.expectNotInHTML('1/1/1')
Ejemplo n.º 12
0
 def testCreationDateTime(self):
     self.viewer.showColumnByName('creationDateTime')
     self.expectInHTML(
         render.dateTime(self.task.creationDateTime(), humanReadable=False))
Ejemplo n.º 13
0
 def testCreationDateTime(self):
     self.viewer.showColumnByName('creationDateTime')
     self.expectInCSV(
         render.dateTime(self.task.creationDateTime(), humanReadable=False))
Ejemplo n.º 14
0
 def testCompletionDateYesterday(self):
     yesterday = date.Yesterday().startOfDay()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(yesterday)
     self.expectInCSV(render.dateTime(yesterday, humanReadable=False))
Ejemplo n.º 15
0
 def testActualStartDateToday(self):
     today = date.Now().startOfDay()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(today)
     self.expectInCSV(render.dateTime(today, humanReadable=False))
Ejemplo n.º 16
0
 def renderCreationDateTime(item, humanReadable=True):
     return render.dateTime(item.creationDateTime(), 
                            humanReadable=humanReadable)
Ejemplo n.º 17
0
 def testCompletionDateTomorrow(self):
     tomorrow = date.Tomorrow().startOfDay()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(tomorrow)
     self.expectInCSV(render.dateTime(tomorrow, humanReadable=False))
Ejemplo n.º 18
0
 def testCompletionDateYesterday(self):
     yesterday = date.Yesterday().startOfDay()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(yesterday)
     self.expectInCSV(render.dateTime(yesterday, humanReadable=False))
Ejemplo n.º 19
0
 def testCompletionDateTimeToday(self):
     today = date.Now()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(today)
     self.expectInCSV(render.dateTime(today, humanReadable=False))
Ejemplo n.º 20
0
 def testActualStartDateToday(self):
     today = date.Now().startOfDay()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(today)
     self.expectInCSV(render.dateTime(today, humanReadable=False))
Ejemplo n.º 21
0
 def testActualStartDateTimeTomorrow(self):
     tomorrow = date.Tomorrow()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(tomorrow)
     self.expectInCSV(render.dateTime(tomorrow, humanReadable=False))
Ejemplo n.º 22
0
 def testActualStartDateTimeYesterday(self):
     yesterday = date.Yesterday()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(yesterday)
     self.expectInCSV(render.dateTime(yesterday, humanReadable=False))
Ejemplo n.º 23
0
 def testActualStartDateTimeTomorrow(self):
     tomorrow = date.Tomorrow()
     self.viewer.showColumnByName('actualStartDateTime')
     self.task.setActualStartDateTime(tomorrow)
     self.expectInCSV(render.dateTime(tomorrow, humanReadable=False))
Ejemplo n.º 24
0
 def renderModificationDateTime(item, humanReadable=True):
     return render.dateTime(item.modificationDateTime(),
                            humanReadable=humanReadable)
Ejemplo n.º 25
0
 def testCompletionDateTimeToday(self):
     today = date.Now()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(today)
     self.expectInCSV(render.dateTime(today, humanReadable=False))
 def testMissingModificationDateTime(self):
     self.viewer.showColumnByName('modificationDateTime')
     self.expectInHTML(render.dateTime(self.task.modificationDateTime(),
                                       humanReadable=False))
     self.expectNotInHTML('1/1/1')
Ejemplo n.º 27
0
 def testCompletionDateTomorrow(self):
     tomorrow = date.Tomorrow().startOfDay()
     self.viewer.showColumnByName('completionDateTime')
     self.task.setCompletionDateTime(tomorrow)
     self.expectInCSV(render.dateTime(tomorrow, humanReadable=False))
Ejemplo n.º 28
0
 def testDateBefore1900(self):
     # Don't check for '1801' since the year may be formatted on only 2
     # digits.
     result = render.dateTime(date.DateTime(1801, 4, 5, 23, 0, 0))
     self.failUnless('01' in result, result)
Ejemplo n.º 29
0
 def testModificationDateTime(self):
     self.viewer.showColumnByName('modificationDateTime')
     self.task.setModificationDateTime(date.DateTime(2013, 1, 1, 12, 0, 0))
     self.expectInCSV(
         render.dateTime(
             self.task.modificationDateTime(), humanReadable=False))
Ejemplo n.º 30
0
 def renderModificationDateTime(item, humanReadable=True):
     return render.dateTime(item.modificationDateTime(),
                            humanReadable=humanReadable)
Ejemplo n.º 31
0
 def testModificationDateTime(self):
     self.task.setModificationDateTime(date.DateTime(2012, 1, 1, 10, 0, 0))
     self.viewer.showColumnByName('modificationDateTime')
     self.expectInHTML(
         render.dateTime(self.task.modificationDateTime(),
                         humanReadable=False))
Ejemplo n.º 32
0
 def testModificationDateTime(self):
     self.task.setModificationDateTime(date.DateTime(2012, 1, 1, 10, 0, 0))
     self.viewer.showColumnByName("modificationDateTime")
     self.expectInHTML(render.dateTime(self.task.modificationDateTime(), humanReadable=False))
Ejemplo n.º 33
0
 def testDateBefore1900(self):
     # Don't check for '1801' since the year may be formatted on only 2
     # digits.
     result = render.dateTime(date.DateTime(1801, 4, 5, 23, 0, 0))
     self.failUnless('01' in result, result)
Ejemplo n.º 34
0
 def testPlannedStartDateTimeToday(self):
     today = date.Now()
     self.viewer.showColumnByName('plannedStartDateTime')
     self.task.setPlannedStartDateTime(today)
     self.expectInCSV(render.dateTime(today, humanReadable=False))
Ejemplo n.º 35
0
 def __init__(self, task, taskList, effortList, settings, *args, **kwargs):
     kwargs['title'] = _('%(name)s reminder - %(task)s') % \
         dict(name=meta.name, task=task.subject(recursive=True))
     super(ReminderDialog, self).__init__(*args, **kwargs)
     self.SetIcon(wx.ArtProvider_GetIcon('taskcoach', wx.ART_FRAME_ICON, 
                                         (16, 16)))
     self.task = task
     self.taskList = taskList
     self.effortList = effortList
     self.settings = settings
     self.registerObserver(self.onTaskRemoved, 
                           eventType=self.taskList.removeItemEventType(),
                           eventSource=self.taskList)
     pub.subscribe(self.onTaskCompletionDateChanged, 
                   task.completionDateTimeChangedEventType())
     pub.subscribe(self.onTrackingChanged, task.trackingChangedEventType())
     self.openTaskAfterClose = self.ignoreSnoozeOption = False
     pane = self.GetContentsPane()
     pane.SetSizerType("form")
     
     wx.StaticText(pane, label=_('Task') + ':')
     panel = wx.Panel(pane)
     sizer = wx.BoxSizer(wx.HORIZONTAL)
     self.openTask = wx.Button(panel, 
                               label=self.task.subject(recursive=True))
     self.openTask.Bind(wx.EVT_BUTTON, self.onOpenTask)
     sizer.Add(self.openTask, flag=wx.ALIGN_CENTER_VERTICAL)
     if self.settings.getboolean('feature', 'effort'):
         self.startTracking = wx.BitmapButton(panel)
         self.setTrackingIcon()
         self.startTracking.Bind(wx.EVT_BUTTON, self.onStartOrStopTracking)
         sizer.Add((3, -1), flag=wx.ALIGN_CENTER_VERTICAL)
         sizer.Add(self.startTracking, flag=wx.ALIGN_CENTER_VERTICAL)
     panel.SetSizerAndFit(sizer)
     
     for label in _('Reminder date/time') + ':', \
         render.dateTime(self.task.reminder()), _('Snooze') + ':':
         wx.StaticText(pane, label=label)
         
     self.snoozeOptions = wx.ComboBox(pane, style=wx.CB_READONLY)
     sizer.Add(self.snoozeOptions, flag=wx.ALIGN_CENTER_VERTICAL)
     snoozeTimesUserWantsToSee = [0] + self.settings.getlist('view', 
                                                             'snoozetimes')
     defaultSnoozeTime = self.settings.getint('view', 'defaultsnoozetime')
     # Use the 1st non-zero option if we don't find the last snooze time:
     selectionIndex = 1  
     # pylint: disable=E1101
     for minutes, label in date.snoozeChoices:
         if minutes in snoozeTimesUserWantsToSee:
             self.snoozeOptions.Append(label, 
                                       date.TimeDelta(minutes=minutes))
             if minutes == defaultSnoozeTime:
                 selectionIndex = self.snoozeOptions.Count - 1
     self.snoozeOptions.SetSelection(min(selectionIndex, 
                                         self.snoozeOptions.Count - 1))
     
     wx.StaticText(pane, label='')
     self.replaceDefaultSnoozeTime = wx.CheckBox(pane, 
         label=_('Also make this the default snooze time for future '
                 'reminders'))
     self.replaceDefaultSnoozeTime.SetValue(self.settings.getboolean('view', 
                                            'replacedefaultsnoozetime'))
     
     buttonSizer = self.CreateStdDialogButtonSizer(wx.OK)
     self.markCompleted = wx.Button(self, label=_('Mark task completed'))
     self.markCompleted.Bind(wx.EVT_BUTTON, self.onMarkTaskCompleted)
     if self.task.completed():
         self.markCompleted.Disable()
     buttonSizer.Add(self.markCompleted, flag=wx.ALIGN_CENTER_VERTICAL)
     self.SetButtonSizer(buttonSizer)
     self.Bind(wx.EVT_CLOSE, self.onClose)
     self.Bind(wx.EVT_BUTTON, self.onOK, id=self.GetAffirmativeId())
     self.Fit()
     self.RequestUserAttention()
     if self.settings.getboolean('feature', 'sayreminder'):
         speak.Speaker().say('"%s: %s"' % (_('Reminder'), task.subject()))
Ejemplo n.º 36
0
 def renderCreationDateTime(item, humanReadable=True):
     return render.dateTime(item.creationDateTime(),
                            humanReadable=humanReadable)