コード例 #1
0
ファイル: repository.py プロジェクト: exp111/pyTSon-Scripts
    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))
コード例 #2
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
コード例 #3
0
ファイル: repository.py プロジェクト: exp111/pyTSon-Scripts
    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)
コード例 #4
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)
コード例 #5
0
ファイル: __init__.py プロジェクト: Stanack/pyTSon_plugins
 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)
コード例 #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)
         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
コード例 #7
0
ファイル: __init__.py プロジェクト: spyderwan/pyTSon_plugins
 def __init__(self, info, parent=None):
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         os.path.join(ts3.getPluginPath(), "pyTSon", "scripts", "info",
                      "settings.ui"))
     self.setAttribute(Qt.WA_DeleteOnClose)
     self.setWindowTitle("Extended Info Settings")
     self.chk_debug.setChecked(info.cfg.getboolean('general', 'Debug'))
     self.chk_colored.setChecked(info.cfg.getboolean('general', 'Colored'))
     self.chk_arsv.setChecked(
         info.cfg.getboolean('general', 'Autorequest Server Variables'))
     self.chk_arcv.setChecked(
         info.cfg.getboolean('general', 'Autorequest Client Variables'))
     for name, value in info.cfg['VirtualServerProperties'].items():
         _item = QListWidgetItem(self.lst_server)
         _item.setToolTip(name)
         _item.setStatusTip('VirtualServerProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('VIRTUALSERVER_', '').replace('_', ' ').title())
     for name, value in info.cfg['VirtualServerPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_server)
         _item.setToolTip(name)
         _item.setStatusTip('VirtualServerPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('VIRTUALSERVER_', '').replace('_', ' ').title())
     for name, value in info.cfg['ChannelProperties'].items():
         _item = QListWidgetItem(self.lst_channel)
         _item.setToolTip(name)
         _item.setStatusTip('ChannelProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('CHANNEL_', '').replace('_', ' ').title())
     for name, value in info.cfg['ChannelPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_channel)
         _item.setToolTip(name)
         _item.setStatusTip('ChannelPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('CHANNEL_', '').replace('_', ' ').title())
     for name, value in info.cfg['ClientProperties'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ClientProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('CLIENT_', '').replace('_', ' ').title())
     for name, value in info.cfg['ClientPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ClientPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('CLIENT_', '').replace('_', ' ').title())
     for name, value in info.cfg['ConnectionProperties'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ConnectionProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('CONNECTION_', '').replace('_', ' ').title())
     for name, value in info.cfg['ConnectionPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ConnectionPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(
             name.replace('CONNECTION_', '').replace('_', ' ').title())
     self.info = info
コード例 #8
0
 def __init__(self,info, parent=None):
     super(QDialog, self).__init__(parent)
     setupUi(self, os.path.join(ts3.getPluginPath(), "pyTSon", "scripts", "info", "settings.ui"))
     self.setWindowTitle("Extended Info Settings")
     ts3.printMessageToCurrentTab(str(info.cfg.getboolean('general', 'Debug')))
     self.chk_debug.setChecked(info.cfg.getboolean('general', 'Debug'))
     self.chk_colored.setChecked(info.cfg.getboolean('general', 'Colored'))
     self.chk_arsv.setChecked(info.cfg.getboolean('general', 'Autorequest Server Variables'))
     self.chk_arcv.setChecked(info.cfg.getboolean('general', 'Autorequest Client Variables'))
     for name, value in info.cfg['VirtualServerProperties'].items():
         _item = QListWidgetItem(self.lst_server)
         _item.setToolTip(name)
         _item.setStatusTip('VirtualServerProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('VIRTUALSERVER_', '').replace('_', ' ').title())
     for name, value in info.cfg['VirtualServerPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_server)
         _item.setToolTip(name)
         _item.setStatusTip('VirtualServerPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('VIRTUALSERVER_', '').replace('_', ' ').title())
     for name, value in info.cfg['ChannelProperties'].items():
         _item = QListWidgetItem(self.lst_channel)
         _item.setToolTip(name)
         _item.setStatusTip('ChannelProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('CHANNEL_', '').replace('_', ' ').title())
     for name, value in info.cfg['ChannelPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_channel)
         _item.setToolTip(name)
         _item.setStatusTip('ChannelPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('CHANNEL_', '').replace('_', ' ').title())
     for name, value in info.cfg['ClientProperties'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ClientProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('CLIENT_', '').replace('_', ' ').title())
     for name, value in info.cfg['ClientPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ClientPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('CLIENT_', '').replace('_', ' ').title())
     for name, value in info.cfg['ConnectionProperties'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ConnectionProperties')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('CONNECTION_', '').replace('_', ' ').title())
     for name, value in info.cfg['ConnectionPropertiesRare'].items():
         _item = QListWidgetItem(self.lst_client)
         _item.setToolTip(name)
         _item.setStatusTip('ConnectionPropertiesRare')
         if value.lower() == "true": _item.setCheckState(Qt.Checked)
         else: _item.setCheckState(Qt.Unchecked)
         _item.setText(name.replace('CONNECTION_', '').replace('_', ' ').title())
コード例 #9
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("\"{}\" | \"{}\"".format(name, channel[1]))
         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('{} ({})'.format(p[0], key))
                 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(
                     "Couldn't set icon: {}".format(format_exc()),
                     ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
         icons.close()
         # self.channelGroups.sortItems()
         self.channelGroups.connect("itemChanged(QListWidgetItem*)",
                                    self.onSelectedChannelGroupChangedEvent)
         self.btn_set.connect("clicked(QPushButton*)",
                              self.on_btn_set_clicked)
         self.schid = schid
         self.dbid = dbid
         self.channel = channel[0]
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
         pass
コード例 #10
0
ファイル: repository.py プロジェクト: exp111/pyTSon-Scripts
    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()