def __init__(self, plugin): self.plugin = plugin self.ID_ALARMS = wx.NewId() self.ID_SELECT = wx.NewId() self.ID_FIND = wx.NewId() submenu = wx.Menu() config = coreaux_api.get_plugin_configuration('wxalarmslog')( 'GlobalShortcuts') self.alarms = wx.MenuItem(wxgui_api.get_menu_logs(), self.ID_ALARMS, '&Alarms', 'Alarms log commands', subMenu=submenu) self.select = wx.MenuItem(submenu, self.ID_SELECT, "&Select\t{}".format(config['select']), "Select the alarms history log") self.find = wx.MenuItem(submenu, self.ID_FIND, "Find in &database\t{}".format(config['find']), "Select the database items associated to the selected entries") self.alarms.SetBitmap(wxgui_api.get_menu_icon('@alarmslog')) self.select.SetBitmap(wxgui_api.get_menu_icon('@jump')) self.find.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) wxgui_api.add_menu_logs_item(self.alarms) submenu.AppendItem(self.select) submenu.AppendItem(self.find) wxgui_api.bind_to_menu(self._select, self.select) wxgui_api.bind_to_menu(self._find_in_tree, self.find) wxgui_api.bind_to_menu_view_logs_update(self._update_items) wxgui_api.bind_to_menu_view_logs_disable(self._disable_items) wxgui_api.bind_to_reset_menu_items(self._reset_items)
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, plugin): self.plugin = plugin self.ID_UNDO = wx.NewId() self.ID_REDO = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtexthistory')( 'GlobalShortcuts') self.mundo = wx.MenuItem(wxgui_api.get_menu_editor(), self.ID_UNDO, '&Undo\t{}'.format(config['undo']), 'Undo the previous text edit') self.mredo = wx.MenuItem(wxgui_api.get_menu_editor(), self.ID_REDO, '&Redo\t{}'.format(config['redo']), 'Redo the next text edit') separator = wx.MenuItem(wxgui_api.get_menu_editor(), kind=wx.ITEM_SEPARATOR) self.mundo.SetBitmap(wxgui_api.get_menu_icon('@undo')) self.mredo.SetBitmap(wxgui_api.get_menu_icon('@redo')) # Add in reverse order wxgui_api.add_menu_editor_item(separator) wxgui_api.add_menu_editor_item(self.mredo) wxgui_api.add_menu_editor_item(self.mundo) wxgui_api.bind_to_menu(self.plugin.undo_text, self.mundo) wxgui_api.bind_to_menu(self.plugin.redo_text, self.mredo) wxgui_api.bind_to_reset_menu_items(self._reset) wxgui_api.bind_to_menu_edit_update(self._update)
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, mainmenu, ID_SNOOZE_FOR, ID_SNOOZE_FOR_N_index): wx.Menu.__init__(self) self.snoozetimes = {} for ID_SNOOZE_FOR_Ns, time, number, unit in mainmenu.snoozetimesconf: ID_SNOOZE_FOR_N = ID_SNOOZE_FOR_Ns[ID_SNOOZE_FOR_N_index] self.snoozetimes[time] = self.Append( ID_SNOOZE_FOR_N, "For " + str(number) + ' ' + unit) wxgui_api.bind_to_menu(self._snooze_for_loop(time), self.snoozetimes[time]) self.AppendSeparator() self.snoozefor = self.Append(ID_SNOOZE_FOR, "&For...") wxgui_api.bind_to_menu(self.snooze_for_custom, self.snoozefor)
def __init__(self, mainmenu, ID_SNOOZE_FOR, ID_SNOOZE_FOR_N_index): wx.Menu.__init__(self) self.snoozetimes = {} for ID_SNOOZE_FOR_Ns, time, number, unit in mainmenu.snoozetimesconf: ID_SNOOZE_FOR_N = ID_SNOOZE_FOR_Ns[ID_SNOOZE_FOR_N_index] self.snoozetimes[time] = self.Append(ID_SNOOZE_FOR_N, "For " + str(number) + ' ' + unit) wxgui_api.bind_to_menu(self._snooze_for_loop(time), self.snoozetimes[time]) self.AppendSeparator() self.snoozefor = self.Append(ID_SNOOZE_FOR, "&For...") wxgui_api.bind_to_menu(self.snooze_for_custom, self.snoozefor)
def __init__(self, tasklist): wx.Menu.__init__(self) self.tasklist = tasklist self.ID_PREVIOUS = wx.NewId() self.ID_NEXT = wx.NewId() self.ID_APPLY = wx.NewId() self.ID_SET = wx.NewId() self.ID_RESET = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('Navigator') self.previous = wx.MenuItem( self, self.ID_PREVIOUS, "&Previous page\t{}".format(config['previous']), "View the previous page of events") self.next = wx.MenuItem(self, self.ID_NEXT, "&Next page\t{}".format(config['next']), "View the next page of events") self.apply = wx.MenuItem(self, self.ID_APPLY, "&Apply filters\t{}".format(config['apply']), "Apply the configured filters") self.set = wx.MenuItem(self, self.ID_SET, "Se&t filters\t{}".format(config['set']), "Apply and save the configured filters") self.reset = wx.MenuItem(self, self.ID_RESET, "&Reset filters\t{}".format(config['reset']), "Reset the filters to the saved ones") self.previous.SetBitmap(wxgui_api.get_menu_icon('@left')) self.next.SetBitmap(wxgui_api.get_menu_icon('@right')) self.apply.SetBitmap(wxgui_api.get_menu_icon('@apply')) self.set.SetBitmap(wxgui_api.get_menu_icon('@save')) self.reset.SetBitmap(wxgui_api.get_menu_icon('@undo')) self.AppendSeparator() self.AppendItem(self.previous) self.AppendItem(self.next) self.AppendItem(self.apply) self.AppendItem(self.set) self.AppendItem(self.reset) wxgui_api.bind_to_menu(self._go_to_previous_page, self.previous) wxgui_api.bind_to_menu(self._go_to_next_page, self.next) wxgui_api.bind_to_menu(self._apply_filters, self.apply) wxgui_api.bind_to_menu(self._set_filters, self.set) wxgui_api.bind_to_menu(self._reset_filters, self.reset)
def __init__(self, tasklist): wx.Menu.__init__(self) self.tasklist = tasklist self.ID_PREVIOUS = wx.NewId() self.ID_NEXT = wx.NewId() self.ID_APPLY = wx.NewId() self.ID_SET = wx.NewId() self.ID_RESET = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('Navigator') self.previous = wx.MenuItem(self, self.ID_PREVIOUS, "&Previous page\t{}".format(config['previous']), "View the previous page of events") self.next = wx.MenuItem(self, self.ID_NEXT, "&Next page\t{}".format(config['next']), "View the next page of events") self.apply = wx.MenuItem(self, self.ID_APPLY, "&Apply filters\t{}".format(config['apply']), "Apply the configured filters") self.set = wx.MenuItem(self, self.ID_SET, "Se&t filters\t{}".format(config['set']), "Apply and save the configured filters") self.reset = wx.MenuItem(self, self.ID_RESET, "&Reset filters\t{}".format(config['reset']), "Reset the filters to the saved ones") self.previous.SetBitmap(wxgui_api.get_menu_icon('@left')) self.next.SetBitmap(wxgui_api.get_menu_icon('@right')) self.apply.SetBitmap(wxgui_api.get_menu_icon('@apply')) self.set.SetBitmap(wxgui_api.get_menu_icon('@save')) self.reset.SetBitmap(wxgui_api.get_menu_icon('@undo')) self.AppendSeparator() self.AppendItem(self.previous) self.AppendItem(self.next) self.AppendItem(self.apply) self.AppendItem(self.set) self.AppendItem(self.reset) wxgui_api.bind_to_menu(self._go_to_previous_page, self.previous) wxgui_api.bind_to_menu(self._go_to_next_page, self.next) wxgui_api.bind_to_menu(self._apply_filters, self.apply) wxgui_api.bind_to_menu(self._set_filters, self.set) wxgui_api.bind_to_menu(self._reset_filters, self.reset)
def __init__(self, dbs): self.dbs = dbs self.ID_CUT = wx.NewId() self.ID_COPY = wx.NewId() self.ID_PASTE = wx.NewId() self.ID_PASTE_SUB = wx.NewId() config = coreaux_api.get_plugin_configuration("wxcopypaste")("GlobalShortcuts") self.mpaste_label_1 = "&Paste items\t{}".format(config["paste"]) self.mpaste_help_1 = "Paste items as root items" self.mpaste_label_2 = "&Paste as siblings\t{}".format(config["paste"]) self.mpaste_help_2 = "Paste items as siblings below the selected item" self.mcut = wx.MenuItem( wxgui_api.get_menu_database(), self.ID_CUT, "Cu&t items\t{}".format(config["cut"]), "Cut the selected items" ) self.mcopy = wx.MenuItem( wxgui_api.get_menu_database(), self.ID_COPY, "&Copy items\t{}".format(config["copy"]), "Copy the selected items", ) self.mpaste = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_PASTE, self.mpaste_label_1, self.mpaste_help_1) self.mpastesub = wx.MenuItem( wxgui_api.get_menu_database(), self.ID_PASTE_SUB, "P&aste as children\t{}".format(config["paste_children"]), "Paste items as children of the selected item", ) self.mcut.SetBitmap(wxgui_api.get_menu_icon("@cut")) self.mcopy.SetBitmap(wxgui_api.get_menu_icon("@copy")) self.mpaste.SetBitmap(wxgui_api.get_menu_icon("@paste")) self.mpastesub.SetBitmap(wxgui_api.get_menu_icon("@paste")) separator = wx.MenuItem(wxgui_api.get_menu_database(), kind=wx.ITEM_SEPARATOR) # Add in reverse order wxgui_api.add_menu_database_item(separator) wxgui_api.add_menu_database_item(self.mpastesub) wxgui_api.add_menu_database_item(self.mpaste) wxgui_api.add_menu_database_item(self.mcopy) wxgui_api.add_menu_database_item(self.mcut) wxgui_api.bind_to_menu(self.cut_items, self.mcut) wxgui_api.bind_to_menu(self.copy_items, self.mcopy) wxgui_api.bind_to_menu(self.paste_items_as_siblings, self.mpaste) wxgui_api.bind_to_menu(self.paste_items_as_children, self.mpastesub) wxgui_api.bind_to_reset_menu_items(self._handle_reset_menu_items) wxgui_api.bind_to_menu_database_update(self._handle_enable_tree_menus)
def __init__(self, dbs): self.dbs = dbs self.ID_CUT = wx.NewId() self.ID_COPY = wx.NewId() self.ID_PASTE = wx.NewId() self.ID_PASTE_SUB = wx.NewId() config = coreaux_api.get_plugin_configuration('wxcopypaste')( 'GlobalShortcuts') self.mpaste_label_1 = '&Paste items\t{}'.format(config['paste']) self.mpaste_help_1 = 'Paste items as root items' self.mpaste_label_2 = '&Paste as siblings\t{}'.format(config['paste']) self.mpaste_help_2 = 'Paste items as siblings below the selected item' self.mcut = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_CUT, 'Cu&t items\t{}'.format(config['cut']), 'Cut the selected items') self.mcopy = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_COPY, '&Copy items\t{}'.format(config['copy']), 'Copy the selected items') self.mpaste = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_PASTE, self.mpaste_label_1, self.mpaste_help_1) self.mpastesub = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_PASTE_SUB, 'P&aste as children\t{}'.format(config['paste_children']), 'Paste items as children of the selected item') self.mcut.SetBitmap(wxgui_api.get_menu_icon('@cut')) self.mcopy.SetBitmap(wxgui_api.get_menu_icon('@copy')) self.mpaste.SetBitmap(wxgui_api.get_menu_icon('@paste')) self.mpastesub.SetBitmap(wxgui_api.get_menu_icon('@paste')) separator = wx.MenuItem(wxgui_api.get_menu_database(), kind=wx.ITEM_SEPARATOR) # Add in reverse order wxgui_api.add_menu_database_item(separator) wxgui_api.add_menu_database_item(self.mpastesub) wxgui_api.add_menu_database_item(self.mpaste) wxgui_api.add_menu_database_item(self.mcopy) wxgui_api.add_menu_database_item(self.mcut) wxgui_api.bind_to_menu(self.cut_items, self.mcut) wxgui_api.bind_to_menu(self.copy_items, self.mcopy) wxgui_api.bind_to_menu(self.paste_items_as_siblings, self.mpaste) wxgui_api.bind_to_menu(self.paste_items_as_children, self.mpastesub) wxgui_api.bind_to_reset_menu_items(self._handle_reset_menu_items) wxgui_api.bind_to_menu_database_update(self._handle_enable_tree_menus)
def __init__(self, dbs): self.dbs = dbs self.ID_CUT = wx.NewId() self.ID_COPY = wx.NewId() self.ID_PASTE = wx.NewId() self.ID_PASTE_SUB = wx.NewId() config = coreaux_api.get_plugin_configuration('wxcopypaste')( 'GlobalShortcuts') self.mpaste_label_1 = '&Paste items\t{}'.format(config['paste']) self.mpaste_help_1 = 'Paste items as root items' self.mpaste_label_2 = '&Paste as siblings\t{}'.format(config['paste']) self.mpaste_help_2 = 'Paste items as siblings below the selected item' self.mcut = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_CUT, 'Cu&t items\t{}'.format(config['cut']), 'Cut the selected items') self.mcopy = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_COPY, '&Copy items\t{}'.format(config['copy']), 'Copy the selected items') self.mpaste = wx.MenuItem(wxgui_api.get_menu_database(), self.ID_PASTE, self.mpaste_label_1, self.mpaste_help_1) self.mpastesub = wx.MenuItem( wxgui_api.get_menu_database(), self.ID_PASTE_SUB, 'P&aste as children\t{}'.format(config['paste_children']), 'Paste items as children of the selected item') self.mcut.SetBitmap(wxgui_api.get_menu_icon('@cut')) self.mcopy.SetBitmap(wxgui_api.get_menu_icon('@copy')) self.mpaste.SetBitmap(wxgui_api.get_menu_icon('@paste')) self.mpastesub.SetBitmap(wxgui_api.get_menu_icon('@paste')) separator = wx.MenuItem(wxgui_api.get_menu_database(), kind=wx.ITEM_SEPARATOR) # Add in reverse order wxgui_api.add_menu_database_item(separator) wxgui_api.add_menu_database_item(self.mpastesub) wxgui_api.add_menu_database_item(self.mpaste) wxgui_api.add_menu_database_item(self.mcopy) wxgui_api.add_menu_database_item(self.mcut) wxgui_api.bind_to_menu(self.cut_items, self.mcut) wxgui_api.bind_to_menu(self.copy_items, self.mcopy) wxgui_api.bind_to_menu(self.paste_items_as_siblings, self.mpaste) wxgui_api.bind_to_menu(self.paste_items_as_children, self.mpastesub) wxgui_api.bind_to_reset_menu_items(self._handle_reset_menu_items) wxgui_api.bind_to_menu_database_update(self._handle_enable_tree_menus)
def __init__(self): wx.Menu.__init__(self) self.ID_NEW_SEARCH = wx.NewId() self.ID_REFRESH_SEARCH = wx.NewId() self.ID_FIND = wx.NewId() self.ID_EDIT = wx.NewId() config = coreaux_api.get_plugin_configuration('wxdbsearch')( 'GlobalShortcuts') self.search = wx.MenuItem( self, self.ID_NEW_SEARCH, "&New search...\t{}".format(config['new_search']), "Open a new text search in the databases") self.refresh = wx.MenuItem( self, self.ID_REFRESH_SEARCH, "&Start search\t{}".format(config['start_search']), "Start the selected search") self.find = wx.MenuItem( self, self.ID_FIND, "&Find in database\t{}".format(config['find_item']), "Select the database items associated to the selected results") self.edit = wx.MenuItem( self, self.ID_EDIT, "&Edit selected\t{}".format(config['edit_item']), "Open in the editor the database items associated " "to the selected results") self.search.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.refresh.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.find.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.edit.SetBitmap(wxgui_api.get_menu_icon('@edit')) self.AppendItem(self.search) self.AppendItem(self.refresh) self.AppendSeparator() self.AppendItem(self.find) self.AppendItem(self.edit) wxgui_api.bind_to_menu(self.new_search, self.search) wxgui_api.bind_to_menu(self.refresh_search, self.refresh) wxgui_api.bind_to_menu(self.find_in_tree, self.find) wxgui_api.bind_to_menu(self.edit_items, self.edit) wxgui_api.bind_to_update_menu_items(self.update_items) wxgui_api.bind_to_reset_menu_items(self.reset_items) wxgui_api.insert_menu_main_item('&Search', wxgui_api.get_menu_view_position(), self)
def __init__(self, tasklist): wx.Menu.__init__(self) self.tasklist = tasklist self.exporter = export.Exporter(tasklist.list_) self.ID_JSON = wx.NewId() self.ID_TSV = wx.NewId() self.ID_XML = wx.NewId() self.json = wx.MenuItem(self, self.ID_JSON, "&JSON...", "Export to JSON format") self.tsv = wx.MenuItem(self, self.ID_TSV, "&TSV...", "Export to tab-separated values format") self.xml = wx.MenuItem(self, self.ID_XML, "&XML...", "Export to XML format") self.json.SetBitmap(wxgui_api.get_menu_icon('@file')) self.tsv.SetBitmap(wxgui_api.get_menu_icon('@file')) self.xml.SetBitmap(wxgui_api.get_menu_icon('@file')) self.AppendItem(self.json) self.AppendItem(self.tsv) self.AppendItem(self.xml) wxgui_api.bind_to_menu(self._export_to_json, self.json) wxgui_api.bind_to_menu(self._export_to_tsv, self.tsv) wxgui_api.bind_to_menu(self._export_to_xml, self.xml)
def __init__(self, tasklist): wx.Menu.__init__(self) self.tasklist = tasklist self.occview = tasklist.list_ self.ID_IN_RANGE = wx.NewId() self.ID_AUTO = wx.NewId() self.ID_ALL = wx.NewId() self.inrange = wx.MenuItem(self, self.ID_IN_RANGE, "Show in &range", "Show only the active alarms in the filtered range", kind=wx.ITEM_RADIO) self.auto = wx.MenuItem(self, self.ID_AUTO, "Show &smartly", "Show all the active alarms only if current time is shown", kind=wx.ITEM_RADIO) self.all = wx.MenuItem(self, self.ID_ALL, "Show &all", "Always show all the active alarms", kind=wx.ITEM_RADIO) self.modes_to_items = { 'in_range': self.inrange, 'auto': self.auto, 'all': self.all, } self.AppendItem(self.inrange) self.AppendItem(self.auto) self.AppendItem(self.all) wxgui_api.bind_to_menu(self._set_in_range, self.inrange) wxgui_api.bind_to_menu(self._set_auto, self.auto) wxgui_api.bind_to_menu(self._set_all, self.all)
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): wx.Menu.__init__(self) # Initialize self.ID_PRINT so it can be destroyed at the beginning of # self.reset_print_menu self.ID_PRINT = wx.NewId() self.ID_PRINT_ALL = wx.NewId() self.ID_PRINT_MEMORY = wx.NewId() self.ID_PRINT_MEMORY_ALL = wx.NewId() self.PrependItem(wx.MenuItem(self, self.ID_PRINT, "INIT")) self.inspection = self.Append(wx.NewId(), "&Inspection tool") self.populate = self.Append(wx.NewId(), "&Populate database") self.simulator = self.AppendCheckItem(wx.NewId(), "&Run simulator") wxgui_api.insert_menu_main_item('Develo&pment', wxgui_api.get_menu_help_position(), self) wxgui_api.bind_to_menu(self.show_inspection_tool, self.inspection) wxgui_api.bind_to_menu(self.populate_tree, self.populate) wxgui_api.bind_to_menu(self.toggle_simulator, self.simulator) wxgui_api.bind_to_update_menu_items(self.update_items)
def __init__(self, plugin): self.plugin = plugin self.ID_ALARMS = wx.NewId() self.ID_SELECT = wx.NewId() self.ID_FIND = wx.NewId() submenu = wx.Menu() config = coreaux_api.get_plugin_configuration('wxalarmslog')( 'GlobalShortcuts') self.alarms = wx.MenuItem(wxgui_api.get_menu_logs(), self.ID_ALARMS, '&Alarms', 'Alarms log commands', subMenu=submenu) self.select = wx.MenuItem(submenu, self.ID_SELECT, "&Select\t{}".format(config['select']), "Select the alarms history log") self.find = wx.MenuItem( submenu, self.ID_FIND, "Find in &database\t{}".format(config['find']), "Select the database items associated to the selected entries") self.alarms.SetBitmap(wxgui_api.get_menu_icon('@alarmslog')) self.select.SetBitmap(wxgui_api.get_menu_icon('@jump')) self.find.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) wxgui_api.add_menu_logs_item(self.alarms) submenu.AppendItem(self.select) submenu.AppendItem(self.find) wxgui_api.bind_to_menu(self._select, self.select) wxgui_api.bind_to_menu(self._find_in_tree, self.find) wxgui_api.bind_to_menu_view_logs_update(self._update_items) wxgui_api.bind_to_menu_view_logs_disable(self._disable_items) wxgui_api.bind_to_reset_menu_items(self._reset_items)
def __init__(self): wx.Menu.__init__(self) self.ID_NEW_SEARCH = wx.NewId() self.ID_REFRESH_SEARCH = wx.NewId() self.ID_FIND = wx.NewId() self.ID_EDIT = wx.NewId() config = coreaux_api.get_plugin_configuration('wxdbsearch')( 'GlobalShortcuts') self.search = wx.MenuItem(self, self.ID_NEW_SEARCH, "&New search...\t{}".format(config['new_search']), "Open a new text search in the databases") self.refresh = wx.MenuItem(self, self.ID_REFRESH_SEARCH, "&Start search\t{}".format(config['start_search']), "Start the selected search") self.find = wx.MenuItem(self, self.ID_FIND, "&Find in database\t{}".format(config['find_item']), "Select the database items associated to the selected results") self.edit = wx.MenuItem(self, self.ID_EDIT, "&Edit selected\t{}".format(config['edit_item']), "Open in the editor the database items associated " "to the selected results") self.search.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.refresh.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.find.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.edit.SetBitmap(wxgui_api.get_menu_icon('@edit')) self.AppendItem(self.search) self.AppendItem(self.refresh) self.AppendSeparator() self.AppendItem(self.find) self.AppendItem(self.edit) wxgui_api.bind_to_menu(self.new_search, self.search) wxgui_api.bind_to_menu(self.refresh_search, self.refresh) wxgui_api.bind_to_menu(self.find_in_tree, self.find) wxgui_api.bind_to_menu(self.edit_items, self.edit) wxgui_api.bind_to_update_menu_items(self.update_items) wxgui_api.bind_to_reset_menu_items(self.reset_items) wxgui_api.insert_menu_main_item('&Search', wxgui_api.get_menu_view_position(), self)
def reset_print_menu(self): self.DestroyId(self.ID_PRINT) self.printtb = wx.Menu() self.PrependMenu(self.ID_PRINT, "Print &databases", self.printtb) self.all_ = self.printtb.Append(self.ID_PRINT_ALL, 'All databases') wxgui_api.bind_to_menu(self.print_all_databases, self.all_) self.printtb.AppendSeparator() self.databases = {} for filename in core_api.get_open_databases(): # Note that these IDs will grow progressively every time this menu # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!! # (Then, crash...) TEMP_ID_MENU = wx.NewId() TEMP_ID_ALL = wx.NewId() self.databases[filename] = { 'menu': wx.Menu(), 'all_': None, 'tables': {} } self.printtb.AppendMenu(TEMP_ID_MENU, _os.path.basename(filename), self.databases[filename]['menu']) self.databases[filename]['all_'] = self.databases[filename][ 'menu'].Append(TEMP_ID_ALL, 'All tables') wxgui_api.bind_to_menu(self.print_all_tables_loop(filename), self.databases[filename]['all_']) self.databases[filename]['menu'].AppendSeparator() for table in core_api.select_all_table_names(filename): # Note that these IDs will grow progressively every time this # menu is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!! # (Then, crash...) TEMP_ID = wx.NewId() self.databases[filename]['tables'][table[0]] = \ self.databases[filename]['menu'].Append( TEMP_ID, table[0]) wxgui_api.bind_to_menu(self.print_table_loop(filename, table[0]), self.databases[filename]['tables'][table[0]]) if self.databases: self.printtb.AppendSeparator() self.memory = { 'menu': wx.Menu(), 'all_': None, 'tables': {} } self.printtb.AppendMenu(self.ID_PRINT_MEMORY, ':memory:', self.memory['menu']) self.memory['all_'] = self.memory['menu'].Append( self.ID_PRINT_MEMORY_ALL, 'All tables') wxgui_api.bind_to_menu(self.print_all_memory_tables, self.memory['all_']) self.memory['menu'].AppendSeparator() for table in core_api.select_all_memory_table_names(): # Note that these IDs will grow progressively every time this menu # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!! # (Then, crash...) TEMP_ID = wx.NewId() self.memory['tables'][table[0]] = self.memory['menu'].Append( TEMP_ID, table[0]) wxgui_api.bind_to_menu(self.print_memory_table_loop(table[0]), self.memory['tables'][table[0]])
def reset_print_menu(self): self.DestroyId(self.ID_PRINT) self.printtb = wx.Menu() self.PrependMenu(self.ID_PRINT, "Print &databases", self.printtb) self.all_ = self.printtb.Append(self.ID_PRINT_ALL, 'All databases') wxgui_api.bind_to_menu(self.print_all_databases, self.all_) self.printtb.AppendSeparator() self.databases = {} for filename in core_api.get_open_databases(): # Note that these IDs will grow progressively every time this menu # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!! # (Then, crash...) TEMP_ID_MENU = wx.NewId() TEMP_ID_ALL = wx.NewId() self.databases[filename] = { 'menu': wx.Menu(), 'all_': None, 'tables': {} } self.printtb.AppendMenu(TEMP_ID_MENU, _os.path.basename(filename), self.databases[filename]['menu']) self.databases[filename]['all_'] = self.databases[filename][ 'menu'].Append(TEMP_ID_ALL, 'All tables') wxgui_api.bind_to_menu(self.print_all_tables_loop(filename), self.databases[filename]['all_']) self.databases[filename]['menu'].AppendSeparator() for table in core_api.select_all_table_names(filename): # Note that these IDs will grow progressively every time this # menu is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!! # (Then, crash...) TEMP_ID = wx.NewId() self.databases[filename]['tables'][table[0]] = \ self.databases[filename]['menu'].Append( TEMP_ID, table[0]) wxgui_api.bind_to_menu( self.print_table_loop(filename, table[0]), self.databases[filename]['tables'][table[0]]) if self.databases: self.printtb.AppendSeparator() self.memory = {'menu': wx.Menu(), 'all_': None, 'tables': {}} self.printtb.AppendMenu(self.ID_PRINT_MEMORY, ':memory:', self.memory['menu']) self.memory['all_'] = self.memory['menu'].Append( self.ID_PRINT_MEMORY_ALL, 'All tables') wxgui_api.bind_to_menu(self.print_all_memory_tables, self.memory['all_']) self.memory['menu'].AppendSeparator() for table in core_api.select_all_memory_table_names(): # Note that these IDs will grow progressively every time this menu # is reset, UNTIL THE INTERNAL ID LIMIT FOR MENU ITEMS!!! # (Then, crash...) TEMP_ID = wx.NewId() self.memory['tables'][table[0]] = self.memory['menu'].Append( TEMP_ID, table[0]) wxgui_api.bind_to_menu(self.print_memory_table_loop(table[0]), self.memory['tables'][table[0]])
def __init__(self, tasklist): wx.Menu.__init__(self) self.tasklist = tasklist self.occview = tasklist.list_ self.ID_NAVIGATOR = wx.NewId() self.ID_SCROLL = wx.NewId() self.ID_FIND = wx.NewId() self.ID_EDIT = wx.NewId() self.ID_SNOOZE = wx.NewId() self.ID_SNOOZE_ALL = wx.NewId() self.ID_SNOOZE_FOR_SEL = wx.NewId() self.ID_SNOOZE_FOR_ALL = wx.NewId() self.ID_DISMISS = wx.NewId() self.ID_DISMISS_ALL = wx.NewId() self.ID_EXPORT = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtasklist') # Using a set here to remove any duplicates would lose the order of the # times snooze_times = config['snooze_times'].split(' ') self.snoozetimesconf = [] for stime in snooze_times: ID_SNOOZE_FOR_N_SEL = wx.NewId() ID_SNOOZE_FOR_N_ALL = wx.NewId() time = int(stime) * 60 number, unit = TimeSpanCtrl.compute_widget_values(time) # Duplicate time values are not supported, just make sure they # don't crash the application self.snoozetimesconf.append(((ID_SNOOZE_FOR_N_SEL, ID_SNOOZE_FOR_N_ALL), time, number, unit)) self.navigator_submenu = NavigatorMenu(tasklist) self.snooze_selected_submenu = SnoozeSelectedConfigMenu(tasklist, self) self.snooze_all_submenu = SnoozeAllConfigMenu(tasklist, self) self.export_submenu = ExportMenu(tasklist) shconf = config("GlobalShortcuts") self.navigator = wx.MenuItem(self, self.ID_NAVIGATOR, 'Na&vigator', 'Navigator actions', subMenu=self.navigator_submenu) self.scroll = wx.MenuItem(self, self.ID_SCROLL, "Scro&ll to ongoing\t{}".format(shconf['scroll_to_ongoing']), "Order the list by State and scroll " "to the first ongoing event") self.find = wx.MenuItem(self, self.ID_FIND, "&Find in database\t{}".format(shconf('Items')['find_selected']), "Select the database items associated to the selected events") self.edit = wx.MenuItem(self, self.ID_EDIT, "&Edit selected\t{}".format(shconf('Items')['edit_selected']), "Open in the editor the database items associated " "to the selected events") self.snooze = wx.MenuItem(self, self.ID_SNOOZE, "&Snooze selected", "Snooze the selected alarms", subMenu=self.snooze_selected_submenu) self.snooze_all = wx.MenuItem(self, self.ID_SNOOZE_ALL, "S&nooze all", "Snooze all the active alarms", subMenu=self.snooze_all_submenu) self.dismiss = wx.MenuItem(self, self.ID_DISMISS, "&Dismiss selected\t{}".format( shconf('Items')['dismiss_selected']), "Dismiss the selected alarms") self.dismiss_all = wx.MenuItem(self, self.ID_DISMISS_ALL, "Dis&miss all\t{}".format(shconf('Items')['dismiss_all']), "Dismiss all the active alarms") self.export = wx.MenuItem(self, self.ID_EXPORT, 'E&xport view', 'Export the current view to a file', subMenu=self.export_submenu) self.navigator.SetBitmap(wxgui_api.get_menu_icon('@navigator')) self.scroll.SetBitmap(wxgui_api.get_menu_icon('@scroll')) self.find.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.edit.SetBitmap(wxgui_api.get_menu_icon('@edit')) self.snooze.SetBitmap(wxgui_api.get_menu_icon('@snooze')) self.snooze_all.SetBitmap(wxgui_api.get_menu_icon('@snooze')) self.dismiss.SetBitmap(wxgui_api.get_menu_icon('@dismiss')) self.dismiss_all.SetBitmap(wxgui_api.get_menu_icon('@dismiss')) self.export.SetBitmap(wxgui_api.get_menu_icon('@saveas')) self.AppendItem(self.navigator) self.AppendItem(self.scroll) self.AppendSeparator() self.AppendItem(self.find) self.AppendItem(self.edit) self.AppendSeparator() self.AppendItem(self.snooze) self.AppendItem(self.snooze_all) self.AppendItem(self.dismiss) self.AppendItem(self.dismiss_all) self.AppendSeparator() self.AppendItem(self.export) wxgui_api.bind_to_menu(self._scroll_to_ongoing, self.scroll) wxgui_api.bind_to_menu(self._find_in_tree, self.find) wxgui_api.bind_to_menu(self._edit_items, self.edit) wxgui_api.bind_to_menu(self._dismiss_selected_alarms, self.dismiss) wxgui_api.bind_to_menu(self._dismiss_all_alarms, self.dismiss_all) wxgui_api.bind_to_update_menu_items(self._update_items) wxgui_api.bind_to_reset_menu_items(self._reset_items) wxgui_api.insert_menu_main_item('S&chedule', wxgui_api.get_menu_view_position(), self)
def __init__(self, tasklist): self.tasklist = tasklist self.occview = tasklist.list_ self.ID_EVENTS = wx.NewId() self.ID_SHOW = wx.NewId() self.ID_FOCUS = wx.NewId() self.ID_ALARMS = wx.NewId() self.ID_TOGGLE_NAVIGATOR = wx.NewId() self.ID_GAPS = wx.NewId() self.ID_OVERLAPS = wx.NewId() self.ID_AUTOSCROLL = wx.NewId() submenu = wx.Menu() self.alarms_submenu = AlarmsMenu(tasklist) config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('View') self.events = wx.MenuItem(wxgui_api.get_menu_view(), self.ID_EVENTS, '&Schedule', 'Schedule navigation actions', subMenu=submenu) self.show = wx.MenuItem(submenu, self.ID_SHOW, "Show &panel\t{}".format(config['show']), "Show the schedule panel", kind=wx.ITEM_CHECK) self.focus = wx.MenuItem(submenu, self.ID_FOCUS, "&Focus\t{}".format(config['focus']), "Set focus on the schedule tab") self.alarms = wx.MenuItem(submenu, self.ID_ALARMS, '&Active alarms', 'Set the visibility of active alarms', subMenu=self.alarms_submenu) self.navigator = wx.MenuItem(submenu, self.ID_TOGGLE_NAVIGATOR, "Show &navigator\t{}".format(config['show_navigator']), "Show or hide the navigator bar", kind=wx.ITEM_CHECK) self.gaps = wx.MenuItem(submenu, self.ID_GAPS, "Show &gaps\t{}".format(config['toggle_gaps']), "Show any unallocated time in the shown interval", kind=wx.ITEM_CHECK) self.overlaps = wx.MenuItem(submenu, self.ID_OVERLAPS, "Show &overlappings\t{}".format(config['toggle_overlappings']), "Show time intervals used by more than one event", kind=wx.ITEM_CHECK) self.autoscroll = wx.MenuItem(submenu, self.ID_AUTOSCROLL, "Enable a&uto-scroll", "Auto-scroll to the first ongoing " "event when refreshing", kind=wx.ITEM_CHECK) self.events.SetBitmap(wxgui_api.get_menu_icon('@tasklist')) self.focus.SetBitmap(wxgui_api.get_menu_icon('@jump')) self.alarms.SetBitmap(wxgui_api.get_menu_icon('@activealarms')) wxgui_api.insert_menu_right_tab_group(self.events) submenu.AppendItem(self.show) submenu.AppendItem(self.focus) submenu.AppendSeparator() submenu.AppendItem(self.alarms) submenu.AppendItem(self.navigator) submenu.AppendItem(self.gaps) submenu.AppendItem(self.overlaps) submenu.AppendItem(self.autoscroll) wxgui_api.bind_to_menu(self.tasklist.toggle_shown, self.show) wxgui_api.bind_to_menu(self._focus, self.focus) wxgui_api.bind_to_menu(self._toggle_navigator, self.navigator) wxgui_api.bind_to_menu(self._show_gaps, self.gaps) wxgui_api.bind_to_menu(self._show_overlappings, self.overlaps) wxgui_api.bind_to_menu(self._enable_autoscroll, self.autoscroll) wxgui_api.bind_to_reset_menu_items(self._reset_items) wxgui_api.bind_to_menu_view_update(self._update_items)
def __init__(self, tasklist): wx.Menu.__init__(self) self.tasklist = tasklist self.occview = tasklist.list_ self.ID_NAVIGATOR = wx.NewId() self.ID_SCROLL = wx.NewId() self.ID_FIND = wx.NewId() self.ID_EDIT = wx.NewId() self.ID_SNOOZE = wx.NewId() self.ID_SNOOZE_ALL = wx.NewId() self.ID_SNOOZE_FOR_SEL = wx.NewId() self.ID_SNOOZE_FOR_ALL = wx.NewId() self.ID_DISMISS = wx.NewId() self.ID_DISMISS_ALL = wx.NewId() self.ID_EXPORT = wx.NewId() config = coreaux_api.get_plugin_configuration('wxtasklist') # Using a set here to remove any duplicates would lose the order of the # times snooze_times = config['snooze_times'].split(' ') self.snoozetimesconf = [] for stime in snooze_times: ID_SNOOZE_FOR_N_SEL = wx.NewId() ID_SNOOZE_FOR_N_ALL = wx.NewId() time = int(stime) * 60 number, unit = TimeSpanCtrl.compute_widget_values(time) # Duplicate time values are not supported, just make sure they # don't crash the application self.snoozetimesconf.append( ((ID_SNOOZE_FOR_N_SEL, ID_SNOOZE_FOR_N_ALL), time, number, unit)) self.navigator_submenu = NavigatorMenu(tasklist) self.snooze_selected_submenu = SnoozeSelectedConfigMenu(tasklist, self) self.snooze_all_submenu = SnoozeAllConfigMenu(tasklist, self) self.export_submenu = ExportMenu(tasklist) shconf = config("GlobalShortcuts") self.navigator = wx.MenuItem(self, self.ID_NAVIGATOR, 'Na&vigator', 'Navigator actions', subMenu=self.navigator_submenu) self.scroll = wx.MenuItem( self, self.ID_SCROLL, "Scro&ll to ongoing\t{}".format(shconf['scroll_to_ongoing']), "Order the list by State and scroll " "to the first ongoing event") self.find = wx.MenuItem( self, self.ID_FIND, "&Find in database\t{}".format(shconf('Items')['find_selected']), "Select the database items associated to the selected events") self.edit = wx.MenuItem( self, self.ID_EDIT, "&Edit selected\t{}".format(shconf('Items')['edit_selected']), "Open in the editor the database items associated " "to the selected events") self.snooze = wx.MenuItem(self, self.ID_SNOOZE, "&Snooze selected", "Snooze the selected alarms", subMenu=self.snooze_selected_submenu) self.snooze_all = wx.MenuItem(self, self.ID_SNOOZE_ALL, "S&nooze all", "Snooze all the active alarms", subMenu=self.snooze_all_submenu) self.dismiss = wx.MenuItem( self, self.ID_DISMISS, "&Dismiss selected\t{}".format( shconf('Items')['dismiss_selected']), "Dismiss the selected alarms") self.dismiss_all = wx.MenuItem( self, self.ID_DISMISS_ALL, "Dis&miss all\t{}".format(shconf('Items')['dismiss_all']), "Dismiss all the active alarms") self.export = wx.MenuItem(self, self.ID_EXPORT, 'E&xport view', 'Export the current view to a file', subMenu=self.export_submenu) self.navigator.SetBitmap(wxgui_api.get_menu_icon('@navigator')) self.scroll.SetBitmap(wxgui_api.get_menu_icon('@scroll')) self.find.SetBitmap(wxgui_api.get_menu_icon('@dbfind')) self.edit.SetBitmap(wxgui_api.get_menu_icon('@edit')) self.snooze.SetBitmap(wxgui_api.get_menu_icon('@snooze')) self.snooze_all.SetBitmap(wxgui_api.get_menu_icon('@snooze')) self.dismiss.SetBitmap(wxgui_api.get_menu_icon('@dismiss')) self.dismiss_all.SetBitmap(wxgui_api.get_menu_icon('@dismiss')) self.export.SetBitmap(wxgui_api.get_menu_icon('@saveas')) self.AppendItem(self.navigator) self.AppendItem(self.scroll) self.AppendSeparator() self.AppendItem(self.find) self.AppendItem(self.edit) self.AppendSeparator() self.AppendItem(self.snooze) self.AppendItem(self.snooze_all) self.AppendItem(self.dismiss) self.AppendItem(self.dismiss_all) self.AppendSeparator() self.AppendItem(self.export) wxgui_api.bind_to_menu(self._scroll_to_ongoing, self.scroll) wxgui_api.bind_to_menu(self._find_in_tree, self.find) wxgui_api.bind_to_menu(self._edit_items, self.edit) wxgui_api.bind_to_menu(self._dismiss_selected_alarms, self.dismiss) wxgui_api.bind_to_menu(self._dismiss_all_alarms, self.dismiss_all) wxgui_api.bind_to_update_menu_items(self._update_items) wxgui_api.bind_to_reset_menu_items(self._reset_items) wxgui_api.insert_menu_main_item('S&chedule', wxgui_api.get_menu_view_position(), self)
def __init__(self, tasklist): self.tasklist = tasklist self.occview = tasklist.list_ self.ID_EVENTS = wx.NewId() self.ID_SHOW = wx.NewId() self.ID_FOCUS = wx.NewId() self.ID_ALARMS = wx.NewId() self.ID_TOGGLE_NAVIGATOR = wx.NewId() self.ID_GAPS = wx.NewId() self.ID_OVERLAPS = wx.NewId() self.ID_AUTOSCROLL = wx.NewId() submenu = wx.Menu() self.alarms_submenu = AlarmsMenu(tasklist) config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('View') self.events = wx.MenuItem(wxgui_api.get_menu_view(), self.ID_EVENTS, '&Schedule', 'Schedule navigation actions', subMenu=submenu) self.show = wx.MenuItem(submenu, self.ID_SHOW, "Show &panel\t{}".format(config['show']), "Show the schedule panel", kind=wx.ITEM_CHECK) self.focus = wx.MenuItem(submenu, self.ID_FOCUS, "&Focus\t{}".format(config['focus']), "Set focus on the schedule tab") self.alarms = wx.MenuItem(submenu, self.ID_ALARMS, '&Active alarms', 'Set the visibility of active alarms', subMenu=self.alarms_submenu) self.navigator = wx.MenuItem(submenu, self.ID_TOGGLE_NAVIGATOR, "Show &navigator\t{}".format( config['show_navigator']), "Show or hide the navigator bar", kind=wx.ITEM_CHECK) self.gaps = wx.MenuItem( submenu, self.ID_GAPS, "Show &gaps\t{}".format(config['toggle_gaps']), "Show any unallocated time in the shown interval", kind=wx.ITEM_CHECK) self.overlaps = wx.MenuItem( submenu, self.ID_OVERLAPS, "Show &overlappings\t{}".format(config['toggle_overlappings']), "Show time intervals used by more than one event", kind=wx.ITEM_CHECK) self.autoscroll = wx.MenuItem(submenu, self.ID_AUTOSCROLL, "Enable a&uto-scroll", "Auto-scroll to the first ongoing " "event when refreshing", kind=wx.ITEM_CHECK) self.events.SetBitmap(wxgui_api.get_menu_icon('@tasklist')) self.focus.SetBitmap(wxgui_api.get_menu_icon('@jump')) self.alarms.SetBitmap(wxgui_api.get_menu_icon('@activealarms')) wxgui_api.insert_menu_right_tab_group(self.events) submenu.AppendItem(self.show) submenu.AppendItem(self.focus) submenu.AppendSeparator() submenu.AppendItem(self.alarms) submenu.AppendItem(self.navigator) submenu.AppendItem(self.gaps) submenu.AppendItem(self.overlaps) submenu.AppendItem(self.autoscroll) wxgui_api.bind_to_menu(self.tasklist.toggle_shown, self.show) wxgui_api.bind_to_menu(self._focus, self.focus) wxgui_api.bind_to_menu(self._toggle_navigator, self.navigator) wxgui_api.bind_to_menu(self._show_gaps, self.gaps) wxgui_api.bind_to_menu(self._show_overlappings, self.overlaps) wxgui_api.bind_to_menu(self._enable_autoscroll, self.autoscroll) wxgui_api.bind_to_reset_menu_items(self._reset_items) wxgui_api.bind_to_menu_view_update(self._update_items)
def __init__(self, parent): wxgui_api.install_icon_bundle("wxalarms", '&alarmswin', (("alarmswin16.png", ), ("alarmswin24.png", ), ("alarmswin32.png", ), ("alarmswin48.png", ), ("alarmswin64.png", ), ("alarmswin128.png", ))) self.ALARMS_MIN_HEIGHT = 140 self.ALARMS_ICON_BUNDLE = wxgui_api.get_frame_icon_bundle('&alarmswin') self.config = coreaux_api.get_plugin_configuration('wxalarms') self.window = wx.Frame(parent, size=[int(s) for s in self.config['initial_geometry'].split('x')]) self.window.SetIcons(self.ALARMS_ICON_BUNDLE) self.alarms = {} self._update_title() self.box = wx.BoxSizer(wx.VERTICAL) self.window.SetSizer(self.box) self.panel = wx.ScrolledWindow(self.window, style=wx.BORDER_THEME) self.panel.SetScrollRate(20, 20) self.pbox = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(self.pbox) self.box.Add(self.panel, proportion=1, flag=wx.EXPAND | wx.ALL, border=4) self.hidden_panel = wx.BoxSizer(wx.HORIZONTAL) self._init_hidden_panel() self.box.Add(self.hidden_panel, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=4) self._hide_hidden_panel() self.bottom = wx.BoxSizer(wx.HORIZONTAL) self._init_bottom() self.box.Add(self.bottom, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=4) # Set the minimum width so that the bottom controls can fit, and also # add 20 px for the stretch spacer minwidth = self.bottom.ComputeFittingWindowSize(self.window).GetWidth() self.window.SetMinSize((minwidth + 20, self.ALARMS_MIN_HEIGHT)) self.DELAY = 50 # Set CDELAY shorter than DELAY, so that if an alarm is activated at # the same time an alarm is dismissed, there's a better chance that # the alarm window requests the user attention self.CDELAY = 30 # Initialize self.timer and self.stimer with a dummy function (int) self.timer = wx.CallLater(1, int) self.stimer = wx.CallLater(1, int) self.LIMIT = self.config.get_int('limit') self.hiddenalarms = set() self.ID_SHOW_MENU = wx.NewId() self.menushow = wx.MenuItem(wxgui_api.get_menu_view(), self.ID_SHOW_MENU, "Show &alarms window\t{}".format( self.config('GlobalShortcuts')['show']), "Show the alarms window", kind=wx.ITEM_CHECK) wxgui_api.add_menu_view_item(self.menushow) TrayMenu(self) self.window.Bind(wx.EVT_CLOSE, self._handle_close) wxgui_api.bind_to_menu(self.toggle_shown, self.menushow) wxgui_api.bind_to_menu_view_update(self._handle_menu_view_update) organism_alarms_api.bind_to_alarm(self._handle_alarm) organism_alarms_api.bind_to_alarm_off(self._handle_alarm_off) wxgui_api.bind_to_close_database(self._handle_close_db)
def __init__(self, parent): wxgui_api.install_icon_bundle( "wxalarms", "&alarmswin", ( ("alarmswin16.png",), ("alarmswin24.png",), ("alarmswin32.png",), ("alarmswin48.png",), ("alarmswin64.png",), ("alarmswin128.png",), ), ) self.ALARMS_MIN_HEIGHT = 140 self.ALARMS_ICON_BUNDLE = wxgui_api.get_frame_icon_bundle("&alarmswin") self.config = coreaux_api.get_plugin_configuration("wxalarms") self.window = wx.Frame(parent, size=[int(s) for s in self.config["initial_geometry"].split("x")]) self.window.SetIcons(self.ALARMS_ICON_BUNDLE) self.alarms = {} self._update_title() self.box = wx.BoxSizer(wx.VERTICAL) self.window.SetSizer(self.box) self.panel = wx.ScrolledWindow(self.window, style=wx.BORDER_THEME) self.panel.SetScrollRate(20, 20) self.pbox = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(self.pbox) self.box.Add(self.panel, proportion=1, flag=wx.EXPAND | wx.ALL, border=4) self.hidden_panel = wx.BoxSizer(wx.HORIZONTAL) self._init_hidden_panel() self.box.Add(self.hidden_panel, flag=wx.LEFT | wx.RIGHT | wx.BOTTOM | wx.EXPAND, border=4) self._hide_hidden_panel() self.bottom = wx.BoxSizer(wx.HORIZONTAL) self._init_bottom() self.box.Add(self.bottom, flag=wx.LEFT | wx.RIGHT | wx.EXPAND, border=4) # Set the minimum width so that the bottom controls can fit, and also # add 20 px for the stretch spacer minwidth = self.bottom.ComputeFittingWindowSize(self.window).GetWidth() self.window.SetMinSize((minwidth + 20, self.ALARMS_MIN_HEIGHT)) self.DELAY = 50 # Set CDELAY shorter than DELAY, so that if an alarm is activated at # the same time an alarm is dismissed, there's a better chance that # the alarm window requests the user attention self.CDELAY = 30 # Initialize self.timer and self.stimer with a dummy function (int) self.timer = wx.CallLater(1, int) self.stimer = wx.CallLater(1, int) self.LIMIT = self.config.get_int("limit") self.hiddenalarms = set() self.ID_SHOW_MENU = wx.NewId() self.menushow = wx.MenuItem( wxgui_api.get_menu_view(), self.ID_SHOW_MENU, "Show &alarms window\t{}".format(self.config("GlobalShortcuts")["show"]), "Show the alarms window", kind=wx.ITEM_CHECK, ) wxgui_api.add_menu_view_item(self.menushow) TrayMenu(self) self.window.Bind(wx.EVT_CLOSE, self._handle_close) wxgui_api.bind_to_menu(self.toggle_shown, self.menushow) wxgui_api.bind_to_menu_view_update(self._handle_menu_view_update) organism_alarms_api.bind_to_alarm(self._handle_alarm) organism_alarms_api.bind_to_alarm_off(self._handle_alarm_off) wxgui_api.bind_to_close_database(self._handle_close_db)