def setupList(self): #self.reasons.clear() #_list = QListWidget(self.reasons) for reason in self.CONF_REASONS: item = QListWidgetItem(self.reasons) item.setText(reason) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsEnabled)
def on_addButton_clicked(self): (res, name, url) = MultiInputDialog.getTexts(self._tr("Add repository"), self._tr("Name:"), self._tr("URL:"), "", "", self) if res: qurl = QUrl(url) if qurl.isValid() and not qurl.isLocalFile(): rep = dict() rep["name"] = name rep["url"] = url rep["origin"] = "local" rep["active"] = True self.replist[name] = rep item = QListWidgetItem(name) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) item.setCheckState(Qt.Checked) item.setData(Qt.UserRole, name) self.repositoryList.addItem(item) else: QMessageBox.critical(self._tr("Error"), self._tr("The URL {url} is not valid"). format(url=url))
def updateAddonlist(self): if self.pluginsList.currentItem(): cur = self.pluginsList.currentItem().text() else: cur = None self.pluginsList.clear() for a in self.addons.values(): if (self.replist[a["repository"]]["active"] and ("platforms" not in a or pytson.platformstr() in a["platforms"])): item = QListWidgetItem(a["name"], self.pluginsList) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) item.setData(Qt.UserRole, a["name"]) if a["name"] in self.host.plugins: if a["version"] > self.host.plugins[a["name"]].version: item.setForeground(Qt.red) item.setToolTip(self._tr("Update available")) elif a["version"] == self.host.plugins[a["name"]].version: item.setForeground(Qt.green) item.setToolTip(self._tr("You have this plugin " "installed, no update " "available")) elif a["version"] < self.host.plugins[a["name"]].version: item.setForeground(Qt.gray) item.setToolTip(self._tr("Your local version has a " "greater version number")) if cur and a["name"] == cur: self.pluginsList.setCurrentItem(item) self.pluginsList.sortItems()
def __init__(self, schid, cgid, dbid, name, channel, groups, parent=None): try: super(QDialog, self).__init__(parent) setupUi(self, path.join(getPluginPath(), "scripts", "channelGroupChanger", "channelGroupSelect.ui")) self.setAttribute(Qt.WA_DeleteOnClose) self.setWindowTitle("%s | %i"%(name,channel)) cache = False try: icons = IconPack.current() icons.open() cache = ServerCache(schid) except: from traceback import format_exc;ts3lib.logMessage("Could not load icons: {}".format(format_exc()), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0) # self.channelGroups.addItems(list(groups.values())) self.channelGroups.clear() for key,p in groups.items(): try: item = QListWidgetItem(self.channelGroups) item.setText(p[0]) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) item.setCheckState(Qt.Checked if key == cgid else Qt.Unchecked) item.setData(Qt.UserRole, key) if (cache): try: if p[1] == 0: continue; elif p[1] in range(100, 700, 100): item.setIcon(QIcon(IconPack.icon(icons,"group_{}".format(p[1])))) else: item.setIcon(QIcon(ServerCache.icon(cache,p[1]&0xFFFFFFFF))) except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0) except: from traceback import format_exc;ts3lib.logMessage("Could set icon: {}".format(format_exc()), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0) icons.close() # self.channelGroups.sortItems() self.channelGroups.connect("itemChanged(QListWidgetItem*)", self.onSelectedChannelGroupChangedEvent) self.schid = schid;self.dbid = dbid;self.channel = channel except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0);pass
def updateMasterlist(self): self.repositoryList.clear() for name, r in self.replist.items(): item = QListWidgetItem(name) item.setFlags(Qt.ItemIsSelectable | Qt.ItemIsUserCheckable | Qt.ItemIsEnabled) item.setCheckState(Qt.Checked if r["active"] else Qt.Unchecked) item.setData(Qt.UserRole, name) self.repositoryList.addItem(item)