class TriggerManager(object): ''' Auto disconnected trigger manager Wraps SCRIBES.TriggerManager and calls remove_triggers on object deletion ''' def __init__(self, editor): self.manager = CoreTriggerManager(editor) self.triggers = {} def __del__(self): self.triggers.clear() self.manager.remove_triggers() def connect_triggers(self, obj): ''' Connects object methods marked by trigger decorator ''' for attr, value in obj.__class__.__dict__.iteritems(): for trigger, connect_params in getattr(value, 'triggers_to_connect', ()): self.connect(trigger, obj, attr, **connect_params) def connect(self, trigger, obj, attr, after, idle): if trigger.name not in self.triggers: self.triggers[trigger.name] = trigger.create(self.manager) weak_connect(self.triggers[trigger.name], 'activate', obj, attr, after=after, idle=idle)
def __init__(self, editor): SignalManager.__init__(self) TriggerManager.__init__(self, editor) self.__init_attributes(editor) self.connect(self.__trigger1, "activate", self.__activate_cb) self.connect(self.__trigger2, "activate", self.__activate_cb) self.connect(self.__trigger3, "activate", self.__activate_cb)
def __init__(self, editor): SignalManager.__init__(self) TriggerManager.__init__(self, editor) self.__init_attributes(editor) self.connect(self.__trigger1, "activate", self.__activate_cb) self.connect(self.__trigger2, "activate", self.__activate_cb) self.connect(editor.textview, "populate-popup", self.__popup_cb)
def __init__(self, editor): SignalManager.__init__(self) TriggerManager.__init__(self, editor) self.__init_attributes(editor) self.connect(self.__trigger, "activate", self.__activate_cb) self.connect(self.__trigger1, "activate", self.__activate_cb) self.connect(self.__trigger2, "activate", self.__activate_cb)
def __init__(self, editor): SignalManager.__init__(self) TriggerManager.__init__(self, editor) self.__init_attributes(editor) self.connect(self.__trigger1, "activate", self.__activate_cb) self.connect(self.__trigger2, "activate", self.__activate_cb) self.connect(self.__trigger3, "activate", self.__activate_cb) editor.get_toolbutton("OpenToolButton").props.sensitive = True
def __init__(self, editor): SignalManager.__init__(self) TriggerManager.__init__(self, editor) self.__init_attributes(editor) self.connect(self.__trigger1, "activate", self.__activate_cb) self.connect(self.__trigger2, "activate", self.__activate_cb) from MenuItem import MenuItem MenuItem(editor)
def __init__(self, editor): SignalManager.__init__(self, editor) TriggerManager.__init__(self, editor) self.__init_attributes(editor) # self.connect(self.__trigger1, "activate", self.__activate_cb) self.connect(self.__trigger2, "activate", self.__activate_cb) self.connect(self.__trigger3, "activate", self.__activate_cb) self.connect(self.__trigger4, "activate", self.__activate_cb) self.connect(self.__trigger5, "activate", self.__activate_cb) self.connect(self.__trigger6, "activate", self.__activate_cb) self.connect(self.__trigger7, "activate", self.__activate_cb) self.connect(self.__trigger8, "activate", self.__activate_cb) self.connect(self.__trigger9, "activate", self.__activate_cb) self.connect(self.__trigger10, "activate", self.__activate_cb)
def __init__(self, editor): self.manager = CoreTriggerManager(editor) self.triggers = {}
def __init__(self, editor): SignalManager.__init__(self) TriggerManager.__init__(self, editor) self.__init_attributes(editor) self.connect(self.__trigger, "activate", self.__show_window_cb)