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, filename): self.filename = filename config = coreaux_api.get_plugin_configuration('wxscheduler')( 'TreeIcons') char = config['symbol'] if char != '': bits_to_colour = {1: wx.Colour()} bits_to_colour[1].SetFromString(config['color']) self.property_shift, self.property_mask = \ wxgui_api.add_item_property( filename, 1, char, bits_to_colour) organism_api.bind_to_update_item_rules_conditional( self._handle_update_rules) organism_api.bind_to_history_insert(self._handle_history) organism_api.bind_to_history_update(self._handle_history) wxgui_api.bind_to_open_database(self._handle_open_database) wxgui_api.bind_to_close_database(self._handle_close_database) if wxcopypaste_api: wxcopypaste_api.bind_to_items_pasted(self._handle_paste)
def __init__(self, filename): self.filename = filename config = coreaux_api.get_plugin_configuration('wxlinks')('TreeIcons') char = config['symbol'] if char != '': bits_to_colour = {b: wx.Colour() for b in xrange(1, 6)} bits_to_colour[1].SetFromString(config['color_valid']) bits_to_colour[2].SetFromString(config['color_broken']) bits_to_colour[3].SetFromString(config['color_target']) bits_to_colour[4].SetFromString(config['color_valid_and_target']) bits_to_colour[5].SetFromString(config['color_broken_and_target']) self.property_shift, self.property_mask = \ wxgui_api.add_item_property( filename, 3, char, bits_to_colour) links_api.bind_to_upsert_link(self._handle_upsert_link) links_api.bind_to_delete_link(self._handle_delete_link) links_api.bind_to_break_link(self._handle_break_links) links_api.bind_to_history_insert(self._handle_history) links_api.bind_to_history_update(self._handle_history) links_api.bind_to_history_delete(self._handle_history) wxgui_api.bind_to_open_database(self._handle_open_database) wxgui_api.bind_to_close_database(self._handle_close_database) if wxcopypaste_api: wxcopypaste_api.bind_to_items_pasted(self._handle_paste)
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, 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 post_init(self): self.panel = wx.Panel(self.fpanel) box = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(box) self.rule_list = RuleList(self, self.filename, self.id_) self.rule_editor = RuleEditor(self, self.filename, self.id_) self.rule_list.post_init() self.rule_editor.post_init() box.Add(self.rule_list.panel, flag=wx.EXPAND | wx.BOTTOM, border=4) box.Add(self.rule_editor.panel, flag=wx.EXPAND | wx.BOTTOM, border=4) config = coreaux_api.get_plugin_configuration('wxscheduler')( 'ContextualShortcuts') accelerators = { config["focus"]: lambda event: self.set_focus(), config["toggle"]: lambda event: self.toggle_focus(), } wxgui_api.add_window_to_plugin(self.filename, self.id_, self.fpanel, self.panel, accelerators) self.resize() # Must be done *after* resizing if not self.rule_list.rules: wxgui_api.collapse_panel(self.filename, self.id_, self.fpanel)
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, filename): self.filename = filename config = coreaux_api.get_plugin_configuration('wxlinks')('TreeIcons') char = config['symbol'] if char != '': bits_to_colour = {b: wx.Colour() for b in xrange(1, 6)} bits_to_colour[1].SetFromString(config['color_valid']) bits_to_colour[2].SetFromString(config['color_broken']) bits_to_colour[3].SetFromString(config['color_target']) bits_to_colour[4].SetFromString(config['color_valid_and_target']) bits_to_colour[5].SetFromString(config['color_broken_and_target']) self.property_shift, self.property_mask = \ wxgui_api.add_item_property( filename, 3, char, bits_to_colour) links_api.bind_to_upsert_link(self._handle_upsert_link) links_api.bind_to_delete_link(self._handle_delete_link) links_api.bind_to_break_link(self._handle_break_links) links_api.bind_to_history_insert(self._handle_history) links_api.bind_to_history_update(self._handle_history) links_api.bind_to_history_delete(self._handle_history) wxgui_api.bind_to_open_database(self._handle_open_database) wxgui_api.bind_to_close_database(self._handle_close_database) if wxcopypaste_api: wxcopypaste_api.bind_to_items_pasted(self._handle_paste)
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, parent): config = coreaux_api.get_plugin_configuration('wxdbsearch')( 'ContextualShortcuts') accelerators = { config["search"]: lambda event: self.search(), config["find"]: lambda event: self.results.find_in_tree(), config["edit"]: lambda event: self.results.edit_items(), } accelerators.update(wxgui_api.get_right_nb_generic_accelerators()) acctable = wxgui_api.generate_right_nb_accelerators(accelerators) self.panel = SearchViewPanel(parent, self, acctable) self.box = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(self.box) self.filters = SearchFilters(self) self.results = SearchResults(self) self.panel._init_tab_menu() self.threads = 0 self.search_threaded_action = self._search_threaded_stop self.finish_search_action = self._finish_search_dummy self.box.Add(self.filters.box, flag=wx.EXPAND | wx.BOTTOM, border=4) self.box.Add(self.results.listview, 1, flag=wx.EXPAND) wxgui_api.bind_to_close_database(self._handle_close_database)
def __init__(self, filename): self.filename = filename config = coreaux_api.get_plugin_configuration('wxscheduler')( 'TreeIcons') char = config['symbol'] if char != '': bits_to_colour = {1: wx.Colour()} bits_to_colour[1].SetFromString(config['color']) self.property_shift, self.property_mask = \ wxgui_api.add_item_property( filename, 1, char, bits_to_colour) organism_api.bind_to_update_item_rules_conditional( self._handle_update_rules) organism_api.bind_to_history_insert(self._handle_history) organism_api.bind_to_history_update(self._handle_history) wxgui_api.bind_to_open_database(self._handle_open_database) wxgui_api.bind_to_close_database(self._handle_close_database) if wxcopypaste_api: wxcopypaste_api.bind_to_items_pasted(self._handle_paste)
def __init__(self, parent): config = coreaux_api.get_plugin_configuration('wxdbsearch')( 'ContextualShortcuts') accelerators = { config["search"]: lambda event: self.search(), config["find"]: lambda event: self.results.find_in_tree(), config["edit"]: lambda event: self.results.edit_items(), } accelerators.update(wxgui_api.get_right_nb_generic_accelerators()) acctable = wxgui_api.generate_right_nb_accelerators(accelerators) self.panel = SearchViewPanel(parent, self, acctable) self.box = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(self.box) self.filters = SearchFilters(self) self.results = SearchResults(self) self.panel._init_tab_menu() self.threads = 0 self.search_threaded_action = self._search_threaded_stop self.finish_search_action = self._finish_search_dummy self.box.Add(self.filters.box, flag=wx.EXPAND | wx.BOTTOM, border=4) self.box.Add(self.results.listview, 1, flag=wx.EXPAND) wxgui_api.bind_to_close_database(self._handle_close_database)
def post_init(self): self.panel = wx.Panel(self.fpanel) box = wx.BoxSizer(wx.VERTICAL) self.panel.SetSizer(box) self.rule_list = RuleList(self, self.filename, self.id_) self.rule_editor = RuleEditor(self, self.filename, self.id_) self.rule_list.post_init() self.rule_editor.post_init() box.Add(self.rule_list.panel, flag=wx.EXPAND | wx.BOTTOM, border=4) box.Add(self.rule_editor.panel, flag=wx.EXPAND | wx.BOTTOM, border=4) config = coreaux_api.get_plugin_configuration('wxscheduler')( 'ContextualShortcuts') accelerators = { config["focus"]: lambda event: self.set_focus(), config["toggle"]: lambda event: self.toggle_focus(), } wxgui_api.add_window_to_plugin(self.filename, self.id_, self.fpanel, self.panel, accelerators) self.resize() # Must be done *after* resizing if not self.rule_list.rules: wxgui_api.collapse_panel(self.filename, self.id_, self.fpanel)
def __init__(self, tasklist, mainmenu, accelerator=True): _SnoozeConfigMenu.__init__(self, mainmenu, mainmenu.ID_SNOOZE_FOR_SEL, 0) self.tasklist = tasklist config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('Items') accel = "\t{}".format(config['snooze_selected']) if accelerator else "" self.snoozefor.SetText(self.snoozefor.GetText() + accel)
def __init__(self, tasklist, mainmenu, accelerator=True): _SnoozeConfigMenu.__init__(self, mainmenu, mainmenu.ID_SNOOZE_FOR_SEL, 0) self.tasklist = tasklist config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('Items') accel = "\t{}".format(config['snooze_selected']) if accelerator else "" self.snoozefor.SetText(self.snoozefor.GetText() + accel)
def __init__(self, tasklist, mainmenu, accelerator=True): # Note that "all" means all the visible active alarms; some may be # hidden in the current view _SnoozeConfigMenu.__init__(self, mainmenu, mainmenu.ID_SNOOZE_FOR_ALL, 1) self.tasklist = tasklist config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('Items') accel = "\t{}".format(config['snooze_all']) if accelerator else "" self.snoozefor.SetText(self.snoozefor.GetText() + accel)
def __init__(self, tasklist, mainmenu, accelerator=True): # Note that "all" means all the visible active alarms; some may be # hidden in the current view _SnoozeConfigMenu.__init__(self, mainmenu, mainmenu.ID_SNOOZE_FOR_ALL, 1) self.tasklist = tasklist config = coreaux_api.get_plugin_configuration('wxtasklist')( 'GlobalShortcuts')('Items') accel = "\t{}".format(config['snooze_all']) if accelerator else "" self.snoozefor.SetText(self.snoozefor.GetText() + accel)
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, filename, mainmenu): self.filename = filename config = coreaux_api.get_plugin_configuration('wxcopypaste')( 'ContextualShortcuts') wxgui_api.install_database_accelerators(filename, { config["cut"]: lambda event: self.cut_items(), config["copy"]: lambda event: self.copy_items(), config["paste_siblings"]: lambda event: self.paste_items_as_siblings(), config["paste_children"]: lambda event: self.paste_items_as_children(), }) TreeContextMenu(filename, mainmenu)
def start(): log.debug('Start simulator') DELAY = coreaux_api.get_plugin_configuration('wxdevelopment' ).get_int('simulator_delay') # Don't use a combination of threading.Timer and wx.CallAfter, both for # simplicity and because Timer.is_alive() doesn't seem to return False # immediately as the action is executed, and this way *sometimes* the # application would execute the stop function, which should be put at the # top of the restart fucntion, before actually restarting the timer (this # would be a minor bug anyway, but using wx.CallLater avoids it, so prefer # using it) global timer timer = wx.CallLater(DELAY, _do_action)
def __init__(self, parent, filename, mainmenu): self.filename = filename self.view = wx.dataview.DataViewCtrl(parent, style=wx.dataview.DV_MULTIPLE | wx.dataview.DV_ROW_LINES | wx.dataview.DV_NO_HEADER) self.data = [] self.dvmodel = AlarmsLogModel(self.data) self.view.AssociateModel(self.dvmodel) # According to DataViewModel's documentation (as of September 2014) # its reference count must be decreased explicitly to avoid memory # leaks; the wxPython demo, however, doesn't do it, and if done here, # the application crashes with a segfault when closing all databases # See also bug #104 #self.dvmodel.DecRef() # Temporary workaround for bug #279 #self.view.AppendDateColumn('Timestamp', 0, # width=wx.COL_WIDTH_AUTOSIZE, align=wx.ALIGN_CENTER_VERTICAL) self.view.AppendTextColumn('Timestamp', 0, width=wx.COL_WIDTH_AUTOSIZE) self.view.AppendTextColumn('Action', 1, width=wx.COL_WIDTH_AUTOSIZE) self.view.AppendTextColumn('Item', 2) config = coreaux_api.get_plugin_configuration('wxalarmslog')( 'ContextualShortcuts') wxgui_api.install_accelerators(self.view, { config["find"]: lambda event: self.find_in_tree(), }) self.reasons = {0: '[snoozed]', 1: '[dismissed]', 2: '[deleted]'} cmenu = ContextMenu(mainmenu, self) self.tool_id, menu_items, popup_cmenu = wxgui_api.add_log(filename, self.view, "Alarms", wxgui_api.get_log_icon('@alarmslog'), cmenu.get_items(), cmenu.update) cmenu.store_items(menu_items) self.view.Bind(wx.dataview.EVT_DATAVIEW_ITEM_CONTEXT_MENU, popup_cmenu) organism_alarms_api.bind_to_alarm_off(self._handle_alarm_off) wxgui_api.bind_to_close_database(self._handle_close_database) self._refresh()
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, parent, filename, mainmenu): self.filename = filename self.view = wx.dataview.DataViewCtrl(parent, style=wx.dataview.DV_MULTIPLE | wx.dataview.DV_ROW_LINES | wx.dataview.DV_NO_HEADER) self.data = [] self.dvmodel = AlarmsLogModel(self.data) self.view.AssociateModel(self.dvmodel) # According to DataViewModel's documentation (as of September 2014) # its reference count must be decreased explicitly to avoid memory # leaks; the wxPython demo, however, doesn't do it, and if done here, # the application crashes with a segfault when closing all databases # See also bug #104 #self.dvmodel.DecRef() # Temporary workaround for bug #279 #self.view.AppendDateColumn('Timestamp', 0, # width=wx.COL_WIDTH_AUTOSIZE, align=wx.ALIGN_CENTER_VERTICAL) self.view.AppendTextColumn('Timestamp', 0, width=wx.COL_WIDTH_AUTOSIZE) self.view.AppendTextColumn('Action', 1, width=wx.COL_WIDTH_AUTOSIZE) self.view.AppendTextColumn('Item', 2) config = coreaux_api.get_plugin_configuration('wxalarmslog')( 'ContextualShortcuts') wxgui_api.install_accelerators( self.view, { config["find"]: lambda event: self.find_in_tree(), }) self.reasons = {0: '[snoozed]', 1: '[dismissed]', 2: '[deleted]'} cmenu = ContextMenu(mainmenu, self) self.tool_id, menu_items, popup_cmenu = wxgui_api.add_log( filename, self.view, "Alarms", wxgui_api.get_log_icon('@alarmslog'), cmenu.get_items(), cmenu.update) cmenu.store_items(menu_items) self.view.Bind(wx.dataview.EVT_DATAVIEW_ITEM_CONTEXT_MENU, popup_cmenu) organism_alarms_api.bind_to_alarm_off(self._handle_alarm_off) wxgui_api.bind_to_close_database(self._handle_close_database) self._refresh()
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, filename, id_): self.filename = filename self.id_ = id_ self.fpanel = wxgui_api.add_plugin_to_editor(filename, id_, 'Manage links') self.lpanel = wx.Panel(self.fpanel) config = coreaux_api.get_plugin_configuration('wxlinks')( 'ContextualShortcuts') accelerators = { config["focus"]: lambda event: self.set_focus(), config["toggle"]: lambda event: self.toggle_focus(), } wxgui_api.add_window_to_plugin(filename, id_, self.fpanel, self.lpanel, accelerators)
def __init__(self, filename, mainmenu): self.filename = filename config = coreaux_api.get_plugin_configuration('wxcopypaste')( 'ContextualShortcuts') wxgui_api.install_database_accelerators( filename, { config["cut"]: lambda event: self.cut_items(), config["copy"]: lambda event: self.copy_items(), config["paste_siblings"]: lambda event: self.paste_items_as_siblings(), config["paste_children"]: lambda event: self.paste_items_as_children(), }) TreeContextMenu(filename, mainmenu)
def __init__(self, filename, id_): self.filename = filename self.id_ = id_ self.fpanel = wxgui_api.add_plugin_to_editor(filename, id_, 'Manage links') self.lpanel = wx.Panel(self.fpanel) config = coreaux_api.get_plugin_configuration('wxlinks')( 'ContextualShortcuts') accelerators = { config["focus"]: lambda event: self.set_focus(), config["toggle"]: lambda event: self.toggle_focus(), } wxgui_api.add_window_to_plugin(filename, id_, self.fpanel, self.lpanel, accelerators)
def open_database(): testfilesd = coreaux_api.get_plugin_configuration('wxdevelopment')( 'TestFiles') testfiles = [os.path.expanduser(testfilesd[key]) for key in testfilesd] random.shuffle(testfiles) while testfiles: filename = testfiles.pop() if not core_api.is_database_open(filename) and \ os.path.isfile(filename): log.debug('Simulate open database') # Databases are blocked in simulator._do_action core_api.release_databases() wxgui_api.simulate_open_database(filename) break else: # Databases are blocked in simulator._do_action core_api.release_databases() return False
def open_database(): testfilesd = coreaux_api.get_plugin_configuration('wxdevelopment')( 'TestFiles') testfiles = [os.path.expanduser(testfilesd[key]) for key in testfilesd] random.shuffle(testfiles) while testfiles: filename = testfiles.pop() if not core_api.is_database_open(filename) and \ os.path.isfile(filename): log.debug('Simulate open database') # Databases are blocked in simulator._do_action core_api.release_databases() wxgui_api.simulate_open_database(filename) break else: # Databases are blocked in simulator._do_action core_api.release_databases() return False
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, 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 create_database(): testfilesd = coreaux_api.get_plugin_configuration('wxdevelopment')( 'TestFiles') testfiles = [os.path.expanduser(testfilesd[key]) for key in testfilesd] random.shuffle(testfiles) while testfiles: filename = testfiles.pop() if not core_api.is_database_open(filename): try: os.remove(filename) except OSError: # filename doesn't exist yet pass log.debug('Simulate create database') # Databases are blocked in simulator._do_action core_api.release_databases() wxgui_api.simulate_create_database(filename) break else: # Databases are blocked in simulator._do_action core_api.release_databases() return False
def create_database(): testfilesd = coreaux_api.get_plugin_configuration('wxdevelopment')( 'TestFiles') testfiles = [os.path.expanduser(testfilesd[key]) for key in testfilesd] random.shuffle(testfiles) while testfiles: filename = testfiles.pop() if not core_api.is_database_open(filename): try: os.remove(filename) except OSError: # filename doesn't exist yet pass log.debug('Simulate create database') # Databases are blocked in simulator._do_action core_api.release_databases() wxgui_api.simulate_create_database(filename) break else: # Databases are blocked in simulator._do_action core_api.release_databases() return False
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): 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)
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): self.config = coreaux_api.get_plugin_configuration('wxtexthistory') self.areas = {} Menu(self) wxgui_api.bind_to_open_editor(self._handle_open_editor)
def __init__(self, occview): self.occview = occview self.config = coreaux_api.get_plugin_configuration('wxtasklist')
def __init__(self): self.config = coreaux_api.get_plugin_configuration('wxtexthistory') self.areas = {} Menu(self) wxgui_api.bind_to_open_editor(self._handle_open_editor)
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, occview): self.occview = occview self.config = coreaux_api.get_plugin_configuration('wxtasklist')