def __init__(self, taskBarIcon, settings, taskFile, viewer): super(TaskBarMenu, self).__init__(taskBarIcon) tasks = taskFile.tasks() efforts = taskFile.efforts() self.appendUICommands( uicommand.TaskNew(taskList=tasks, settings=settings)) self.appendMenu(_('New task from &template'), TaskTemplateMenu(taskBarIcon, taskList=tasks, settings=settings), 'newtmpl') self.appendUICommands(None) # Separator if settings.getboolean('feature', 'effort'): self.appendUICommands( uicommand.EffortNew(effortList=efforts, taskList=tasks, settings=settings)) self.appendUICommands( uicommand.CategoryNew(categories=taskFile.categories(), settings=settings)) if settings.getboolean('feature', 'notes'): self.appendUICommands( uicommand.NoteNew(notes=taskFile.notes(), settings=settings)) if settings.getboolean('feature', 'effort'): self.appendUICommands(None) # Separator label = _('&Start tracking effort') self.appendMenu(label, StartEffortForTaskMenu(taskBarIcon, base.filter.DeletedFilter(tasks), self, label), 'clock_icon') self.appendUICommands(uicommand.EffortStop(viewer=viewer, effortList=efforts, taskList=tasks)) self.appendUICommands( None, uicommand.MainWindowRestore(), uicommand.FileQuit())
def __init__(self, mainwindow, settings, iocontroller, viewerContainer): super(FileMenu, self).__init__(mainwindow) self.__settings = settings self.__iocontroller = iocontroller self.__recentFileUICommands = [] self.__separator = None self.appendUICommands( uicommand.FileOpen(iocontroller=iocontroller), uicommand.FileMerge(iocontroller=iocontroller), uicommand.FileClose(iocontroller=iocontroller), None, uicommand.FileSave(iocontroller=iocontroller), uicommand.FileMergeDiskChanges(iocontroller=iocontroller), uicommand.FileSaveAs(iocontroller=iocontroller), uicommand.FileSaveSelection(iocontroller=iocontroller, viewer=viewerContainer)) if not settings.getboolean('feature', 'syncml'): self.appendUICommands(uicommand.FilePurgeDeletedItems(iocontroller=iocontroller)) self.appendUICommands( None, uicommand.FileSaveSelectedTaskAsTemplate(iocontroller=iocontroller, viewer=viewerContainer), uicommand.FileImportTemplate(iocontroller=iocontroller), uicommand.FileEditTemplates(settings=settings), None, uicommand.PrintPageSetup(settings=settings), uicommand.PrintPreview(viewer=viewerContainer, settings=settings), uicommand.Print(viewer=viewerContainer, settings=settings), None) self.appendMenu(_('&Import'), ImportMenu(mainwindow, iocontroller)) self.appendMenu(_('&Export'), ExportMenu(mainwindow, iocontroller, settings), 'export') self.appendUICommands( None, uicommand.FileManageBackups(iocontroller=iocontroller, settings=settings) ) if settings.getboolean('feature', 'syncml'): try: import taskcoachlib.syncml.core # pylint: disable=W0612,W0404 except ImportError: pass else: self.appendUICommands(uicommand.FileSynchronize(iocontroller=iocontroller, settings=settings)) self.__recentFilesStartPosition = len(self) self.appendUICommands(None, uicommand.FileQuit()) self._window.Bind(wx.EVT_MENU_OPEN, self.onOpenMenu)