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 _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)