def __init__(self, plugins): # QtGui.QDialog.__init__(self) self.setupUi(self) self.messages() self.plugins = plugins self.index = pluginIndex(QtCore.QLocale.system().name()) self.items = {} self.__setupui__() for name in plugins.getNames(): plugin = plugins.getPlugin(name) data = plugin.mconf.plugin item = pluginItem(plugin.mconf.install.mname) item.setup(data.name, data.description, data.home, data.authors, data.version) item.status(pluginitem.OBSOLOTE) item.setConfigurable() self.__appendItem(item) self.items[plugin.mconf.install.mname] = self.contentsLayout.indexOf(item)
def on_getIndexButton_clicked(self): cursorShape = self.cursor() self.setCursor(QtGui.QCursor(QtCore.Qt.WaitCursor)) try: self.index.updateIndex() for mname in self.index.index.getNames(): data = self.index.index.get(mname) if mname in self.plugins.getMNames(): if parseVersion(data.ver) > parseVersion(self.plugins.getPluginByMName(mname).mconf.plugin.version): self.contentsLayout.itemAt(self.items[mname]).widget().status(pluginitem.OLD) else: pass else: item = pluginItem(mname) item.setup(data.pname, data.desc, data.home, data.authors, data.ver) item.status(pluginitem.NEW) self.__appendItem(item) self.items[mname] = self.contentsLayout.indexOf(item) self.getIndexButton.setEnabled(False) except piException as e: self.setCursor(cursorShape) QMessage(self.msg[e.code], QtGui.QMessageBox.Critical, False, False, e.data) self.setCursor(cursorShape)