Exemple #1
0
    def __init__(self, label=''):
        """
        Create a new BoolSearchFilter object.
        :param label: label of the search filter
        """
        self._block_updates = False
        SearchFilter.__init__(self, label=label)

        self.button = ProxyCheckButton(label=label)
        self.button.connect('content-changed',
                            self._on_button__content_changed)
        self.pack_start(self.button, False, False, 6)
        self.button.show()

        self.combo = False
Exemple #2
0
    def setup_slaves(self):
        settings = {}
        for setting in self.model.profile_settings:
            settings[setting.app_dir_name] = setting

        apps = get_utility(IApplicationDescriptions)
        for name, full_name, icon_name, description in apps.get_descriptions():
            # Virtual apps should not be selected here
            if name in ProfileSettings.virtual_apps:
                continue

            # Create the user interface for each application which is
            # a HBox, a CheckButton and an Image
            box = Gtk.HBox()
            box.show()

            button = ProxyCheckButton()
            button.set_label(full_name)
            button.data_type = bool
            button.model_attribute = 'has_permission'
            button.show()
            box.pack_start(button, True, True, 6)

            image = Gtk.Image.new_from_stock(icon_name, Gtk.IconSize.MENU)
            box.pack_start(image, False, False, 0)
            image.show()

            self.applications_vbox.pack_start(box, False, True, 0)

            model = settings.get(name)
            if model is None:
                model = ProfileSettings(store=self.store,
                                        has_permission=False,
                                        app_dir_name=name,
                                        user_profile=self.model)

            setattr(self, name, button)
            self.add_proxy(model, [name])

        # Scroll to the bottom of the scrolled window
        vadj = self.scrolled_window.get_vadjustment()
        vadj.set_value(vadj.get_upper())
Exemple #3
0
def get_widget_for_type(rtype):
    if rtype is types.boolean:
        return ProxyCheckButton()
    elif rtype is types.file:
        w = ProxyFileChooserButton('Select File')
        #w.set_action(gtk.FILE_CHOOSER_ACTION_SAVE)
        return w
    elif rtype is types.readonlyfile:
        w = ProxyFileChooserButton('Select File')
        w.set_sensitive(False)
        #w.set_action(gtk.FILE_CHOOSER_ACTION_SAVE)
        return w
    elif rtype in [types.directory]:
        w = ProxyFileChooserButton(title='Select Directory')
        w.set_action(gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER)
        return w
    elif rtype is types.font:
        return ProxyFontButton()
    elif rtype is types.color:
        return CleverProxyColorButton()
    elif rtype is types.integer:
        w = ProxySpinButton()
        return w
    elif rtype.__name__ is 'intrange':
        adjvals = rtype.lower, rtype.upper, rtype.step
        adj = gtk.Adjustment(0, *adjvals)
        w = ProxySpinButton()
        w.set_adjustment(adj)
        return w
    elif rtype is types.readonly:
        return FormattedLabel(VC_NAME_MU)
    elif rtype.__name__ is 'stringlist':
        w = ProxyComboBox()
        w.set_property('data-type', str)
        w.prefill(rtype.choices)
        return w
    else:
        w = ProxyEntry(data_type=str)
        w.set_width_chars(18)
        return w
Exemple #4
0
 def testForBool(self):
     myChkBtn = ProxyCheckButton()
     assert isinstance(myChkBtn, gtk.CheckButton)
Exemple #5
0
 def build_widget(self):
     widget = ProxyCheckButton(self.label)
     return widget