コード例 #1
0
ファイル: note.py プロジェクト: casics/extractor
 def _createColumns(self):
     subjectColumn = widgets.Column('subject', _('Subject'), 
         width=self.getColumnWidth('subject'), 
         resizeCallback=self.onResizeColumn,
         renderCallback=lambda note: note.subject(),
         sortCallback=uicommand.ViewerSortByCommand(viewer=self, 
             value='subject', menuText=_('&Subject'), 
             helpText=_('Sort notes by subject')),
         imageIndicesCallback=self.subjectImageIndices,
         editCallback=self.onEditSubject,
         editControl=inplace_editor.SubjectCtrl)
     descriptionColumn = widgets.Column('description', _('Description'),
         note.Note.descriptionChangedEventType(),
         width=self.getColumnWidth('description'), 
         resizeCallback=self.onResizeColumn,
         renderCallback=lambda note: note.description(),
         sortCallback=uicommand.ViewerSortByCommand(viewer=self, 
             value='description', menuText=_('&Description'), 
             helpText=_('Sort notes by description')),
         editCallback=self.onEditDescription,
         editControl=inplace_editor.DescriptionCtrl)
     attachmentsColumn = widgets.Column('attachments', '', 
         note.Note.attachmentsChangedEventType(),  # pylint: disable=E1101
         width=self.getColumnWidth('attachments'),
         alignment=wx.LIST_FORMAT_LEFT,
         imageIndicesCallback=self.attachmentImageIndices,  # pylint: disable=E1101
         headerImageIndex=self.imageIndex['paperclip_icon'],
         renderCallback=lambda note: '')
     categoriesColumn = widgets.Column('categories', _('Categories'),
         note.Note.categoryAddedEventType(), 
         note.Note.categoryRemovedEventType(), 
         note.Note.categorySubjectChangedEventType(),
         note.Note.expansionChangedEventType(),
         width=self.getColumnWidth('categories'),
         resizeCallback=self.onResizeColumn,
         renderCallback=self.renderCategories,
         sortCallback=uicommand.ViewerSortByCommand(viewer=self, 
             value='categories', menuText=_('&Categories'), 
             helpText=_('Sort notes by categories')))
     creationDateTimeColumn = widgets.Column('creationDateTime', 
         _('Creation date'), width=self.getColumnWidth('creationDateTime'),
         resizeCallback=self.onResizeColumn,
         renderCallback=self.renderCreationDateTime,
         sortCallback=uicommand.ViewerSortByCommand(viewer=self,
             value='creationDateTime', menuText=_('&Creation date'),
             helpText=_('Sort notes by creation date')))
     modificationDateTimeColumn = widgets.Column('modificationDateTime', 
         _('Modification date'), 
         width=self.getColumnWidth('modificationDateTime'),
         resizeCallback=self.onResizeColumn,
         renderCallback=self.renderModificationDateTime,
         sortCallback=uicommand.ViewerSortByCommand(viewer=self,
             value='modificationDateTime', menuText=_('&Modification date'),
             helpText=_('Sort notes by last modification date')),
         *note.Note.modificationEventTypes())
     return [subjectColumn, descriptionColumn, attachmentsColumn, 
             categoriesColumn, creationDateTimeColumn, 
             modificationDateTimeColumn]
