def set_action_group(self, action_group): super(SearchBar, self).set_action_group(action_group) # This is a little gimmnick to make it not throw an exception # Since the holders return None when the first argument is # None. if action_group is None: get_action = lambda name: None else: get_action = lambda name: action_group.get_action(name) # Update references self.find_forward = get_action(ACTION_FIND_FORWARD) self.find_backward = get_action(ACTION_FIND_BACKWARD) # Update signal subscription hld = signal_holder(self.find_forward, "activate", self.on_find_forward) self.find_forward_source = hld act = self.find_backward hld = signal_holder(act, "activate", self.on_find_backward) self.find_backward_source = hld # Update action proxy subscription fw = subscribe_proxy(self.find_forward, self.forward_button) self.forward_button_source = fw bw = subscribe_proxy(self.find_backward, self.backward_button) self.backward_button_source = bw # Propagate entry state self.on_entry_changed(self.entry)
def set_action_group(self, action_group): super(ReplaceBar, self).set_action_group(action_group) # This is a little gimmnick to make it not throw an exception # Since the holders return None when the first argument is # None. if action_group is None: get_action = lambda name: None else: get_action = lambda name: action_group.get_action(name) replace_forward = get_action(ACTION_REPLACE_FORWARD) replace_all = get_action(ACTION_REPLACE_ALL) self.toggle_find = get_action(ACTION_FIND_TOGGLE) self.signal_1 = signal_holder(replace_forward, "activate", self.on_replace_curr) self.signal_2 = signal_holder(replace_all, "activate", self.on_replace_all) sbs = subscribe_proxy(replace_forward, self.btn_replace_forward) self.replace_forward_src = sbs sbs = subscribe_proxy(replace_all, self.btn_replace_all) self.replace_all_src = sbs