Example #1
0
 def __init__(self, script, schid, clid, uid, name, ip, parent=None):
     try:
         super(QDialog, self).__init__(parent)
         setupUi(self, "%s/ban.ui"%script.path)
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.cfg = script.cfg
         self.ini = script.ini
         self.schid = schid
         self.templates = script.templates
         self.whitelist = script.whitelist
         self.name = script.name
         if script.cfg.getboolean("last", "expanded"):
             self.disableReasons(True)
         height = script.cfg.get("last", "height")
         if height: self.resize(self.width, int(height))
         else: self.disableReasons()
         alt = script.cfg.getboolean("last", "alternate")
         if alt: self.chk_alternate.setChecked(True)
         dblclick = script.cfg.getboolean("last", "ban on doubleclick")
         if dblclick: self.chk_doubleclick.setChecked(True)
         for reason in script.templates:
             self.lst_reasons.addItem(reason)
             self.box_reason.addItem(reason)
         self.box_reason.setEditText(script.cfg.get("last", "reason")) # setItemText(0, )
         self.setup(script, schid, clid, uid, name, ip)
     except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #2
0
 def __init__(self, addons, name, cfg, parent=None):
     try:
         super(QWidget, self).__init__(parent)
         setupUi(
             self,
             path.join(pytson.getPluginPath(), "scripts", "addonList",
                       "addons.ui"))
         self.cfg = cfg
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle("{0}'s Addons".format(name))
         self.txt_description.setVisible(False)
         self.tbl_addons.horizontalHeader().setSectionResizeMode(
             0, QHeaderView.Stretch)
         self.tbl_addons.horizontalHeader().setSectionResizeMode(
             2, QHeaderView.Stretch)
         self.setupList(addons.getchildren())
         self.resize(1000, 600)
         self.adddons = addons
     except:
         try:
             from traceback import format_exc
             ts3.logMessage("addonList: " + format_exc(),
                            ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
         except:
             try:
                 from traceback import format_exc
                 print("addonList: " + format_exc())
             except:
                 print("addonList: Unknown Error")
Example #3
0
 def __init__(self, plugin, parent=None):
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         path.join(ts3lib.getPluginPath(), "pyTSon", "scripts",
                   "nowPlaying", "settings.ui"))
     self.setWindowTitle("Now Playing Settings")
Example #4
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 #5
0
 def __init__(self, parent=None):
     try:
         super(QWidget, self).__init__(parent)
         setupUi(self, path.join(pytson.getPluginPath(), "scripts", "queryConsole", "console.ui"))
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle("Query Console")
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #6
0
 def __init__(self, parent):
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         os.path.join(ts3.getPluginPath(), "pyTSon", "ressources",
                      "servers.ui"), self.CONF_WIDGETS)
     self.setupList()
Example #7
0
 def __init__(self, channelGroupManager, schid, cid, parent=None):
     try:
         super(QWidget, self).__init__(parent)
         setupUi(self, channelGroupManager.ui)
         self.schid = schid
         self.cid = cid
         cgroups = channelGroupManager.cgroups
         cgroups = cgroups[schid]
         cgroups = cgroups["groups"]
         self.cgroups = cgroups
         self.db = channelGroupManager.db
         self.execSQL = channelGroupManager.execSQL
         self.setAttribute(Qt.WA_DeleteOnClose)
         (err, cname) = ts3lib.getChannelVariable(
             schid, cid, ts3defines.ChannelProperties.CHANNEL_NAME)
         self.setWindowTitle("Members of \"{}\"".format(cname))
         self.tbl_members.setColumnWidth(0, 130)
         self.tbl_members.setColumnWidth(1, 250)
         self.tbl_members.setColumnWidth(2, 215)
         self.tbl_members.setColumnWidth(3, 50)
         self.tbl_members.setColumnWidth(4, 140)
         self.setupTable()
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Example #8
0
 def __init__(self, plugin, parent=None):
     try:
         # self.schid = schid;self.uids = uids
         super(QDialog, self).__init__(parent)
         setupUi(self, os.path.join(pytson.getPluginPath(), "scripts", "passwordCracker", "status.ui"))
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle('{0} - Idle'.format(plugin.name))
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #9
0
 def __init__(self, this, parent=None):
     self.this = this
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         path.join(pytson.getPluginPath(), "scripts", "NoX", "settings.ui"))
     self.setWindowTitle("%s Settings" % this.name)
     self.chk_debug.setChecked(this.cfg.getboolean("general", "debug"))
