How to use the safeeyes.Utility.create_gtk_builder function in safeeyes

To help you get started, we’ve selected a few safeeyes 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 slgobinath / SafeEyes / safeeyes / AboutDialog.py View on Github external
def __init__(self, version):
        builder = Utility.create_gtk_builder(ABOUT_DIALOG_GLADE)
        builder.connect_signals(self)
        self.window = builder.get_object('window_about')
        builder.get_object('lbl_decription').set_label(_('description'))
        builder.get_object('lbl_license').set_label(_('License') + ':')

        # Set the version at the runtime
        builder.get_object('lbl_app_name').set_label('Safe Eyes ' + version)
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __load_bool_item(self, name, key, settings):
        """
        Load the UI control for boolean property.
        """
        builder = Utility.create_gtk_builder(SETTINGS_ITEM_BOOL_GLADE)
        builder.get_object('lbl_name').set_label(_(name))
        switch_value = builder.get_object('switch_value')
        switch_value.set_active(settings[key])
        box = builder.get_object('box')
        box.set_visible(True)
        self.property_controls.append({'key': key, 'settings': settings, 'value': switch_value.get_active})
        return box
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __init__(self, config):
        self.config = config
        self.property_controls = []

        builder = Utility.create_gtk_builder(SETTINGS_DIALOG_PLUGIN_GLADE)
        builder.connect_signals(self)
        self.window = builder.get_object('dialog_settings_plugin')
        box_settings = builder.get_object('box_settings')
        self.window.set_title(_('Plugin Settings'))
        for setting in config.get('settings'):
            if setting['type'].upper() == 'INT':
                box_settings.pack_start(self.__load_int_item(setting['label'], setting['id'], setting['safeeyes_config'], setting.get('min', 0), setting.get('max', 120)), False, False, 0)
            elif setting['type'].upper() == 'TEXT':
                box_settings.pack_start(self.__load_text_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0)
            elif setting['type'].upper() == 'BOOL':
                box_settings.pack_start(self.__load_bool_item(setting['label'], setting['id'], setting['safeeyes_config']), False, False, 0)
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __load_int_item(self, name, key, settings, min_value, max_value):
        """
        Load the UI control for int property.
        """
        builder = Utility.create_gtk_builder(SETTINGS_ITEM_INT_GLADE)
        builder.get_object('lbl_name').set_label(_(name))
        spin_value = builder.get_object('spin_value')
        spin_value.set_range(min_value, max_value)
        spin_value.set_value(settings[key])
        box = builder.get_object('box')
        box.set_visible(True)
        self.property_controls.append({'key': key, 'settings': settings, 'value': spin_value.get_value})
        return box
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __init__(self, config, on_save_settings):
        self.config = config
        self.on_save_settings = on_save_settings
        self.plugin_switches = {}
        self.plugin_map = {}
        self.last_short_break_interval = config.get('short_break_interval')
        self.initializing = True
        self.infobar_long_break_shown = False
        self.warn_bar_rpc_server_shown = False

        builder = Utility.create_gtk_builder(SETTINGS_DIALOG_GLADE)
        builder.connect_signals(self)

        self.window = builder.get_object('window_settings')
        self.box_short_breaks = builder.get_object('box_short_breaks')
        self.box_long_breaks = builder.get_object('box_long_breaks')
        self.box_plugins = builder.get_object('box_plugins')
        self.popover = builder.get_object('popover')

        self.spin_short_break_duration = builder.get_object('spin_short_break_duration')
        self.spin_long_break_duration = builder.get_object('spin_long_break_duration')
        self.spin_short_break_interval = builder.get_object('spin_short_break_interval')
        self.spin_long_break_interval = builder.get_object('spin_long_break_interval')
        self.spin_time_to_prepare = builder.get_object('spin_time_to_prepare')
        self.spin_postpone_duration = builder.get_object('spin_postpone_duration')
        self.spin_disable_keyboard_shortcut = builder.get_object('spin_disable_keyboard_shortcut')
        self.switch_strict_break = builder.get_object('switch_strict_break')
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __create_break_item(self, break_config, is_short):
        """
        Create an entry for break to be listed in the break tab.
        """
        parent_box = self.box_long_breaks
        if is_short:
            parent_box = self.box_short_breaks
        builder = Utility.create_gtk_builder(SETTINGS_BREAK_ITEM_GLADE)
        box = builder.get_object('box')
        lbl_name = builder.get_object('lbl_name')
        lbl_name.set_label(_(break_config['name']))
        btn_properties = builder.get_object('btn_properties')
        btn_properties.connect(
            'clicked',
            lambda button: self.__show_break_properties_dialog(
                break_config,
                is_short,
                self.config,
                lambda cfg: lbl_name.set_label(_(cfg['name'])),
                lambda is_short, break_config: self.__create_break_item(break_config, is_short),
                lambda: parent_box.remove(box)
            )
        )
        btn_delete = builder.get_object('btn_delete')
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __create_plugin_item(self, plugin_config):
        """
        Create an entry for plugin to be listed in the plugin tab.
        """
        builder = Utility.create_gtk_builder(SETTINGS_PLUGIN_ITEM_GLADE)
        lbl_plugin_name = builder.get_object('lbl_plugin_name')
        lbl_plugin_description = builder.get_object('lbl_plugin_description')
        switch_enable = builder.get_object('switch_enable')
        btn_properties = builder.get_object('btn_properties')
        lbl_plugin_name.set_label(_(plugin_config['meta']['name']))
        switch_enable.set_active(plugin_config['enabled'])
        if plugin_config['error']:
            lbl_plugin_description.set_label(_(plugin_config['meta']['description']))
            lbl_plugin_name.set_sensitive(False)
            lbl_plugin_description.set_sensitive(False)
            switch_enable.set_sensitive(False)
        else:
            lbl_plugin_description.set_label(_(plugin_config['meta']['description']))
        self.plugin_switches[plugin_config['id']] = switch_enable
        if plugin_config.get('break_override_allowed', False):
            self.plugin_map[plugin_config['id']] = plugin_config['meta']['name']
github slgobinath / SafeEyes / safeeyes / settings.py View on Github external
def __load_text_item(self, name, key, settings):
        """
        Load the UI control for text property.
        """
        builder = Utility.create_gtk_builder(SETTINGS_ITEM_TEXT_GLADE)
        builder.get_object('lbl_name').set_label(_(name))
        txt_value = builder.get_object('txt_value')
        txt_value.set_text(settings[key])
        box = builder.get_object('box')
        box.set_visible(True)
        self.property_controls.append({'key': key, 'settings': settings, 'value': txt_value.get_text})
        return box