Exemple #1
0
    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))
Exemple #2
0
    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()
Exemple #3
0
 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
Exemple #4
0
 def badgeItem(self, badge, alt=False):
     item = QListWidgetItem(self.badges[badge]["name"])
     item.setData(Qt.UserRole, badge)
     item.setToolTip(self.badges[badge]["description"])
     item.setIcon(
         QIcon("{}\\{}{}".format(self.icons, self.badges[badge]["filename"],
                                 "_details" if alt else "")))
     return item
Exemple #5
0
    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)
Exemple #6
0
 def badgeItem(self, badge, alt=False, ext=False):
     try:
         lst = self.extbadges if ext else self.badges
         item = QListWidgetItem(lst[badge]["name"])
         item.setData(Qt.UserRole, badge)
         try: item.setToolTip(lst[badge]["description"])
         except: pass
         try: item.setIcon(QIcon("{}\\{}{}".format(self.icons, lst[badge]["filename"],"_details" if alt else "")))
         except: pass
         return item
     except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Exemple #7
0
 def badgeItem(self, badge, alt=False, ext=False):
     try:
         lst = self.extbadges if ext else self.badges
         item = QListWidgetItem(lst[badge]["name"])
         item.setData(Qt.UserRole, badge)
         path = "{}\\{}".format(self.icons, lst[badge]["filename"])
         item.setToolTip(
             '{}<br/><center><img width="64" height="64" src="{}_details">'.
             format(lst[badge]["description"], path))
         item.setIcon(QIcon("{}{}".format(path, "_details" if alt else "")))
         return item
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
         pass