コード例 #2
0
 def _createColumns(self):
     return [widgets.Column('type', _('Type'), 
                            '',
                            width=self.getColumnWidth('type'),
                            imageIndicesCallback=self.typeImageIndices,
                            renderCallback=lambda item: '',
                            resizeCallback=self.onResizeColumn),
             widgets.Column('subject', _('Subject'), 
                            attachment.FileAttachment.subjectChangedEventType(),
                            attachment.URIAttachment.subjectChangedEventType(),
                            attachment.MailAttachment.subjectChangedEventType(), 
                            sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                                value='subject',
                                menuText=_('Sub&ject'), helpText=_('Sort by subject')),
                            width=self.getColumnWidth('subject'), 
                            renderCallback=lambda item: item.subject(),
                            resizeCallback=self.onResizeColumn),
             widgets.Column('description', _('Description'),
                            attachment.FileAttachment.descriptionChangedEventType(),
                            attachment.URIAttachment.descriptionChangedEventType(),
                            attachment.MailAttachment.descriptionChangedEventType(),
                            sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                                value='description',
                                menuText=_('&Description'), helpText=_('Sort by description')),
                            width=self.getColumnWidth('description'),
                            renderCallback=lambda item: item.description(),
                            resizeCallback=self.onResizeColumn),
             widgets.Column('notes', '', 
                            attachment.FileAttachment.notesChangedEventType(), # pylint: disable=E1101
                            attachment.URIAttachment.notesChangedEventType(), # pylint: disable=E1101
                            attachment.MailAttachment.notesChangedEventType(), # pylint: disable=E1101
                            width=self.getColumnWidth('notes'),
                            alignment=wx.LIST_FORMAT_LEFT,
                            imageIndicesCallback=self.noteImageIndices, # pylint: disable=E1101
                            headerImageIndex=self.imageIndex['note_icon'],
                            renderCallback=lambda item: '',
                            resizeCallback=self.onResizeColumn),
             widgets.Column('creationDateTime', _('Creation date'),
                            width=self.getColumnWidth('creationDateTime'),
                            renderCallback=self.renderCreationDateTime,
                            sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                                                                       value='creationDateTime',
                                                                       menuText=_('&Creation date'),
                                                                       helpText=_('Sort by creation date')),
                            resizeCallback=self.onResizeColumn),
             widgets.Column('modificationDateTime', _('Modification date'),
                            width=self.getColumnWidth('modificationDateTime'),
                            renderCallback=self.renderModificationDateTime,
                            sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                                                                       value='modificationDateTime',
                                                                       menuText=_('&Modification date'),
                                                                       helpText=_('Sort by last modification date')),
                            resizeCallback=self.onResizeColumn,
                            *attachment.Attachment.modificationEventTypes())
             ]
コード例 #3
0
 def getSortUICommands(self):
     return [
         uicommand.ViewerSortOrderCommand(viewer=self),
         uicommand.ViewerSortCaseSensitive(viewer=self),
         uicommand.ViewerSortByTaskStatusFirst(viewer=self), None,
         uicommand.ViewerSortByCommand(viewer=self,
                                       value='subject',
                                       menuText='Sub&ject',
                                       helpText='help'),
         uicommand.ViewerSortByCommand(viewer=self,
                                       value='description',
                                       menuText='&Description',
                                       helpText='help')
     ]
コード例 #4
0
ファイル: mixin.py プロジェクト: dfraser74/taskcoach
 def createSortByUICommands(self):
     ''' Create the UICommands for changing what the items are sorted by,
         i.e. the columns. '''
     return [
         uicommand.ViewerSortByCommand(viewer=self,
                                       value='subject',
                                       menuText=_('Sub&ject'),
                                       helpText=self.sortBySubjectHelpText),
         uicommand.ViewerSortByCommand(
             viewer=self,
             value='description',
             menuText=_('&Description'),
             helpText=self.sortByDescriptionHelpText)
     ]
コード例 #5
0
ファイル: category.py プロジェクト: dfraser74/taskcoach
 def _createColumns(self):
     # pylint: disable-msg=W0142
     kwargs = dict(
         renderDescriptionCallback=lambda category: category.description(),
         resizeCallback=self.onResizeColumn)
     columns = [
         widgets.Column('subject',
                        _('Subject'),
                        category.Category.subjectChangedEventType(),
                        sortCallback=uicommand.ViewerSortByCommand(
                            viewer=self, value='subject'),
                        imageIndexCallback=self.subjectImageIndex,
                        width=self.getColumnWidth('subject'),
                        **kwargs),
         widgets.Column(
             'description',
             _('Description'),
             category.Category.descriptionChangedEventType(),
             sortCallback=uicommand.ViewerSortByCommand(
                 viewer=self, value='description'),
             renderCallback=lambda category: category.description(),
             width=self.getColumnWidth('description'),
             **kwargs),
         widgets.Column(
             'attachments',
             '',
             category.Category.attachmentsChangedEventType(
             ),  # pylint: disable-msg=E1101
             width=self.getColumnWidth('attachments'),
             alignment=wx.LIST_FORMAT_LEFT,
             imageIndexCallback=self.attachmentImageIndex,
             headerImageIndex=self.imageIndex['paperclip_icon'],
             renderCallback=lambda category: '',
             **kwargs)
     ]
     if self.settings.getboolean('feature', 'notes'):
         columns.append(
             widgets.Column(
                 'notes',
                 '',
                 category.Category.notesChangedEventType(
                 ),  # pylint: disable-msg=E1101
                 width=self.getColumnWidth('notes'),
                 alignment=wx.LIST_FORMAT_LEFT,
                 imageIndexCallback=self.noteImageIndex,
                 headerImageIndex=self.imageIndex['note_icon'],
                 renderCallback=lambda category: '',
                 **kwargs))
     return columns
