示例#1
0
    def __init__(self, widget, toggle_action, apply_now=True):

        self._activate = signal_holder(
            widget,
            "show",
            _activate_action,
            userdata=toggle_action
        )
        
        self._deactivate = signal_holder(
            widget,
            "hide",
            _deactivate_action,
            userdata=toggle_action
        )
        
        self._toggle_visible = signal_holder(
            toggle_action,
            "toggled",
            _toggle_visibility,
            userdata=widget
        )
        
        # Take effect now
        visible = widget.get_property("visible")
        if apply_now and visible != toggle_action.get_active():
            toggle_action.set_active(visible)
示例#2
0
    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)
示例#3
0
    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)
示例#4
0
    def __init__(self, widget, toggle_action, apply_now=True):

        self._activate = signal_holder(widget, "show", _activate_action, userdata=toggle_action)

        self._deactivate = signal_holder(widget, "hide", _deactivate_action, userdata=toggle_action)

        self._toggle_visible = signal_holder(toggle_action, "toggled", _toggle_visibility, userdata=widget)

        # Take effect now
        visible = widget.get_property("visible")
        if apply_now and visible != toggle_action.get_active():
            toggle_action.set_active(visible)
示例#5
0
    def enable_highlight(self):
        # highlight the search string
        self.update_highlight()

        # activate the callback to know when the buffer has changed
        self.src = gtkutil.signal_holder(self.buffer, "changed",
                                         self.on_txt_changed)
示例#6
0
    def enable_highlight(self):
        # highlight the search string
        self.update_highlight()

        # activate the callback to know when the buffer has changed
        self.src = gtkutil.signal_holder(self.buffer, "changed",
                                        self.on_txt_changed)
示例#7
0
 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
示例#8
0
    def _bind(self, service_provider):

        self.search_tag = self.buffer.create_tag(
            "search_markers",
            background="yellow",
            foreground="black",
        )

        self.on_search_changed = OnSearchTextChanged(self)
        self.hld = gtkutil.signal_holder(self.search, "text-changed",
                                         self.on_search_changed)
        self.on_txt_changed = OnTextBufferChanged(self)
示例#9
0
    def _bind(self, service_provider):
        
        self.search_tag = self.buffer.create_tag(
            "search_markers",
            background="yellow",
            foreground="black",
        )

        self.on_search_changed = OnSearchTextChanged(self)
        self.hld = gtkutil.signal_holder(self.search, "text-changed",
                                         self.on_search_changed)
        self.on_txt_changed = OnTextBufferChanged(self)
示例#10
0
    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
示例#11
0
 def _connect(self, *args, **kwargs):
     self._signals.append(signal_holder(*args, **kwargs))
示例#12
0
 def _connect(self, *args, **kwargs):
     self._signals.append(signal_holder(*args, **kwargs))