Exemplo n.º 1
0
 def addMenuItemForTask(self, task, menu):
     uiCommand = uicommand.EffortStartForTask(task=task, taskList=self.tasks)
     uiCommand.appendToMenu(menu, self._window)
     activeChildren = [child for child in task.children() if child.active()]
     if activeChildren:
         activeChildren.sort(key=lambda task: task.subject())
         subMenu = wx.Menu()
         for child in activeChildren:
             self.addMenuItemForTask(child, subMenu)
         menu.AppendSubMenu(subMenu, _('%s (subtasks)')%task.subject())
Exemplo n.º 2
0
 def addMenuItemForTask(self, task, menu):  # pylint: disable-msg=W0621
     uiCommand = uicommand.EffortStartForTask(task=task,
                                              taskList=self.tasks)
     uiCommand.addToMenu(menu, self._window)
     activeChildren = [child for child in task.children() if \
                       child in self.tasks and child.active()]
     if activeChildren:
         activeChildren.sort(key=lambda task: task.subject())
         subMenu = wx.Menu()
         for child in activeChildren:
             self.addMenuItemForTask(child, subMenu)
         menu.AppendSubMenu(subMenu, _('%s (subtasks)') % task.subject())
Exemplo n.º 3
0
 def saveAndLoad(self, tasks, categories=None, notes=None):
     categories = categories or []
     notes = notes or []
     self.emptyTaskFile.tasks().extend(tasks)
     self.emptyTaskFile.categories().extend(categories)
     self.emptyTaskFile.notes().extend(notes)
     self.emptyTaskFile.save()
     self.emptyTaskFile.load()
     self.assertEqual([task.subject() for task in tasks], 
         [task.subject() for task in self.emptyTaskFile.tasks()])
     self.assertEqual([category.subject() for category in categories],
         [category.subject() for category in self.emptyTaskFile.categories()])
     self.assertEqual([note.subject() for note in notes],
         [note.subject() for note in self.emptyTaskFile.notes()])
    def pdfBody(self, columns, level, tasks):
        """ Returns the text's body section"""

        pdfBodyContent = "<ol>"

        """Iterate through the tasks and its selected columns and print these to plain text 
        including html tags to make it more readable. """

        for task in tasks:
            for column in columns:
                if column.render(task, humanReadable=False):
                    if column.name() == "subject":
                        pdfBodyContent = pdfBodyContent + "<li><b>Task Name: </b>" + task.subject() + "</i></li>"
                    else:
                        colContent = column.render(task, humanReadable=False)
                        # pdfBodyContent = pdfBodyContent + "<ul><li>"
                        pdfBodyContent = (
                            pdfBodyContent
                            + "<ul><ul><li><i>"
                            + column.header()
                            + "</i>: "
                            + str(colContent)
                            + "</li></ul></ul>"
                        )
                        # pdfBodyContent = pdfBodyContent + ": <i>"
                        # pdfBodyContent = pdfBodyContent + "<i>" +  str(colContent) + "</i>"
                        # pdfBodyContent = pdfBodyContent + "</i></li></ul>"

        # Return the completely created text document which are to be created to a pdf document.
        return pdfBodyContent + "</ol>"
Exemplo n.º 5
0
 def _addTaskRecursively(self, task, parentItem=None):
     ''' Add a task to the ComboTreeBox and then recursively add its
         subtasks. '''
     item = self._comboTreeBox.Append(task.subject(), parent=parentItem, 
                                      clientData=task)
     for child in task.children():
         self._addTaskRecursively(child, item)
Exemplo n.º 6
0
 def label(self, task):
     subject = task.subject()
     value = self.render(getattr(task, self.__orderBy)(recursive=False))
     if value:
         return '%s (%s)'%(subject, value) 
     else:
         return subject
Exemplo n.º 7
0
 def onEndEdit(self, event):
     ''' Make sure only the non-recursive part of the subject can be
         edited inline. '''
     event.Skip()
     if not self.isTreeViewer():
         # Restore the recursive subject. Here we don't care whether the user
         # actually changed the subject. If she did, the subject will updated
         # via the regular notification mechanism.
         treeItem = event.GetItem()
         task = self.widget.GetItemPyData(treeItem)
         self.widget.SetItemText(treeItem, task.subject(recursive=True))
Exemplo n.º 8
0
 def addMenuItemForTask(self, task, menu):  # pylint: disable=W0621
     uiCommand = uicommand.EffortStartForTask(task=task, taskList=self.tasks)
     uiCommand.addToMenu(menu, self._window)
     trackableChildren = [child for child in task.children() if \
                          child in self.tasks and not child.completed()]
     if trackableChildren:
         trackableChildren.sort(key=lambda child: child.subject())
         subMenu = Menu(self._window)
         for child in trackableChildren:
             self.addMenuItemForTask(child, subMenu)
         menu.AppendSubMenu(subMenu, _('%s (subtasks)') % task.subject())
Exemplo n.º 9
0
 def addMenuItemForTask(self, task, menu):  # pylint: disable=W0621
     uiCommand = uicommand.EffortStartForTask(task=task, taskList=self.tasks)
     uiCommand.addToMenu(menu, self._window)
     trackableChildren = [child for child in task.children() if \
                          child in self.tasks and not child.completed()]
     if trackableChildren:
         trackableChildren.sort(key=lambda child: child.subject())
         subMenu = Menu(self._window)
         for child in trackableChildren:
             self.addMenuItemForTask(child, subMenu)
         menu.AppendSubMenu(subMenu, _('%s (subtasks)') % task.subject())