コード例 #6
0
 def createSortByUICommands(self):
     commands = super(SortableViewerForTasksMixin, self).createSortByUICommands()
     dependsOnEffortFeature = ['budget', 'timeSpent', 'budgetLeft',  
                               'hourlyFee', 'fixedFee', 'revenue']
     for menuText, helpText, value in [\
         (_('&Planned start date'), _('Sort tasks by planned start date'), 'plannedStartDateTime'),
         (_('&Due date'), _('Sort tasks by due date'), 'dueDateTime'),
         (_('&Completion date'), _('Sort tasks by completion date'), 'completionDateTime'),
         (_('&Prerequisites'), _('Sort tasks by prerequisite tasks'), 'prerequisites'),
         (_('&Dependents'), _('Sort tasks by dependent tasks'), 'dependencies'),
         (_('&Time left'), _('Sort tasks by time left'), 'timeLeft'),
         (_('&Percentage complete'), _('Sort tasks by percentage complete'), 'percentageComplete'),
         (_('&Recurrence'), _('Sort tasks by recurrence'), 'recurrence'),
         (_('&Budget'), _('Sort tasks by budget'), 'budget'),
         (_('&Time spent'), _('Sort tasks by time spent'), 'timeSpent'),
         (_('Budget &left'), _('Sort tasks by budget left'), 'budgetLeft'),
         (_('&Priority'), _('Sort tasks by priority'), 'priority'),
         (_('&Hourly fee'), _('Sort tasks by hourly fee'), 'hourlyFee'),
         (_('&Fixed fee'), _('Sort tasks by fixed fee'), 'fixedFee'),
         (_('&Revenue'), _('Sort tasks by revenue'), 'revenue'),
         (_('&Reminder'), _('Sort tasks by reminder date and time'), 'reminder')]:
         if value not in dependsOnEffortFeature or (value in dependsOnEffortFeature):
             commands.append(uicommand.ViewerSortByCommand(\
                 viewer=self, value=value, menuText=menuText, helpText=helpText))
     return commands
