Пример #1
0
    def _update_attribute(self, widget, attribute, value):
        log.debug("%s.%s = %r" % (self._model.__class__.__name__, attribute, value))

        # only update the model if the data is correct
        if value is ValueUnset:
            return

        # Dont update the model if the widget is not sensitive, or if it is not
        # editable.
        if not widget.is_sensitive():
            return
        if isinstance(widget, gtk.Editable) and not widget.get_editable():
            return

        model = self.model
        # XXX: One day we might want to queue and unique updates?
        if hasattr(model, "block_proxy"):
            model.block_proxy(self)
            ksetattr(model, attribute, value)
            model.unblock_proxy(self)
        else:
            ksetattr(model, attribute, value)

        # Call global update hook
        self.proxy_updated(widget, attribute, value)
Пример #2
0
    def _update_attribute(self, widget, attribute, value):
        log.debug('%s.%s = %r' %
                  (self._model.__class__.__name__, attribute, value))

        # only update the model if the data is correct
        if value is ValueUnset:
            return

        # Dont update the model if the widget is not sensitive, or if it is not
        # editable.
        if not widget.is_sensitive():
            return
        if isinstance(widget, gtk.Editable) and not widget.get_editable():
            return

        model = self.model
        # XXX: One day we might want to queue and unique updates?
        if hasattr(model, "block_proxy"):
            model.block_proxy(self)
            ksetattr(model, attribute, value)
            model.unblock_proxy(self)
        else:
            ksetattr(model, attribute, value)

        # Call global update hook
        self.proxy_updated(widget, attribute, value)
Пример #3
0
    def _on_widget__content_changed(self, widget, attribute, validate):
        """This is called as soon as the content of one of the widget
        changes, the widgets tries fairly hard to not emit when it's not
        neccessary"""

        # skip updates for model if there is none, right?
        if self._model is None:
            return

        if validate:
            value = widget.validate()
        else:
            value = widget.read()

        log('%s.%s = %r' % (self._model.__class__.__name__,
                            attribute, value))

        # only update the model if the data is correct
        if value is ValueUnset:
            return

        model = self._model
        # XXX: one day we might want to queue and unique updates?
        if hasattr(model, "block_proxy"):
            model.block_proxy(self)
            ksetattr(model, attribute, value)
            model.unblock_proxy(self)
        else:
            ksetattr(model, attribute, value)

        # Call global update hook
        self.proxy_updated(widget, attribute, value)
Пример #4
0
    def _update_attribute(self, widget, attribute, value):
        log('%s.%s = %r' %
            (self._model.__class__.__name__, attribute, value))

        # only update the model if the data is correct
        if value is ValueUnset:
            return

        model = self.model
        # XXX: One day we might want to queue and unique updates?
        if hasattr(model, "block_proxy"):
            model.block_proxy(self)
            ksetattr(model, attribute, value)
            model.unblock_proxy(self)
        else:
            ksetattr(model, attribute, value)

        # Call global update hook
        self.proxy_updated(widget, attribute, value)