コード例 #1
0
ファイル: mixin.py プロジェクト: dfainstein/seng_taskcoach
 def createToggleCategoryFilterCommands(self, categories):
     categories = list(categories)
     categories.sort(key=lambda category: category.subject())
     commands = [uicommand.ToggleCategoryFilter(category=category) for category in categories]
     categoriesWithChildren = [category for category in categories if category.children()]
     if categoriesWithChildren:
         commands.append(None)
         for category in categoriesWithChildren:
             subCommands = [_('%s (subcategories)')%category.subject()]
             subCommands.extend(self.createToggleCategoryFilterCommands(category.children()))
             commands.append(tuple(subCommands))
     return commands
コード例 #2
0
 def addMenuItemsForCategories(self, categories, menu):
     categories = categories[:]
     categories.sort(key=lambda category: category.subject())
     for category in categories:
         uiCommand = uicommand.ToggleCategory(category=category, viewer=self.viewer)
         uiCommand.addToMenu(menu, self._window)
     categoriesWithChildren = [category for category in categories if category.children()]
     if categoriesWithChildren:
         menu.AppendSeparator()
         for category in categoriesWithChildren:
             subMenu = wx.Menu()
             self.addMenuItemsForCategories(category.children(), subMenu)
             menu.AppendSubMenu(subMenu, self.subMenuLabel(category))            
コード例 #3
0
ファイル: menu.py プロジェクト: casics/extractor
 def addMenuItemsForCategories(self, categories, menu):
     # pylint: disable=W0621
     categories = categories[:]
     categories.sort(key=lambda category: category.subject().lower())
     for category in categories:
         uiCommand = uicommand.ToggleCategory(category=category, 
                                              viewer=self.viewer)
         uiCommand.addToMenu(menu, self._window)
     categoriesWithChildren = [category for category in categories if category.children()]
     if categoriesWithChildren:
         menu.AppendSeparator()
         for category in categoriesWithChildren:
             subMenu = Menu(self._window)
             self.addMenuItemsForCategories(category.children(), subMenu)
             menu.AppendSubMenu(subMenu, self.subMenuLabel(category))            
コード例 #4
0
ファイル: menu.py プロジェクト: dfraser74/taskcoach
 def addMenuItemsForCategories(self, categories, menu):
     categories = categories[:]
     categories.sort(key=lambda category: category.subject())
     for category in categories:
         uiCommand = self.uiCommandClass(category=category,
                                         viewer=self.viewer)
         uiCommand.addToMenu(menu, self._window)
     categoriesWithChildren = [
         category for category in categories if category.children()
     ]
     if categoriesWithChildren:
         menu.AppendSeparator()
         for category in categoriesWithChildren:
             subMenu = wx.Menu()
             self.addMenuItemsForCategories(category.children(), subMenu)
             menu.AppendSubMenu(subMenu, self.subMenuLabel(category))
コード例 #5
0
ファイル: editor.py プロジェクト: HieronymusCH/TaskCoach
 def getCategoryWithIndex(self, index):
     children = self.__categories.rootItems()
     for i in index:
         category = children[i]
         childIndices = [
             self.__categories.index(child) for child in category.children() if child in self.__categories
         ]
         childIndices.sort()
         children = [self.__categories[childIndex] for childIndex in childIndices]
     return category
コード例 #6
0
ファイル: editor.py プロジェクト: HieronymusCH/TaskCoach
 def getChildrenCount(self, index):  # FIXME: duplication with viewers
     if index == ():
         return len(self.__categories.rootItems())
     else:
         category = self.getCategoryWithIndex(index)
         return len(category.children())