def main(): global mainmenu mainmenu = MainMenu() global nb_icon_index nb_icon_index = wxgui_api.add_right_nb_image( wxgui_api.get_notebook_icon('@dbfind')) global nb_icon_refresh_index nb_icon_refresh_index = wxgui_api.add_right_nb_image( wxgui_api.get_notebook_icon('@refresh'))
def __init__(self, parent): self.YEAR_LIMITS = self._set_search_limits() wxgui_api.install_bundled_icon("wxtasklist", '@activealarms', ("activealarms16.png", )) wxgui_api.install_bundled_icon("wxtasklist", '@dismiss', ("dismiss16.png", )) wxgui_api.install_bundled_icon("wxtasklist", '@navigator', ("Tango", "navigator16.png")) wxgui_api.install_bundled_icon("wxtasklist", '@scroll', ("Tango", "scroll16.png")) wxgui_api.install_bundled_icon("wxtasklist", '@snooze', ("snooze16.png", )) wxgui_api.install_bundled_icon("wxtasklist", '@snoozedialog', ("snoozedialog48.png", )) wxgui_api.install_bundled_icon("wxtasklist", '@tasklist', ("Tango", "tasklist16.png")) self.config = coreaux_api.get_plugin_configuration('wxtasklist') aconfig = self.config("ContextualShortcuts") accelerators = { aconfig["prev_page"]: lambda event: self.navigator.show_previous_page(), aconfig["next_page"]: lambda event: self.navigator.show_next_page(), aconfig["apply"]: lambda event: self.navigator.apply(), aconfig["set"]: lambda event: self.navigator.set(), aconfig["reset"]: lambda event: self.navigator.reset(), aconfig["autoscroll"]: lambda event: self.list_.autoscroll.execute_force(), aconfig["toggle_autoscroll"]: lambda event: self.list_.autoscroll.toggle(), aconfig["find"]: lambda event: self.list_.find_in_tree(), aconfig["edit"]: lambda event: self.list_.edit_items(), aconfig["snooze"]: lambda event: self.list_.snooze_selected_alarms_for_custom(), aconfig["snooze_all"]: lambda event: self.list_.snooze_all_alarms_for_custom(), aconfig["dismiss"]: lambda event: self.list_.dismiss_selected_alarms(), aconfig["dismiss_all"]: lambda event: self.list_.dismiss_all_alarms(), aconfig["toggle_navigator"]: lambda event: self.navigator.toggle_shown(), aconfig["toggle_gaps"]: lambda event: self.list_.toggle_gaps(), aconfig["toggle_overlappings"]: lambda event: self.list_.toggle_overlappings(), } accelerators.update(wxgui_api.get_right_nb_generic_accelerators()) acctable = wxgui_api.generate_right_nb_accelerators(accelerators) # Note that the remaining border is due to the SplitterWindow, whose # border cannot be removed because it's used to highlight the sash # See also http://trac.wxwidgets.org/ticket/12413 # and http://trac.wxwidgets.org/changeset/66230 self.panel = TaskListPanel(parent, self, acctable) self.pbox = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(self.pbox) self.nb_icon_index = wxgui_api.add_right_nb_image( wxgui_api.get_notebook_icon('@tasklist')) self.nb_icon_refresh_index = wxgui_api.add_right_nb_image( wxgui_api.get_notebook_icon('@refresh')) # filters.Navigator must be instantiated *before* # list_.OccurrencesView, because the former sets the filter for the # latter; note that inverting the order would work anyway because of a # usually favorable race condition (the list is refreshed after an # asynchronous delay), but of course that shouldn't be relied on self.navigator = filters.Navigator(self, self.YEAR_LIMITS) self.warningsbar = WarningsBar(self.panel) self.list_ = list_.OccurrencesView(self, self.navigator, self.YEAR_LIMITS) self.mainmenu = menus.MainMenu(self) self.viewmenu = menus.ViewMenu(self) self.panel.init_tab_menu(self) self.list_._init_context_menu(self.mainmenu) self.pbox.Add(self.warningsbar.get_panel(), flag=wx.EXPAND) self.pbox.Add(self.list_.listview, 1, flag=wx.EXPAND) self._show() wxgui_api.bind_to_show_main_window(self._handle_show_main_window) wxgui_api.bind_to_hide_main_window(self._handle_hide_main_window) core_api.bind_to_exit_app_1(self._handle_exit_application)