예제 #1
0
    def refresh(self):
        """Refreshes the content of the lists"""
        self.listWidget.clear()
        self.listWidget_2.clear()

        for plugin in self.manager.get_enabled():
            obj = self.manager.get(plugin)
            item = ObjectListItem(obj, obj.get_name())
            item.setIcon(QtGui.QIcon(_fromUtf8(obj.icon)))
            self.listWidget.addItem(item)

        for plugin in self.manager.get_disabled():
            obj = self.manager.get(plugin)
            item = ObjectListItem(obj, obj.get_name())
            item.setIcon(QtGui.QIcon(_fromUtf8(obj.icon)))
            self.listWidget_2.addItem(item)
예제 #2
0
    def setupUi(self):
        """Creates the ui elements for the preferences.
        This function overrides the Ui_Form function creating thinks that
        aren't easy to do with the QT Designer"""
        super(Ui_Preferences, self).setupUi(self)
        self.refresh()

        self.connect(
            self.buttonBox,
            QtCore.SIGNAL(_fromUtf8("accepted()")),
            self.saveandclose)

        self.connect(
            self.b_disable,
            QtCore.SIGNAL(_fromUtf8("clicked()")), self.disable)
        self.connect(
            self.b_enable,
            QtCore.SIGNAL(_fromUtf8("clicked()")), self.enable)
        # Language selector
        self.current_lang = Collector.get_instance().conf('lang')
        if not self.current_lang is None:
            index = 1
            try:
                index = self.codes.index(str(self.current_lang))
            except ValueError:
                index = 1
            self.lang_combo.setCurrentIndex(index)

        # Copy file
        self.copy = Collector.get_instance().conf('copy')

        self.copy_dict = {
            self.tr("Always"): "always",
            self.tr("Never"): "never",
            self.tr("Remote only"): "http"
        }
        index = 0
        for i in self.copy_dict.items():
            self.copy_combo.addItem(i[0])
            if i[1] == self.copy:
                self.copy_combo.setCurrentIndex(index)
            index += 1

        self.home.setText(_fromUtf8(Collector.get_instance().conf('home')))