def __init__(self, plugin): if ui_environment['platform'] == 'maemo': defaultsize = (800, 480) else: defaultsize = (900, 500) Dialog.__init__(self, plugin.ui, _('Qda Codes'), # T: dialog title buttons=gtk.BUTTONS_CLOSE, help=':Plugins:Qda Codes', defaultwindowsize=defaultsize) self.plugin = plugin if ui_environment['platform'] == 'maemo': self.resize(800, 480) # Force maximum dialog size under maemo, otherwise # we'll end with a too small dialog and no way to resize it hbox = gtk.HBox(spacing=5) self.vbox.pack_start(hbox, False) self.hpane = HPaned() self.uistate.setdefault('hpane_pos', 75) self.hpane.set_position(self.uistate['hpane_pos']) self.vbox.add(self.hpane) # Code list self.qda_codes = QdaCodesTreeView(self.ui, plugin) self.qda_codes.set_headers_visible(True) # Fix for maemo self.hpane.add2(ScrolledWindow(self.qda_codes)) # Tag list self.tag_list = TagListTreeView(self.qda_codes) self.hpane.add1(ScrolledWindow(self.tag_list)) # Filter input hbox.pack_start(gtk.Label(_('Filter') + ': '), False) # T: Input label filter_entry = InputEntry() filter_entry.set_icon_to_clear() hbox.pack_start(filter_entry, False) filter_cb = DelayedCallback(500, lambda o: self.qda_codes.set_filter(filter_entry.get_text())) filter_entry.connect('changed', filter_cb) # Statistics label # self.statistics_label = gtk.Label() # hbox.pack_end(self.statistics_label, False) export_button = gtk.Button(_('_Export') ) export_button.connect_object('clicked', self.qda_codes.get_data_as_page, self.qda_codes ) hbox.pack_end(export_button, False ) def on_qdacodes_changed(o): self.qda_codes.refresh() self.tag_list.refresh(self.qda_codes) # set_statistics() callback = DelayedCallback(10, on_qdacodes_changed) # Don't really care about the delay, but want to # make it less blocking - should be async preferably # now it is at least on idle self.connectto(plugin, 'qdacodes-changed', callback)
def __init__(self, parent, tasksview, properties): Dialog.__init__( self, parent, _('Task List'), # T: dialog title buttons=Gtk.ButtonsType.CLOSE, help=':Plugins:Task List', defaultwindowsize=(550, 400)) self.properties = properties self.tasksview = tasksview self.notebook = parent.notebook hbox = Gtk.HBox(spacing=5) self.vbox.pack_start(hbox, False, True, 0) self.hpane = HPaned() self.uistate.setdefault('hpane_pos', 75) self.hpane.set_position(self.uistate['hpane_pos']) self.vbox.pack_start(self.hpane, True, True, 0) # Task list self.uistate.setdefault('only_show_act', False) self.uistate.setdefault('show_flatlist', False) self.uistate.setdefault('sort_column', 0) self.uistate.setdefault('sort_order', int(Gtk.SortType.DESCENDING)) opener = parent.navigation self.task_list = TaskListTreeView( self.tasksview, opener, _parse_task_labels(properties['labels']), nonactionable_tags=_parse_task_labels( properties['nonactionable_tags']), filter_actionable=self.uistate['only_show_act'], tag_by_page=properties['tag_by_page'], use_workweek=properties['use_workweek'], flatlist=self.uistate['show_flatlist'], sort_column=self.uistate['sort_column'], sort_order=self.uistate['sort_order']) self.task_list.set_headers_visible(True) self.task_list.connect('populate-popup', self.on_populate_popup) self.hpane.add2(ScrolledWindow(self.task_list)) # Tag list self.tag_list = TagListTreeView(self.task_list) self.hpane.add1(ScrolledWindow(self.tag_list)) self.connectto(properties, 'changed', self.on_properties_changed) # Filter input hbox.pack_start(Gtk.Label(_('Filter') + ': '), False, True, 0) # T: Input label filter_entry = InputEntry() filter_entry.set_icon_to_clear() hbox.pack_start(filter_entry, False, True, 0) filter_cb = DelayedCallback( 500, lambda o: self.task_list.set_filter(filter_entry.get_text())) filter_entry.connect('changed', filter_cb) # TODO: use menu button here and add same options as in context menu # for filtering the list def on_show_active_toggle(o): active = self.act_toggle.get_active() if self.uistate['only_show_act'] != active: self.uistate['only_show_act'] = active self.task_list.set_filter_actionable(active) self.act_toggle = Gtk.CheckButton.new_with_mnemonic( _('Only Show Active Tasks')) # T: Checkbox in task list - this options hides tasks that are not yet started self.act_toggle.set_active(self.uistate['only_show_act']) self.act_toggle.connect('toggled', on_show_active_toggle) self.uistate.connect( 'changed', lambda o: self.act_toggle.set_active(self.uistate[ 'only_show_act'])) hbox.pack_start(self.act_toggle, False, True, 0) # Statistics label self.statistics_label = Gtk.Label() hbox.pack_end(self.statistics_label, False, True, 0) def set_statistics(): total = self.task_list.get_n_tasks() text = ngettext('%i open item', '%i open items', total) % total # T: Label for task List, %i is the number of tasks self.statistics_label.set_text(text) set_statistics() def on_tasklist_changed(o): self.task_list.refresh() self.tag_list.refresh(self.task_list) set_statistics() callback = DelayedCallback(10, on_tasklist_changed) # Don't really care about the delay, but want to # make it less blocking - should be async preferably # now it is at least on idle from . import TaskListNotebookExtension nb_ext = find_extension(self.notebook, TaskListNotebookExtension) self.connectto(nb_ext, 'tasklist-changed', callback)
def __init__(self, window, tasksview, preferences): Dialog.__init__( self, window, _('Task List'), # T: dialog title buttons=gtk.BUTTONS_CLOSE, help=':Plugins:Task List', defaultwindowsize=(550, 400)) self.preferences = preferences self.tasksview = tasksview hbox = gtk.HBox(spacing=5) self.vbox.pack_start(hbox, False) self.hpane = HPaned() self.uistate.setdefault('hpane_pos', 75) self.hpane.set_position(self.uistate['hpane_pos']) self.vbox.add(self.hpane) # Task list self.uistate.setdefault('only_show_act', False) self.uistate.setdefault('show_flatlist', False) self.uistate.setdefault('sort_column', 0) self.uistate.setdefault('sort_order', int(gtk.SORT_DESCENDING)) opener = window.get_resource_opener() task_labels = _parse_task_labels(preferences['labels']) nonactionable_tags = _parse_task_labels( preferences['nonactionable_tags']) self.task_list = TaskListTreeView( self.tasksview, opener, task_labels, nonactionable_tags=nonactionable_tags, filter_actionable=self.uistate['only_show_act'], tag_by_page=preferences['tag_by_page'], use_workweek=preferences['use_workweek'], flatlist=self.uistate['show_flatlist'], sort_column=self.uistate['sort_column'], sort_order=self.uistate['sort_order']) self.task_list.set_headers_visible(True) self.task_list.connect('populate-popup', self.on_populate_popup) self.hpane.add2(ScrolledWindow(self.task_list)) # Tag list self.tag_list = TagListTreeView(self.task_list, task_labels) self.hpane.add1(ScrolledWindow(self.tag_list)) # Filter input hbox.pack_start(gtk.Label(_('Filter') + ': '), False) # T: Input label filter_entry = InputEntry() filter_entry.set_icon_to_clear() hbox.pack_start(filter_entry, False) filter_cb = DelayedCallback( 500, lambda o: self.task_list.set_filter(filter_entry.get_text())) filter_entry.connect('changed', filter_cb) # TODO: use menu button here and add same options as in context menu # for filtering the list def on_show_active_toggle(o): active = self.act_toggle.get_active() if self.uistate['only_show_act'] != active: self.uistate['only_show_act'] = active self.task_list.set_filter_actionable(active) self.act_toggle = gtk.CheckButton(_('Only Show Active Tasks')) # T: Checkbox in task list - this options hides tasks that are not yet started self.act_toggle.set_active(self.uistate['only_show_act']) self.act_toggle.connect('toggled', on_show_active_toggle) self.uistate.connect( 'changed', lambda o: self.act_toggle.set_active(self.uistate[ 'only_show_act'])) hbox.pack_start(self.act_toggle, False) # Statistics label self.statistics_label = gtk.Label() hbox.pack_end(self.statistics_label, False) def set_statistics(): total = self.task_list.get_n_tasks() text = ngettext('%i open item', '%i open items', total) % total # T: Label for task List, %i is the number of tasks self.statistics_label.set_text(text) set_statistics() def on_tasklist_changed(o): self.task_list.refresh() self.tag_list.refresh(self.task_list) set_statistics() callback = DelayedCallback(10, on_tasklist_changed) # Don't really care about the delay, but want to # make it less blocking - should be async preferably # now it is at least on idle ### XXX HACK to get dependency to connect to ### -- no access to plugin, so can;t use get_extension() ## -- duplicat of this snippet in MainWindowExtension for e in window.ui.notebook.__zim_extension_objects__: if hasattr(e, 'indexer' ) and e.indexer.__class__.__name__ == 'TasksIndexer': self.connectto(e, 'tasklist-changed', callback) break else: raise AssertionError, 'Could not find tasklist notebook extension'
def __init__(self, window, index_ext, preferences): Dialog.__init__( self, window, _('Task List'), # T: dialog title buttons=gtk.BUTTONS_CLOSE, help=':Plugins:Task List', defaultwindowsize=(550, 400)) self.preferences = preferences self.index_ext = index_ext hbox = gtk.HBox(spacing=5) self.vbox.pack_start(hbox, False) self.hpane = HPaned() self.uistate.setdefault('hpane_pos', 75) self.hpane.set_position(self.uistate['hpane_pos']) self.vbox.add(self.hpane) # Task list self.uistate.setdefault('only_show_act', False) opener = window.get_resource_opener() self.task_list = TaskListTreeView( self.index_ext, opener, filter_actionable=self.uistate['only_show_act'], tag_by_page=preferences['tag_by_page'], use_workweek=preferences['use_workweek']) self.task_list.set_headers_visible(True) # Fix for maemo self.hpane.add2(ScrolledWindow(self.task_list)) # Tag list self.tag_list = TagListTreeView(self.index_ext, self.task_list) self.hpane.add1(ScrolledWindow(self.tag_list)) # Filter input hbox.pack_start(gtk.Label(_('Filter') + ': '), False) # T: Input label filter_entry = InputEntry() filter_entry.set_icon_to_clear() hbox.pack_start(filter_entry, False) filter_cb = DelayedCallback( 500, lambda o: self.task_list.set_filter(filter_entry.get_text())) filter_entry.connect('changed', filter_cb) # Dropdown with options - TODO #~ menu = gtk.Menu() #~ showtree = gtk.CheckMenuItem(_('Show _Tree')) # T: menu item in options menu #~ menu.append(showtree) #~ menu.append(gtk.SeparatorMenuItem()) #~ showall = gtk.RadioMenuItem(None, _('Show _All Items')) # T: menu item in options menu #~ showopen = gtk.RadioMenuItem(showall, _('Show _Open Items')) # T: menu item in options menu #~ menu.append(showall) #~ menu.append(showopen) #~ menubutton = MenuButton(_('_Options'), menu) # T: Button label #~ hbox.pack_start(menubutton, False) self.act_toggle = gtk.CheckButton(_('Only Show Actionable Tasks')) # T: Checkbox in task list self.act_toggle.set_active(self.uistate['only_show_act']) self.act_toggle.connect( 'toggled', lambda o: self.task_list.set_filter_actionable(o.get_active())) hbox.pack_start(self.act_toggle, False) # Statistics label self.statistics_label = gtk.Label() hbox.pack_end(self.statistics_label, False) def set_statistics(): total, stats = self.task_list.get_statistics() text = ngettext('%i open item', '%i open items', total) % total # T: Label for statistics in Task List, %i is the number of tasks text += ' (' + '/'.join(map(str, stats)) + ')' self.statistics_label.set_text(text) set_statistics() def on_tasklist_changed(o): self.task_list.refresh() self.tag_list.refresh(self.task_list) set_statistics() callback = DelayedCallback(10, on_tasklist_changed) # Don't really care about the delay, but want to # make it less blocking - should be async preferably # now it is at least on idle self.connectto(index_ext, 'tasklist-changed', callback)
def __init__(self, plugin): if ui_environment['platform'] == 'maemo': defaultsize = (800, 480) else: defaultsize = (550, 400) Dialog.__init__(self, plugin.ui, _('Task List'), # T: dialog title buttons=gtk.BUTTONS_CLOSE, help=':Plugins:Task List', defaultwindowsize=defaultsize) self.plugin = plugin if ui_environment['platform'] == 'maemo': self.resize(800, 480) # Force maximum dialog size under maemo, otherwise # we'll end with a too small dialog and no way to resize it hbox = gtk.HBox(spacing=5) self.vbox.pack_start(hbox, False) self.hpane = HPaned() self.uistate.setdefault('hpane_pos', 75) self.hpane.set_position(self.uistate['hpane_pos']) self.vbox.add(self.hpane) # Task list self.uistate.setdefault('only_show_act', False) self.task_list = TaskListTreeView(self.ui, plugin, filter_actionable=self.uistate['only_show_act']) self.task_list.set_headers_visible(True) # Fix for maemo self.hpane.add2(ScrolledWindow(self.task_list)) # Tag list self.tag_list = TagListTreeView(self.task_list) self.hpane.add1(ScrolledWindow(self.tag_list)) # Filter input hbox.pack_start(gtk.Label(_('Filter') + ': '), False) # T: Input label filter_entry = InputEntry() filter_entry.set_icon_to_clear() hbox.pack_start(filter_entry, False) filter_cb = DelayedCallback(500, lambda o: self.task_list.set_filter(filter_entry.get_text())) filter_entry.connect('changed', filter_cb) # Dropdown with options - TODO # ~ menu = gtk.Menu() # ~ showtree = gtk.CheckMenuItem(_('Show _Tree')) # T: menu item in options menu # ~ menu.append(showtree) # ~ menu.append(gtk.SeparatorMenuItem()) # ~ showall = gtk.RadioMenuItem(None, _('Show _All Items')) # T: menu item in options menu # ~ showopen = gtk.RadioMenuItem(showall, _('Show _Open Items')) # T: menu item in options menu # ~ menu.append(showall) # ~ menu.append(showopen) # ~ menubutton = MenuButton(_('_Options'), menu) # T: Button label # ~ hbox.pack_start(menubutton, False) self.act_toggle = gtk.CheckButton(_('Only Show Actionable Tasks')) # T: Checkbox in task list self.act_toggle.set_active(self.uistate['only_show_act']) self.act_toggle.connect('toggled', lambda o: self.task_list.set_filter_actionable(o.get_active())) hbox.pack_start(self.act_toggle, False) # Statistics label self.statistics_label = gtk.Label() hbox.pack_end(self.statistics_label, False) def set_statistics(): total, stats = self.task_list.get_statistics() text = ngettext('%i open item', '%i open items', total) % total # T: Label for statistics in Task List, %i is the number of tasks text += ' (' + '/'.join(map(str, stats)) + ')' self.statistics_label.set_text(text) set_statistics() def on_tasklist_changed(o): self.task_list.refresh() self.tag_list.refresh(self.task_list) set_statistics() callback = DelayedCallback(10, on_tasklist_changed) # Don't really care about the delay, but want to # make it less blocking - should be async preferably # now it is at least on idle self.connectto(plugin, 'tasklist-changed', callback)
def __init__(self, window, index_ext): Dialog.__init__(self, window, _('Task List EDS'), # T: dialog title buttons=gtk.BUTTONS_CLOSE, help=':Plugins:Task List EDS', defaultwindowsize=(550, 400) ) self.index_ext = index_ext hbox = gtk.HBox(spacing=5) self.vbox.pack_start(hbox, False) self.hpane = HPaned() self.uistate.setdefault('hpane_pos', 75) self.hpane.set_position(self.uistate['hpane_pos']) self.vbox.add(self.hpane) # Task list opener = window.get_resource_opener() self.task_list = TaskListTreeView( self.index_ext, opener ) self.task_list.set_headers_visible(True) # Fix for maemo self.hpane.add2(ScrolledWindow(self.task_list)) # Tag list self.tag_list = TagListTreeView(self.index_ext, self.task_list) self.hpane.add1(ScrolledWindow(self.tag_list)) # Filter input hbox.pack_start(gtk.Label(_('Filter')+': '), False) # T: Input label filter_entry = InputEntry() filter_entry.set_icon_to_clear() hbox.pack_start(filter_entry, False) filter_cb = DelayedCallback(500, lambda o: self.task_list.set_filter(filter_entry.get_text())) filter_entry.connect('changed', filter_cb) # Dropdown with options - TODO #~ menu = gtk.Menu() #~ showtree = gtk.CheckMenuItem(_('Show _Tree')) # T: menu item in options menu #~ menu.append(showtree) #~ menu.append(gtk.SeparatorMenuItem()) #~ showall = gtk.RadioMenuItem(None, _('Show _All Items')) # T: menu item in options menu #~ showopen = gtk.RadioMenuItem(showall, _('Show _Open Items')) # T: menu item in options menu #~ menu.append(showall) #~ menu.append(showopen) #~ menubutton = MenuButton(_('_Options'), menu) # T: Button label #~ hbox.pack_start(menubutton, False) # Statistics label self.statistics_label = gtk.Label() hbox.pack_end(self.statistics_label, False) def set_statistics(): total, stats = self.task_list.get_statistics() text = ngettext('%i open item', '%i open items', total) % total # T: Label for statistics in Task List, %i is the number of tasks text += ' (' + '/'.join(map(str, stats)) + ')' self.statistics_label.set_text(text) set_statistics() def on_tasklist_changed(o): self.task_list.refresh() self.tag_list.refresh(self.task_list) set_statistics() callback = DelayedCallback(10, on_tasklist_changed) # Don't really care about the delay, but want to # make it less blocking - should be async preferably # now it is at least on idle self.connectto(index_ext, 'tasklist-changed', callback)