def __init__(self): self.DELAY = 1000 self.search_dialogs = {} self.activate_dialogs = {} wxgui_api.install_bundled_icon("wxoldalarms", '@oldalarmsdialog', ("oldalarms48.png", )) organism_alarms_api.install_unique_old_alarms_interface( self._choose_old_alarms_unique) wxgui_api.register_aborted_save_warning( organism_timer_api.get_old_occurrences_search_exception(), "The database cannot be saved while the old " "alarms are being searched and activated.") # Enabling and closing do not race, i.e. it's impossible that first a # dialog is started to be created, but it's tried to be closed *while* # it's creating, *before* it's shown; this is because these two events # run sequentially on the same thread, and they both trigger actions # on the GUI (creating the dialog and closing it) that run on the main # thread, so while the dialog is creating, the call for closing it, # even if triggered, has to wait for the dialog to be created organism_timer_api.bind_to_search_old_alarms(self._enable_search) organism_timer_api.bind_to_search_old_alarms_end(self._disable_search) organism_alarms_api.bind_to_activate_alarms_range( self._enable_activate) organism_alarms_api.bind_to_activate_alarms_range_end( self._disable_activate) core_api.bind_to_closing_database(self._handle_closing_database)
def __init__(self): wx.TaskBarIcon.__init__(self) self.ID_MINIMIZE = wx.NewId() # Let self.restore have a different ID from menumin in the main menu, # in fact this is a check item, while the other is a normal item self.ID_RESTORE = wx.NewId() # Don't use wx.ID_EXIT because it assigns a Ctrl+q accelerator # automatically self.ID_EXIT = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtrayicon')( 'GlobalShortcuts') wxgui_api.install_bundled_icon("wxtrayicon", '@tray', ("Tango", "tray16.png")) wxgui_api.install_bundled_icon("wxtrayicon", '@traywarning', ("warning24.png", )) self.icon = BlinkingIcon(self) menumin = wx.MenuItem( wxgui_api.get_menu_file(), self.ID_MINIMIZE, '&Minimize to tray\t{}'.format(config['minimize']), 'Minimize the main window to tray icon') menumin.SetBitmap(wxgui_api.get_menu_icon('@tray')) wxgui_api.add_menu_file_item(menumin) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self._handle_left_click) self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self._handle_right_click) wxgui_api.bind_to_close_window(self.hide_main_window) wxgui_api.bind_to_menu(self.hide_main_window, menumin) core_api.bind_to_exit_app_2(self.remove)
def __init__(self): wx.TaskBarIcon.__init__(self) self.ID_MINIMIZE = wx.NewId() # Let self.restore have a different ID from menumin in the main menu, # in fact this is a check item, while the other is a normal item self.ID_RESTORE = wx.NewId() # Don't use wx.ID_EXIT because it assigns a Ctrl+q accelerator # automatically self.ID_EXIT = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtrayicon')( 'GlobalShortcuts') wxgui_api.install_bundled_icon("wxtrayicon", '@tray', ("Tango", "tray16.png")) wxgui_api.install_bundled_icon("wxtrayicon", '@traywarning', ("warning24.png", )) self.icon = BlinkingIcon(self) menumin = wx.MenuItem(wxgui_api.get_menu_file(), self.ID_MINIMIZE, '&Minimize to tray\t{}'.format(config['minimize']), 'Minimize the main window to tray icon') menumin.SetBitmap(wxgui_api.get_menu_icon('@tray')) wxgui_api.add_menu_file_item(menumin) self.Bind(wx.EVT_TASKBAR_LEFT_DOWN, self._handle_left_click) self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self._handle_right_click) wxgui_api.bind_to_close_window(self.hide_main_window) wxgui_api.bind_to_menu(self.hide_main_window, menumin) core_api.bind_to_exit_app_2(self.remove)
def __init__(self): self.DELAY = 1000 self.search_dialogs = {} self.activate_dialogs = {} wxgui_api.install_bundled_icon("wxoldalarms", '@oldalarmsdialog', ("oldalarms48.png", )) organism_alarms_api.install_unique_old_alarms_interface( self._choose_old_alarms_unique) wxgui_api.register_aborted_save_warning( organism_timer_api.get_old_occurrences_search_exception(), "The database cannot be saved while the old " "alarms are being searched and activated.") # Enabling and closing do not race, i.e. it's impossible that first a # dialog is started to be created, but it's tried to be closed *while* # it's creating, *before* it's shown; this is because these two events # run sequentially on the same thread, and they both trigger actions # on the GUI (creating the dialog and closing it) that run on the main # thread, so while the dialog is creating, the call for closing it, # even if triggered, has to wait for the dialog to be created organism_timer_api.bind_to_search_old_alarms(self._enable_search) organism_timer_api.bind_to_search_old_alarms_end(self._disable_search) organism_alarms_api.bind_to_activate_alarms_range( self._enable_activate) organism_alarms_api.bind_to_activate_alarms_range_end( self._disable_activate) core_api.bind_to_closing_database(self._handle_closing_database)
def __init__(self): wxgui_api.install_bundled_icon("wxalarmslog", '@alarmslog', ("alarmslog16.png", )) self.alarmlogs = {} self.mainmenu = LogsMenu(self) wxgui_api.bind_to_creating_tree(self._handle_creating_tree) wxgui_api.bind_to_load_property_options(self._handle_load_options) wxgui_api.bind_to_close_database(self._handle_close_database)
def __init__(self): wxgui_api.install_bundled_icon("wxalarmslog", '@alarmslog', ("alarmslog16.png", )) self.alarmlogs = {} self.mainmenu = LogsMenu(self) wxgui_api.bind_to_creating_tree(self._handle_creating_tree) wxgui_api.bind_to_load_property_options(self._handle_load_options) wxgui_api.bind_to_close_database(self._handle_close_database)
def __init__(self): self.items = {} self.itemicons = {} wxgui_api.install_bundled_icon("wxlinks", '@links', ("Tango", "links16.png")) ViewMenu(self) wxgui_api.bind_to_creating_tree(self._handle_creating_tree) wxgui_api.bind_to_close_database(self._handle_close_database) wxgui_api.bind_to_open_editor(self._handle_open_editor) wxgui_api.bind_to_close_editor(self._handle_close_editor)
def __init__(self): self.items = {} self.itemicons = {} wxgui_api.install_bundled_icon("wxlinks", '@links', ("Tango", "links16.png")) ViewMenu(self) wxgui_api.bind_to_creating_tree(self._handle_creating_tree) wxgui_api.bind_to_close_database(self._handle_close_database) wxgui_api.bind_to_open_editor(self._handle_open_editor) wxgui_api.bind_to_close_editor(self._handle_close_editor)
def __init__(self, plugin): self.plugin = plugin self.ID_MAIN = wx.NewId() self.ID_FOCUS = wx.NewId() self.ID_TOGGLE = wx.NewId() wxgui_api.install_bundled_icon("wxscheduler", '@scheduler', ("Tango", "scheduler16.png")) submenu = wx.Menu() config = coreaux_api.get_plugin_configuration('wxscheduler')( 'GlobalShortcuts') self.main = wx.MenuItem(wxgui_api.get_menu_view_editors(), self.ID_MAIN, '&Scheduler', 'Scheduler navigation actions', subMenu=submenu) self.focus = wx.MenuItem(submenu, self.ID_FOCUS, "&Focus\t{}".format(config['focus']), "Focus scheduler panel") self.toggle = wx.MenuItem(submenu, self.ID_TOGGLE, "&Toggle\t{}".format(config['toggle']), "Toggle scheduler panel") self.main.SetBitmap(wxgui_api.get_menu_icon('@scheduler')) self.focus.SetBitmap(wxgui_api.get_menu_icon('@jump')) self.toggle.SetBitmap(wxgui_api.get_menu_icon('@toggle')) wxgui_api.add_menu_editor_plugin(self.main) submenu.AppendItem(self.focus) submenu.AppendItem(self.toggle) wxgui_api.bind_to_menu(self._focus, self.focus) wxgui_api.bind_to_menu(self._toggle, self.toggle) wxgui_api.bind_to_menu_view_editors_disable(self._disable_items) wxgui_api.bind_to_reset_menu_items(self._reset_items)
def __init__(self, plugin): self.plugin = plugin self.ID_MAIN = wx.NewId() self.ID_FOCUS = wx.NewId() self.ID_TOGGLE = wx.NewId() wxgui_api.install_bundled_icon("wxscheduler", '@scheduler', ("Tango", "scheduler16.png")) submenu = wx.Menu() config = coreaux_api.get_plugin_configuration('wxscheduler')( 'GlobalShortcuts') self.main = wx.MenuItem(wxgui_api.get_menu_view_editors(), self.ID_MAIN, '&Scheduler', 'Scheduler navigation actions', subMenu=submenu) self.focus = wx.MenuItem(submenu, self.ID_FOCUS, "&Focus\t{}".format(config['focus']), "Focus scheduler panel") self.toggle = wx.MenuItem(submenu, self.ID_TOGGLE, "&Toggle\t{}".format(config['toggle']), "Toggle scheduler panel") self.main.SetBitmap(wxgui_api.get_menu_icon('@scheduler')) self.focus.SetBitmap(wxgui_api.get_menu_icon('@jump')) self.toggle.SetBitmap(wxgui_api.get_menu_icon('@toggle')) wxgui_api.add_menu_editor_plugin(self.main) submenu.AppendItem(self.focus) submenu.AppendItem(self.toggle) wxgui_api.bind_to_menu(self._focus, self.focus) wxgui_api.bind_to_menu(self._toggle, self.toggle) wxgui_api.bind_to_menu_view_editors_disable(self._disable_items) wxgui_api.bind_to_reset_menu_items(self._reset_items)
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)