Exemplo n.º 10
0
 def assertItems(self, *tasks):
     self.viewer.widget.expandAllItems()
     self.assertEqual(self.viewer.size(), len(tasks))
     for index, task in enumerate(tasks):
         if type(task) == type(()):
             task, nrChildren = task
         else:
             nrChildren = 0
         subject = task.subject(recursive=not self.viewer.isTreeViewer())
         treeItem = self.viewer.widget.GetItemChildren(recursively=True)[index]
         self.assertEqual(subject, self.viewer.widget.GetItemText(treeItem))
         self.assertEqual(nrChildren, self.viewer.widget.GetChildrenCount(treeItem, recursively=False))
Exemplo n.º 11
0
 def onBeginEdit(self, event):
     ''' Make sure only the non-recursive part of the subject can be
         edited inline. '''
     event.Skip()
     if not self.isTreeViewer():
         # Make sure the text control only shows the non-recursive subject
         # by temporarily changing the item text into the non-recursive
         # subject. When the editing ends, we change the item text back into
         # the recursive subject. See onEndEdit.
         treeItem = event.GetItem()
         task = self.widget.GetItemPyData(treeItem)
         self.widget.SetItemText(treeItem, task.subject())
Exemplo n.º 12
0
    def __init__(self, parent, task, *args, **kwargs):
        super(SubjectPage, self).__init__(parent, task, *args, **kwargs)
        descriptionBox = widgets.BoxWithFlexGridSizer(self, _("Description"), cols=2, growableRow=1, growableCol=1)
        descriptionBox.add(_("Subject"))
        self._subjectEntry = widgets.SingleLineTextCtrl(descriptionBox, task.subject())
        descriptionBox.add(self._subjectEntry, proportion=1, flag=wx.EXPAND)
        descriptionBox.add(_("Description"))
        self._descriptionEntry = widgets.MultiLineTextCtrl(descriptionBox, task.description())
        descriptionBox.add(self._descriptionEntry, proportion=1, flag=wx.EXPAND)

        priorityBox = widgets.BoxWithFlexGridSizer(self, _("Priority"), cols=2)
        priorityBox.add(_("Priority"))
        self._prioritySpinner = PrioritySpinCtrl(priorityBox, value=render.priority(task.priority()))
        priorityBox.add(self._prioritySpinner)

        for box, proportion in [(descriptionBox, 1), (priorityBox, 0)]:
            box.fit()
            self.add(box, proportion=proportion, flag=wx.EXPAND | wx.ALL, border=5)
        self.fit()
Exemplo n.º 13
0
    def pdfBody(self, columns, level, tasks):
        ''' Returns the text's body section'''

        pdfBodyContent = "<ol>"
        '''Iterate through the tasks and its selected columns and print these to plain text 
        including html tags to make it more readable. '''

        for task in tasks:
            for column in columns:
                if column.render(task, humanReadable=False):
                    if column.name() == 'subject':
                        pdfBodyContent = pdfBodyContent + "<li><b>Task Name: </b>" + task.subject(
                        ) + "</i></li>"
                    else:
                        colContent = column.render(task, humanReadable=False)
                        #pdfBodyContent = pdfBodyContent + "<ul><li>"
                        pdfBodyContent = pdfBodyContent + "<ul><ul><li><i>" + column.header(
                        ) + "</i>: " + str(colContent) + "</li></ul></ul>"
                        #pdfBodyContent = pdfBodyContent + ": <i>"
                        #pdfBodyContent = pdfBodyContent + "<i>" +  str(colContent) + "</i>"
                        #pdfBodyContent = pdfBodyContent + "</i></li></ul>"

        #Return the completely created text document which are to be created to a pdf document.
        return pdfBodyContent + "</ol>"
Exemplo n.º 14
0
 def updateMenuItems(self):
     self.clearMenu()
     activeRootTasks = self._activeRootTasks()
     activeRootTasks.sort(key=lambda task: task.subject())
     for activeRootTask in activeRootTasks:
         self.addMenuItemForTask(activeRootTask, self)
Exemplo n.º 15
0
 def updateMenuItems(self):
     self.clearMenu()
     trackableRootTasks = self._trackableRootTasks()
     trackableRootTasks.sort(key=lambda task: task.subject())
     for trackableRootTask in trackableRootTasks:
         self.addMenuItemForTask(trackableRootTask, self)
Exemplo n.º 16
0
 def assertItems(self, *tasks):
     self.assertEqual(len(tasks), self.viewer.size())
     for index, task in enumerate(tasks):
         self.assertEqual(task.subject(recursive=True), self.viewer.widget.GetItemText(index))
Exemplo n.º 17
0
 def updateMenuItems(self):
     self.clearMenu()
     activeRootTasks = self._activeRootTasks()
     activeRootTasks.sort(key=lambda task: task.subject())
     for task in activeRootTasks:
         self.addMenuItemForTask(task, self)
Exemplo n.º 18
0
 def updateMenuItems(self):
     self.clearMenu()
     trackableRootTasks = self._trackableRootTasks()
     trackableRootTasks.sort(key=lambda task: task.subject())
     for trackableRootTask in trackableRootTasks:
         self.addMenuItemForTask(trackableRootTask, self)
Exemplo n.º 19
0
 def addPage(self, task):
     page = TaskEditBook(self._interior, task, self._taskFile, self._settings)
     self._interior.AddPage(page, task.subject())
Exemplo n.º 20
0
 def renderSubject(self, task):
     return task.subject(recursive=not self.isTreeViewer())
Exemplo n.º 21
0
 def addPage(self, task):
     page = TaskEditBook(self._interior, task, self._taskList, self._uiCommands, self._settings, self._categories)
     self._interior.AddPage(page, task.subject())