Пример #1
0
    def build_single(self):
        self.nb = None
        self.view = SectionBg()
        self.content_box = Gtk.VBox()
        self.view.add(self.content_box)
        self.content_box.set_border_width(5)

        for instance_key in self.applet_settings.keys():
            for setting_key in self.applet_settings[instance_key].keys():
                if setting_key == "__md5__" or self.applet_settings[
                        instance_key][setting_key]["type"] == "generic":
                    continue
                self.setting_factories[instance_key].create(
                    setting_key,
                    self.applet_settings[instance_key][setting_key]["type"],
                    self.uuid)
            widgets = self.setting_factories[instance_key].widgets
            for widget_key in widgets.keys():
                if widgets[widget_key].get_indented():
                    indent = XletSettingsWidgets.IndentedHBox()
                    indent.add_fill(widgets[widget_key])
                    self.content_box.pack_start(indent, False, False, 2)
                else:
                    self.content_box.pack_start(widgets[widget_key], False,
                                                False, 2)
                if len(widgets[widget_key].dependents) > 0:
                    widgets[widget_key].update_dependents()
        self.content.pack_start(self.view, True, True, 2)
        self.current_id = instance_key
Пример #2
0
    def build_notebook(self):
        self.nb = Gtk.Notebook()
        i = 1
        for instance_key in self.applet_settings.keys():

            view = Gtk.ScrolledWindow()
            content_box = Gtk.VBox()
            view.add_with_viewport(content_box)
            content_box.set_border_width(5)
            for setting_key in self.applet_settings[instance_key].keys():
                if setting_key == "__md5__" or self.applet_settings[
                        instance_key][setting_key]["type"] == "generic":
                    continue
                self.setting_factories[instance_key].create(
                    setting_key,
                    self.applet_settings[instance_key][setting_key]["type"],
                    self.uuid)
            widgets = self.setting_factories[instance_key].widgets
            for widget_key in widgets.keys():
                if widgets[widget_key].get_indented():
                    indent = XletSettingsWidgets.IndentedHBox()
                    indent.add_fill(widgets[widget_key])
                    content_box.pack_start(indent, False, False, 2)
                else:
                    content_box.pack_start(widgets[widget_key], False, False,
                                           2)
                if len(widgets[widget_key].dependents) > 0:
                    widgets[widget_key].update_dependents()
            self.nb.append_page(view, Gtk.Label(_("Instance %s") % i))
            view.key = instance_key
            i += 1

        self.content.pack_start(self.nb, True, True, 2)
        self.nb.set_scrollable(True)
        self.nb.connect("switch-page", self.on_page_changed)