コード例 #7
0
 def _createColumns(self):
     # pylint: disable=W0142
     kwargs = dict(resizeCallback=self.onResizeColumn)
     return [widgets.Column(name, columnHeader, eventType,
             renderCallback=renderCallback,
             sortCallback=sortCallback,
             width=self.getColumnWidth(name), **kwargs) \
         for name, columnHeader, eventType, renderCallback, sortCallback in \
         ('period', _('Period'), effort.Effort.durationChangedEventType(),
          self.__renderPeriod,
          uicommand.ViewerSortByCommand(viewer=self, value='period')),
         ('task', _('Task'), effort.Effort.taskChangedEventType(),
          lambda effort: effort.task().subject(recursive=True), None),
         ('description', _('Description'),
          effort.Effort.descriptionChangedEventType(),
          lambda effort: effort.description(), None)] + \
         [widgets.Column('categories', _('Categories'),
          width=self.getColumnWidth('categories'),
          renderCallback=self.renderCategories, **kwargs)] + \
         [widgets.Column(name, columnHeader, eventType,
          width=self.getColumnWidth(name),
          renderCallback=renderCallback, alignment=wx.LIST_FORMAT_RIGHT,
          **kwargs) \
         for name, columnHeader, eventType, renderCallback in \
         ('timeSpent', _('Time spent'),
          effort.Effort.durationChangedEventType(), self.__renderTimeSpent),
         ('totalTimeSpent', _('Total time spent'),
          effort.Effort.durationChangedEventType(),
          self.__renderTotalTimeSpent),
         ('revenue', _('Revenue'), effort.Effort.revenueChangedEventType(),
          self.__renderRevenue),
         ('totalRevenue', _('Total revenue'),
          effort.Effort.revenueChangedEventType(), self.__renderTotalRevenue)] + \
          [widgets.Column(name, columnHeader, eventType,
           renderCallback=renderCallback, alignment=wx.LIST_FORMAT_RIGHT,
           width=self.getColumnWidth(name), **kwargs) \
          for name, columnHeader, eventType, renderCallback in \
             ('monday', _('Monday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 0)),
             ('tuesday', _('Tuesday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 1)),
             ('wednesday', _('Wednesday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 2)),
             ('thursday', _('Thursday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 3)),
             ('friday', _('Friday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 4)),
             ('saturday', _('Saturday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 5)),
             ('sunday', _('Sunday'),
              effort.Effort.durationChangedEventType(),
              lambda effort: self.__renderTimeSpentOnDay(effort, 6))
          ]
コード例 #8
0
 def _createColumns(self):
     return [
         widgets.Column('type',
                        _('Type'),
                        '',
                        width=self.getColumnWidth('type'),
                        imageIndexCallback=self.typeImageIndex,
                        renderCallback=lambda item: '',
                        resizeCallback=self.onResizeColumn),
         widgets.Column('subject',
                        _('Subject'),
                        attachment.Attachment.subjectChangedEventType(),
                        sortCallback=uicommand.ViewerSortByCommand(
                            viewer=self,
                            value='subject',
                            menuText=_('Sub&ject'),
                            helpText=_('Sort by subject')),
                        width=self.getColumnWidth('subject'),
                        renderCallback=lambda item: item.subject(),
                        resizeCallback=self.onResizeColumn),
         widgets.Column('description',
                        _('Description'),
                        attachment.Attachment.subjectChangedEventType(),
                        sortCallback=uicommand.ViewerSortByCommand(
                            viewer=self,
                            value='description',
                            menuText=_('&Description'),
                            helpText=_('Sort by description')),
                        width=self.getColumnWidth('description'),
                        renderCallback=lambda item: item.description(),
                        resizeCallback=self.onResizeColumn),
         widgets.Column(
             'notes',
             '',
             attachment.Attachment.notesChangedEventType(
             ),  # pylint: disable-msg=E1101
             width=self.getColumnWidth('notes'),
             alignment=wx.LIST_FORMAT_LEFT,
             imageIndexCallback=self.noteImageIndex,
             headerImageIndex=self.imageIndex['note_icon'],
             renderCallback=lambda item: '',
             resizeCallback=self.onResizeColumn),
     ]
コード例 #9
0
ファイル: mixin.py プロジェクト: casics/extractor
 def createSortByUICommands(self):
     commands = super(SortableViewerForCategorizablesMixin,
                      self).createSortByUICommands()
     commands.append(
         uicommand.ViewerSortByCommand(
             viewer=self,
             value='categories',
             menuText=_('&Category'),
             helpText=self.sortByCategoryHelpText))
     return commands
コード例 #10
0
 def _createColumns(self):
     columns = [widgets.Column(name, columnHeader,
             width=self.getColumnWidth(name),
             resizeCallback=self.onResizeColumn,
             renderCallback=renderCallback,
             sortCallback=uicommand.ViewerSortByCommand(viewer=self,
                 value=name.lower(), menuText=sortMenuText,
                 helpText=sortHelpText),
             imageIndexCallback=imageIndexCallback,
             *eventTypes) \
         for name, columnHeader, sortMenuText, sortHelpText, eventTypes, renderCallback, imageIndexCallback in \
         ('subject', _('Subject'), _('&Subject'), _('Sort notes by subject'),
             (note.Note.subjectChangedEventType(),),
             lambda note: note.subject(recursive=False),
             self.subjectImageIndex),
         ('description', _('Description'), _('&Description'),
             _('Sort notes by description'),
             (note.Note.descriptionChangedEventType(),),
             lambda note: note.description(), lambda *args: -1),
         ('categories', _('Categories'), _('&Categories'),
             _('Sort notes by categories'),
             (note.Note.categoryAddedEventType(),
              note.Note.categoryRemovedEventType(),
              note.Note.categorySubjectChangedEventType(),
              note.Note.expansionChangedEventType()),
             self.renderCategories, lambda *args: -1)]
     attachmentsColumn = widgets.Column(
         'attachments',
         '',
         note.Note.attachmentsChangedEventType(
         ),  # pylint: disable-msg=E1101
         width=self.getColumnWidth('attachments'),
         alignment=wx.LIST_FORMAT_LEFT,
         imageIndexCallback=self.attachmentImageIndex,
         headerImageIndex=self.imageIndex['paperclip_icon'],
         renderCallback=lambda note: '')
     columns.insert(2, attachmentsColumn)
     return columns
コード例 #11
0
 def _createColumns(self):
     # pylint: disable=W0142,E1101
     kwargs = dict(
         renderDescriptionCallback=lambda category: category.description(),
         resizeCallback=self.onResizeColumn)
     columns = [
         widgets.Column('subject',
                        _('Subject'),
                        category.Category.subjectChangedEventType(),
                        sortCallback=uicommand.ViewerSortByCommand(
                            viewer=self, value='subject'),
                        imageIndicesCallback=self.subjectImageIndices,
                        width=self.getColumnWidth('subject'),
                        editCallback=self.onEditSubject,
                        editControl=inplace_editor.SubjectCtrl,
                        **kwargs),
         widgets.Column(
             'description',
             _('Description'),
             category.Category.descriptionChangedEventType(),
             sortCallback=uicommand.ViewerSortByCommand(
                 viewer=self, value='description'),
             renderCallback=lambda category: category.description(),
             width=self.getColumnWidth('description'),
             editCallback=self.onEditDescription,
             editControl=inplace_editor.DescriptionCtrl,
             **kwargs),
         widgets.Column(
             'attachments',
             '',
             category.Category.attachmentsChangedEventType(),  # pylint: disable=E1101
             width=self.getColumnWidth('attachments'),
             alignment=wx.LIST_FORMAT_LEFT,
             imageIndicesCallback=self.attachmentImageIndices,
             headerImageIndex=self.imageIndex['paperclip_icon'],
             renderCallback=lambda category: '',
             **kwargs)
     ]
     if self.settings.getboolean('feature', 'notes'):
         columns.append(
             widgets.Column(
                 'notes',
                 '',
                 category.Category.notesChangedEventType(),  # pylint: disable=E1101
                 width=self.getColumnWidth('notes'),
                 alignment=wx.LIST_FORMAT_LEFT,
                 imageIndicesCallback=self.noteImageIndices,
                 headerImageIndex=self.imageIndex['note_icon'],
                 renderCallback=lambda category: '',
                 **kwargs))
     columns.append(
         widgets.Column('creationDateTime',
                        _('Creation date'),
                        width=self.getColumnWidth('creationDateTime'),
                        renderCallback=self.renderCreationDateTime,
                        sortCallback=uicommand.ViewerSortByCommand(
                            viewer=self, value='creationDateTime'),
                        **kwargs))
     columns.append(
         widgets.Column('modificationDateTime',
                        _('Modification date'),
                        width=self.getColumnWidth('modificationDateTime'),
                        renderCallback=self.renderModificationDateTime,
                        sortCallback=uicommand.ViewerSortByCommand(
                            viewer=self, value='modificationDateTime'),
                        *category.Category.modificationEventTypes(),
                        **kwargs))
     #columns.append(widgets.Column('Create global category'))
     return columns
コード例 #12
0
 def createSortByUICommands(self):
     return [uicommand.ViewerSortByCommand(viewer=self, value='ordering',
                     menuText=_('&Manual ordering'),
                     helpText=self.sortByOrderingHelpText)] + super(ManualOrderingMixin, self).createSortByUICommands()