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 _handle_close_database(self, kwargs): if kwargs['filename'] == self.filename: organism_api.bind_to_update_item_rules_conditional( self._handle_update_rules, False) organism_api.bind_to_history_insert(self._handle_history, False) organism_api.bind_to_history_update(self._handle_history, False) wxgui_api.bind_to_open_database(self._handle_open_database, False) wxgui_api.bind_to_close_database(self._handle_close_database, False) if wxcopypaste_api: wxcopypaste_api.bind_to_items_pasted(self._handle_paste, False)
def _handle_close_database(self, kwargs): if kwargs['filename'] == self.filename: links_api.bind_to_upsert_link(self._handle_upsert_link, False) links_api.bind_to_delete_link(self._handle_delete_link, False) links_api.bind_to_break_link(self._handle_break_links, False) wxgui_api.bind_to_open_database(self._handle_open_database, False) wxgui_api.bind_to_close_database(self._handle_close_database, False) links_api.bind_to_history_insert(self._handle_history, False) links_api.bind_to_history_update(self._handle_history, False) links_api.bind_to_history_delete(self._handle_history, False) if wxcopypaste_api: wxcopypaste_api.bind_to_items_pasted(self._handle_paste, False)