Example #10
0
 def __init__(self, schid, uids, parent=None):
     try:
         self.schid = schid;self.uids = uids
         super(QDialog, self).__init__(parent)
         setupUi(self, path.join(pytson.getPluginPath(), "scripts", "onlineOfflineMessages", "message.ui"))
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle("Offline Message to {0} clients.".format(len(uids)))
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #11
0
 def __init__(self, gommeChecker, parent=None):
     self.gommeChecker=gommeChecker
     super(QDialog, self).__init__(parent)
     self.setAttribute(Qt.WA_DeleteOnClose)
     setupUi(self, path.join(pytson.getPluginPath(), "scripts", "gommeChecker", "check.ui"))
     self.setWindowTitle("Gomme Checker")
     self.checktable.setColumnWidth(2, 350)
     self.checkChannels()
Example #12
0
 def __init__(self, info, type, target, parent=None):
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         os.path.join(ts3.getPluginPath(), "pyTSon", "scripts", "info",
                      "variables.ui"))
     self.setAttribute(Qt.WA_DeleteOnClose)
     self.setupTable(type, target)
Example #13
0
    def __init__(self,
                 script,
                 schid,
                 clid,
                 uid,
                 name,
                 ip,
                 mytsid,
                 hwid,
                 servertype,
                 parent=None):
        try:
            super(QDialog, self).__init__(parent)
            setupUi(self, "%s/ban.ui" % script.path)
            try:
                icons = IconPack.current()
                icons.open()
                self.icon_warning = QIcon(icons.icon("WARNING"))
            except:
                pass
            self.setAttribute(Qt.WA_DeleteOnClose)
            self.cfg = script.cfg
            self.ini = script.ini
            self.schid = schid
            self.templates = script.templates
            self.whitelist = script.whitelist
            self.prefix = script.prefix
            self.suffix = script.suffix
            self.name = script.name
            if script.cfg.getboolean("last", "expanded"):
                self.disableReasons(True)
            height = script.cfg.get("last", "height")
            if height: self.resize(self.width, int(height))
            else: self.disableReasons()
            alt = script.cfg.getboolean("last", "alternate")
            if alt: self.chk_alternate.setChecked(True)
            dblclick = script.cfg.getboolean("last", "ban on doubleclick")
            if dblclick: self.chk_doubleclick.setChecked(True)
            for reason in script.templates:
                self.lst_reasons.addItem(reason)
                self.box_reason.addItem(reason)
            self.box_reason.setEditText(script.cfg.get(
                "last", "reason"))  # setItemText(0, )
            """
            ipREX = QRegExp("[\w+\/]{27}=")
            ipREX.setCaseSensitivity(Qt.CaseInsensitive)
            ipREX.setPatternSyntax(QRegExp.RegExp)

            regValidator = QRegExpValidator(ipREX,0)
            self.txt_ip.setValidator(regValidator)
            """
            # self.txt_ip.setInputMask( "000.000.000.000" )

            self.setup(script, schid, clid, uid, name, ip, mytsid, hwid,
                       servertype)
        except:
            ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                              "pyTSon", 0)
