Example #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))
Example #2
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
Example #3
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)
Example #4
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.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
Example #5
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())