How to use the pympress.builder.Builder function in pympress

To help you get started, we’ve selected a few pympress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Cimbali / pympress / pympress / builder.py View on Github external
try:
            return getattr(target, handler_name)

        except AttributeError:
            attr_list = handler_name.split('.')

            if len(attr_list) == 1:
                logger.error('Handler name not in target object. Expected "." but got: {}'.format(handler_name),
                             exc_info = True)
                raise

            # Dynamically resolved handler for 'doc' (only) since target.doc may change
            if 'doc' in attr_list:
                return lambda *args, **kwargs: Builder.signal_resolver(target, attr_list)(*args, **kwargs)
            else:
                return Builder.signal_resolver(target, attr_list)
github Cimbali / pympress / pympress / builder.py View on Github external
def __recursive_translate_widgets(a_widget):
        """ Calls gettext on all strings we can find in widgets, and recursively on its children.

        Args:
            a_widget (:class:`~GObject.Object`): an object built by the builder, usually a widget
        """
        Builder.__translate_widget_strings(a_widget)

        if issubclass(type(a_widget), Gtk.Container):
            # NB: Parent-loop in widgets would cause infinite loop here, but that's absurd (right?)
            # NB2: maybe forall instead of foreach if we miss some strings?
            a_widget.foreach(Builder.__recursive_translate_widgets)

        if issubclass(type(a_widget), Gtk.MenuItem) and a_widget.get_submenu() is not None:
            Builder.__recursive_translate_widgets(a_widget.get_submenu())
github Cimbali / pympress / pympress / builder.py View on Github external
def connect_signals(self, base_target):
        """ Signal connector connecting to properties of `base_target`, or properties of its properties, etc.

        Args:
            base_target (:class:`~pympress.builder.Builder`): The target object, that has functions to be connected to
            signals loaded in this builder.
        """
        Builder.connect_signals_full(base_target, self.signal_connector)
github Cimbali / pympress / pympress / builder.py View on Github external
def __recursive_translate_widgets(a_widget):
        """ Calls gettext on all strings we can find in widgets, and recursively on its children.

        Args:
            a_widget (:class:`~GObject.Object`): an object built by the builder, usually a widget
        """
        Builder.__translate_widget_strings(a_widget)

        if issubclass(type(a_widget), Gtk.Container):
            # NB: Parent-loop in widgets would cause infinite loop here, but that's absurd (right?)
            # NB2: maybe forall instead of foreach if we miss some strings?
            a_widget.foreach(Builder.__recursive_translate_widgets)

        if issubclass(type(a_widget), Gtk.MenuItem) and a_widget.get_submenu() is not None:
            Builder.__recursive_translate_widgets(a_widget.get_submenu())
github Cimbali / pympress / pympress / builder.py View on Github external
def __init__(self):
        super(Builder, self).__init__()