Example #14
0
    def __init__(self, localfile, remotefile, isdownload, multi, parent=None):
        """
        Instantiates a new dialog.
        @param localfile: the path to the local file
        @type localfile: str
        @param remotefile: the remote file
        @type remotefile: File
        @param isdownload: set to True if remotefile should be downloaded
        @type isdownload: bool
        @param multi: set to True, if there are multiple files which could
        collide
        @type multi: bool
        @param parent: parent widget of the dialog; optional; defaults to None
        @type parent: QWidget
        """
        super(QDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        try:
            setupUi(self, pytson.getPluginPath("ressources",
                                               "filecollision.ui"))
        except Exception as e:
            self.delete()
            raise e

        if not multi:
            self.multiButton.setVisible(False)
            self.skipallButton.setVisible(False)

        locsize = os.path.getsize(localfile)
        if locsize == remotefile.size:
            self.resumeButton.hide()

            self.actionLabel.text = self._tr("Do you want to overwrite the "
                                             "existing file")
        else:
            self.actionLabel.text = self._tr("Do you want to overwrite or "
                                             "resume the existing file")

        self.filenameLabel.text = "<b>%s</b>" % remotefile.name

        datefmt = pytson.tr("filetransfer", "%Y-%m-%d %H:%M:%S")
        locdate = datetime.fromtimestamp(os.path.getmtime(localfile))
        filefmt = "Size: <b>%s</b><br />Date: <b>%s</b>"

        locstr = filefmt % (bytesToStr(locsize), locdate.strftime(datefmt))
        remstr = filefmt % (bytesToStr(
            remotefile.size), remotefile.datetime.strftime(datefmt))

        if isdownload:
            self.existingLabel.text = locstr
            self.newLabel.text = remstr
        else:
            self.existingLabel.text = remstr
            self.newLabel.text = locstr

        self.adjustSize()
Example #15
0
 def __init__(self, purgeContacts, parent=None):
     try:
         super(QDialog, self).__init__(parent)
         setupUi(self, path.join(purgeContacts.scriptpath, "calendar.ui"))
         self.setAttribute(Qt.WA_DeleteOnClose)
         # self.box_type.connect("currentIndexChanged(QString text)", self.box_type_currentIndexChanged)
         # self.buttonBox.connect("accepted()", self.accepted)
         self.purgeContacts = purgeContacts
     except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #16
0
    def __init__(self, localfile, remotefile, isdownload, multi, parent=None):
        """
        Instantiates a new dialog.
        @param localfile: the path to the local file
        @type localfile: str
        @param remotefile: the remote file
        @type remotefile: File
        @param isdownload: set to True if remotefile should be downloaded
        @type isdownload: bool
        @param multi: set to True, if there are multiple files which could
        collide
        @type multi: bool
        @param parent: parent widget of the dialog; optional; defaults to None
        @type parent: QWidget
        """
        super(QDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        try:
            setupUi(self, pytson.getPluginPath("ressources",
                                               "filecollision.ui"))
        except Exception as e:
            self.delete()
            raise e

        if not multi:
            self.multiButton.setVisible(False)
            self.skipallButton.setVisible(False)

        locsize = os.path.getsize(localfile)
        if locsize == remotefile.size:
            self.resumeButton.hide()

            self.actionLabel.text = self._tr("Do you want to overwrite the "
                                             "existing file")
        else:
            self.actionLabel.text = self._tr("Do you want to overwrite or "
                                             "resume the existing file")

        self.filenameLabel.text = "<b>%s</b>" % remotefile.name

        datefmt = pytson.tr("filetransfer", "%Y-%m-%d %H:%M:%S")
        locdate = datetime.fromtimestamp(os.path.getmtime(localfile))
        filefmt = "Size: <b>%s</b><br />Date: <b>%s</b>"

        locstr = filefmt % (bytesToStr(locsize), locdate.strftime(datefmt))
        remstr = filefmt % (bytesToStr(remotefile.size),
                            remotefile.datetime.strftime(datefmt))

        if isdownload:
            self.existingLabel.text = locstr
            self.newLabel.text = remstr
        else:
            self.existingLabel.text = remstr
            self.newLabel.text = locstr

        self.adjustSize()
Example #17
0
 def __init__(self, channelGroupManager, schid, cid, parent=None):
     try:
         super(QWidget, self).__init__(parent)
         setupUi(self, channelGroupManager.ui)
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setup(channelGroupManager, schid, cid)
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Example #18
0
    def __init__(self, parent):
        super(QDialog, self).__init__(parent)
        setupUi(
            self,
            os.path.join(ts3.getPluginPath(), "pyTSon", "ressources",
                         "report.ui"), self.CONF_WIDGETS)
        self.setupList()

        self.reasons.connect(
            "currentItemChanged(QListWidgetItem*, QListWidgetItem*)",
            self.onReasonListCurrentItemChanged)
 def __init__(self, tutorial, parent=None):
     super(QDialog, self).__init__(parent)
     # path to .ui-file
     setupUi(
         self,
         os.path.join(getPluginPath(), "pyTSon", "scripts", "tutorial",
                      "dialog.ui"))
     self.setWindowTitle("Tutorial")
     # connect a function to the submit button
     # btn_submit cause we named the button like that in Qt Creator
     self.btn_submit.clicked.connect(self.action)
Example #20
0
 def __init__(self, customBadges, parent=None):
     super(QWidget, self).__init__(parent)
     self.listen = False
     setupUi(self, customBadges.ui)
     self.cfg = customBadges.cfg
     self.badges = customBadges.badges
     self.setCustomBadges = customBadges.setCustomBadges
     self.setAttribute(Qt.WA_DeleteOnClose)
     self.setWindowTitle("Customize Badges")
     self.setupList()
     self.listen = True
Example #21
0
 def __init__(self, info, schid, atype, selectedItemID, parent=None):
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         os.path.join(ts3lib.getPluginPath(), "pyTSon", "scripts", "info",
                      "variables.ui"))
     self.setAttribute(Qt.WA_DeleteOnClose)
     self.info = info
     self.schid = schid
     self.atype = atype
     self.selectedItemID = selectedItemID
     self.setupTable()
Example #22
0
 def __init__(self, script, parent=None):
     try:
         super(QDialog, self).__init__(parent)
         setupUi(self, script.ui)
         self.cfg = script.cfg
         self.ini = script.ini
         self.reloadPlugin = script.__init__
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle("Count Contacts Filters")
         self.setupTable()
         self.listen = True
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Example #23
0
 def __init__(self, countNick, parent=None):
     try:
         self.countNick = countNick
         super(QDialog, self).__init__(parent)
         setupUi(
             self,
             path.join(pytson.getPluginPath(), "scripts",
                       countNick.__name__, "dialog.ui"))
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle(countNick.Name)
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Example #24
0
 def __init__(self, Class, parent=None):
     self.dynamicAvatar = Class
     super(QDialog, self).__init__(parent)
     setupUi(
         self,
         path.join(getPluginPath(), "scripts", "dynamicAvatar",
                   "settings.ui"))
     s = Class.config["GENERAL"]
     b = self.buhl
     self.url.setChecked(s["mode"] == "url")
     self.path.setChecked(s["mode"] == "path")
     self.imgurl.setText(s["imgurl"])
     self.imgpath.setText(s["imgpath"])
     self.debug.setChecked(b(s["debug"]))
     self.refresh.setValue(int(s["refresh"]))
Example #25
0
 def __init__(self, customBadges, parent=None):
     try:
         super(QWidget, self).__init__(parent)
         setupUi(self, customBadges.ui)
         self.cfg = customBadges.cfg
         self.ini = customBadges.ini
         self.icons = customBadges.icons
         self.badges = customBadges.badges
         self.extbadges = customBadges.extbadges
         self.setCustomBadges = customBadges.setCustomBadges
         self.reloadPlugin = customBadges.__init__
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle("Customize Badges")
         self.setupList()
         self.listen = True
     except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #26
0
 def __init__(self, serverBrowser, parent=None):
     self.serverBrowser = serverBrowser
     super(QDialog, self).__init__(parent)
     self.setAttribute(Qt.WA_DeleteOnClose)
     setupUi(
         self,
         os.path.join(ts3.getPluginPath(), "pyTSon", "scripts",
                      "serverBrowser", "ui", "servers.ui"))
     self.setWindowTitle("PlanetTeamspeak Server Browser")
     self.flags = CountryFlags()
     self.flags.open()
     self.icons = IconPack.current()
     self.icons.open()
     #ts3.printMessageToCurrentTab("Countries: "+str(self.countries))
     #try:
     #self.serverList.doubleClicked.connect(self.table_doubleclicked)
     #self.serverList.connect("doubleClicked()", self.table_doubleclicked)
     #self.apply.connect("clicked()", self.on_apply_clicked)
     #self.reload.connect("clicked()", self.on_reload_clicked)
     #except:
     #ts3.logMessage(traceback.format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "PyTSon", 0)
     #self.ReasonList.connect("currentItemChanged(QListWidgetItem*, QListWidgetItem*)", self.onReasonListCurrentItemChanged)
     #self.ReasonList.connect("itemChanged(QListWidgetItem*)", self.onReasonListItemChanged)
     # self.serverList.setVisible(False)
     self.serverList.horizontalHeader().setStretchLastSection(True)
     self.serverList.setColumnWidth(0, 350)
     # self.serverList.setColumnWidth(5, 0)
     self.serverList.setColumnHidden(5, True)
     self.serverNameModifier.addItems(self.NAME_MODIFIERS)
     self.serverNameModifier.setEnabled(False)
     #self.pageLabel.mousePressEvent = self.on_pageLabel_clicked
     #self.cfg.set("general", "differentApi", "True" if state == Qt.Checked else "False")
     self.listCountries(True)
     #ReportDialog.ReasonList.clear()
     self.setupFilters()
     # self.serverList.doubleClicked.connect(self.on_serverList_doubleClicked)
     # self.serverList.cellClicked.connect(self.cell_was_clicked)
     #ts3.printMessageToCurrentTab(str(serverBrowser.filters))
     #if serverBrowser.filters.filterServerName != "":
     #self.filterServerName.setText(serverBrowser.filters.filterServerName)
     #item.setFlags(item.flags() &~ Qt.ItemIsEditable)
     # self.countryBox.clear()
     #for item in countries:
     #self.countryBox.addItem(str(item[1]))
     #self.serverList.setStretchLastSection(true)
     self.listServers()
Example #27
0
    def __init__(self, schid, cid, password, parent=None):
        super(QDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        try:
            setupUi(self, pytson.getPluginPath("ressources",
                                               "filetransfer.ui"))

            self.delegate = FileTransferDelegate(self)
            self.table.setItemDelegate(self.delegate)

            self.model = FileTransferModel(schid, cid, password, self)
            self.table.setModel(self.model)
        except Exception as e:
            self.delete()
            raise e

        self.resize(770, 250)
Example #28
0
    def __init__(self, schid, cid, password, parent=None):
        super(QDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        try:
            setupUi(self, pytson.getPluginPath("ressources",
                                               "filetransfer.ui"))

            self.delegate = FileTransferDelegate(self)
            self.table.setItemDelegate(self.delegate)

            self.model = FileTransferModel(schid, cid, password, self)
            self.table.setModel(self.model)
        except Exception as e:
            self.delete()
            raise e

        self.resize(770, 250)
Example #29
0
 def __init__(self, arg, parent=None):
     super(QDialog, self).__init__(parent)
     setupUi(self, os.path.join(ts3.getPluginPath(), "pyTSon", "scripts", "devTools", "editor.ui"))
     self.resize(1000, 900)
     self.setWindowTitle('Teamspeak Stylesheet Editor : : Developer Tools')
     self.stylesheet = QApplication.instance().styleSheet
     self.chatsheet = self.getWidgetByObjectName("ChatTab").findChild(QTextDocument).defaultStyleSheet
     self.html = self.getWidgetByObjectName("InfoFrame").html
     self.qssEditor.setPlainText(self.stylesheet)
     self.chatEditor.setPlainText(self.chatsheet)
     self.tplEditor.setPlainText(self.html)
     self.chatEditor.setReadOnly(True);self.tplEditor.setReadOnly(True)
     index = self.tabWidget.currentIndex
     if index == 0:
         self.btn_apply.setEnabled(True);self.btn_minify.setEnabled(True);self.btn_insert.setEnabled(True);self.btn_reset.setEnabled(True);self.chk_live.setEnabled(True)
     elif index == 1:
         self.btn_apply.setEnabled(False);self.btn_minify.setEnabled(True);self.btn_insert.setEnabled(False);self.btn_reset.setEnabled(False);self.chk_live.setEnabled(False)
     else:
         self.btn_apply.setEnabled(False);self.btn_minify.setEnabled(False);self.btn_insert.setEnabled(False);self.btn_reset.setEnabled(False);self.chk_live.setEnabled(False)
     self.lastSave = None
Example #30
0
 def __init__(self, this, parent=None):
     try:
         self.this = this
         super(QDialog, self).__init__(parent)
         setupUi(
             self,
             path.join(ts3.getPluginPath(), "pyTSon", "scripts",
                       "ISPValidator", "settings.ui"))
         self.setWindowTitle("%s Settings" % this.name)
         self.chk_debug.setChecked(this.cfg.getboolean("general", "debug"))
         if this.cfg.getboolean("general", "whitelist"):
             self.chk_whitelist.setChecked(True)
         else:
             self.chk_blacklist.setChecked(True)
         if this.cfg.getboolean("main", "kickonly"):
             self.chk_kick.setChecked(True)
         else:
             self.chk_ban.setChecked(True)
         if this.cfg.getboolean("failover", "kickonly"):
             self.chk_kick_2.setChecked(True)
         else:
             self.chk_ban_2.setChecked(True)
         self.bantime.setValue(int(this.cfg["main"]["bantime"]))
         self.bantime_2.setValue(int(this.cfg["failover"]["bantime"]))
         self.reason.setText(this.cfg["main"]["reason"])
         self.reason_2.setText(this.cfg["failover"]["reason"])
         self.api_main.setText(this.cfg["api"]["main"])
         self.api_fallback.setText(this.cfg["api"]["fallback"])
         if this.cfg.getboolean("failover", "enabled"):
             self.chk_failover.setChecked(True)
         for event, value in this.cfg["events"].items():
             _item = QListWidgetItem(self.lst_events)
             _item.setToolTip(value)
             _item.setText(event.title())
             if value == "True": _item.setCheckState(Qt.Checked)
             else: _item.setCheckState(Qt.Unchecked)
     except:
         ts3.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                        "PyTSon", 0)
Example #31
0
 def __init__(self, ini, cfg, cmdini, cmd, parent=None):
     try:
         self.ini = ini
         self.cfg = cfg
         self.cmdini = cmdini
         self.cmd = cmd
         super(QDialog, self).__init__(parent)
         self.setAttribute(Qt.WA_DeleteOnClose)
         setupUi(self, path.join(getPluginPath(), "scripts", "chatBot", "settings.ui"))
         self.setWindowTitle("Chat Bot Settings")
         # header = self.tbl_commands.horizontalHeader()
         # header.setResizeMode(0, QtGui.QHeaderView.ResizeToContents)
         # header.setResizeMode(1, QtGui.QHeaderView.Stretch)
         # header.setResizeMode(2, QtGui.QHeaderView.Stretch)
         # self.tbl_commands.setColumnWidth(0, 25)
         self.chk_enabled.setChecked(cfg.getboolean("general", "enabled"))
         self.chk_debug.setChecked(cfg.getboolean("general", "debug"))
         self.chk_unknowncmd.setChecked(cfg.getboolean("general", "unknowncmd"))
         self.chk_disabledcmd.setChecked(cfg.getboolean("general", "disabledcmd"))
         self.grp_prefix.setChecked(cfg.getboolean("general", "customprefix"))
         self.txt_prefix.setText(cfg.get("general", "prefix"))
         self.loadCommands()
     except: from traceback import format_exc;ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Example #32
0
 def __init__(self, rotateNick, parent=None):
     try:
         self.rotateNick = rotateNick
         super(QDialog, self).__init__(parent)
         setupUi(
             self,
             path.join(pytson.getPluginPath(), "scripts",
                       rotateNick.__class__.__name__, "dialog.ui"))
         self.setAttribute(Qt.WA_DeleteOnClose)
         self.setWindowTitle(rotateNick.name)
         self.nick.setText(self.rotateNick.config.get('general', 'nick'))
         self.separator.setText(self.rotateNick.separator())
         customNick = boolean(
             self.rotateNick.config.get('general', 'customNick'))
         self.currentNick.setChecked(not customNick)
         self.customNick.setChecked(customNick)
         self.nick.setEnabled(customNick)
         self.interval.value = int(
             self.rotateNick.config.get('general', 'interval'))
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Example #33
0
    def __init__(self, schid, cid, password='', path='/', parent=None, *,
                 staticpath=False, readonly=False, downloaddir=None,
                 iconpack=None):
        """
        Instantiates a new object.
        @param schid: the id of the serverconnection handler
        @type schid: int
        @param cid: the id of the channel
        @type cid: int
        @param password: password to the channel, defaults to an empty string
        @type password: str
        @param path: path to display, defaults to the root path
        @type path: str
        @param parent: parent of the dialog; optional keyword arg;
        defaults to None
        @type parent: QWidget
        @param staticpath: if set to True, the initial path can't be
        changed by the user; optional keyword arg; defaults to False
        @type staticpath: bool
        @param readonly: if set to True, the user can't download, upload
        or delete files, or create new directories; optional keyword arg;
        defaults to False
        @type readonly: bool
        @param downloaddir: directory to download files to; optional keyword
        arg; defaults to None; if set to None, the TS3 client's download
        directory is used
        @type downloaddir: str
        @param iconpack: iconpack to load icons from; optional keyword arg;
        defaults to None; if set to None, the current iconpack is used
        @type iconpack: ts3client.IconPack
        """
        super(QDialog, self).__init__(parent)
        self.setAttribute(Qt.WA_DeleteOnClose)

        iconpackopened = False
        if not iconpack:
            try:
                iconpack = ts3client.IconPack.current()
                iconpack.open()
                iconpackopened = True
            except Exception as e:
                self.delete()
                raise e

        try:
            setupUi(self, pytson.getPluginPath("ressources", "filebrowser.ui"),
                    iconpack=iconpack)

            self.statusbar = SmartStatusBar(self)
            self.layout().addWidget(self.statusbar)
            self.statusbar.hide()
        except Exception as e:
            self.delete()
            raise e

        err, cname = ts3lib.getChannelVariableAsString(schid, cid,
                                                       ChannelProperties.
                                                       CHANNEL_NAME)

        if err == ERROR_ok:
            self.setWindowTitle(self._tr("File Browser - {cname}").format(
                                cname=cname))
        else:
            self.setWindowTitle(self._tr("File Browser"))

        self.schid = schid
        self.cid = cid
        self.password = password
        self.path = None

        self.staticpath = staticpath
        self.readonly = readonly

        self.createretcode = None
        self.delretcode = None

        if not self.readonly and not downloaddir:
            cfg = ts3client.Config()
            q = cfg.query("SELECT value FROM filetransfer "
                          "WHERE key='DownloadDir'")
            del cfg

            if q.next():
                self.downloaddir = q.value("value")
            else:
                self.delete()
                raise Exception("Error getting DownloadDir from config")
        else:
            self.downloaddir = downloaddir

        if not self.readonly:
            menu = self.menu = QMenu(self)

            self.openAction = menu.addAction(QIcon(iconpack.icon("FILE_UP")),
                                             self._tr("Open"))
            self.openAction.connect("triggered()",
                                    self.on_openAction_triggered)

            self.downAction = menu.addAction(QIcon(iconpack.icon("DOWN")),
                                             self._tr("Download"))
            self.downAction.connect("triggered()", self.downloadFiles)
            self.renameAction = menu.addAction(QIcon(iconpack.icon("EDIT")),
                                               self._tr("Rename"))
            self.renameAction.connect("triggered()",
                                      self.on_renameAction_triggered)
            self.copyAction = menu.addAction(QIcon(iconpack.icon("COPY")),
                                             self._tr("Copy URL"))
            self.copyAction.connect("triggered()",
                                    self.on_copyAction_triggered)
            self.delAction = menu.addAction(QIcon(iconpack.icon("DELETE")),
                                            self._tr("Delete"))
            self.delAction.connect("triggered()", self.deleteFiles)

            self.upAction = menu.addAction(QIcon(iconpack.icon("UP")),
                                           self._tr("Upload files"))
            self.upAction.connect("triggered()", self.uploadFiles)
            self.createAction = menu.addAction(QIcon.fromTheme("folder"),
                                               self._tr("Create Folder"))
            self.createAction.connect("triggered()", self.createFolder)
            self.refreshAction = menu.addAction(QIcon(iconpack.icon(
                                                "FILE_REFRESH")),
                                                self._tr("Refresh"))
            self.refreshAction.connect("triggered()", self.refresh)

            self.allactions = [self.openAction, self.downAction,
                               self.renameAction, self.copyAction,
                               self.delAction, self.upAction,
                               self.createAction, self.refreshAction]

        self.collector = FileCollector(schid, cid, password, self.downloaddir)
        self.collector.collectionFinished.connect(self._startDownload)
        self.collector.collectionError.connect(self.showError)

        self.fileDoubleClicked = Signal()
        self.contextMenuRequested = Signal()

        self.transdlg = None

        self.listmodel = FileListModel(schid, cid, password, self,
                                       readonly=readonly)
        self.listmodel.pathChanged.connect(self.onPathChanged)
        self.listmodel.error.connect(self.showError)

        self.proxy = QSortFilterProxyModel(self)
        self.proxy.setSortRole(Qt.UserRole)
        self.proxy.setSortCaseSensitivity(Qt.CaseInsensitive)
        self.proxy.setFilterCaseSensitivity(Qt.CaseInsensitive)
        self.proxy.setSourceModel(self.listmodel)

        self.listmodel.path = path

        self._adjustUi()

        if iconpackopened:
            iconpack.close()

        PluginHost.registerCallbackProxy(self)
Example #34
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())