Ejemplo n.º 1
0
 def setupTable(self):
     try:
         self.tbl_members.clearContents()
         self.tbl_members.setRowCount(0)
         cache = ts3client.ServerCache(self.schid)
         (err, suid) = ts3lib.getServerVariable(self.schid, ts3defines.VirtualServerProperties.VIRTUALSERVER_UNIQUE_IDENTIFIER)
         q = self.execSQL("SELECT * FROM '{}|{}'".format(suid, self.cid))
         while q.next():
             pos = self.tbl_members.rowCount
             if PluginHost.cfg.getboolean("general", "verbose"): print(pos)
             self.tbl_members.insertRow(pos)
             self.tbl_members.setItem(pos, 0, QTableWidgetItem(datetime.utcfromtimestamp(q.value("timestamp")).strftime('%Y-%m-%d %H:%M:%S')))
             self.tbl_members.setItem(pos, 1, QTableWidgetItem(q.value("name")))
             self.tbl_members.setItem(pos, 2, QTableWidgetItem(q.value("uid")))
             self.tbl_members.setItem(pos, 3, QTableWidgetItem(str(q.value("dbid"))))
             box = QComboBox()
             box.connect("currentIndexChanged(int index)", self.currentIndexChanged)
             i = 0
             for cgroup in self.cgroups:
                 icon = QIcon(cache.icon(self.cgroups[cgroup]["icon"]))
                 text = "{} ({})".format(self.cgroups[cgroup]["name"], cgroup)
                 box.addItem(icon, text)
                 box.setItemData(i, cgroup)
                 if cgroup == q.value("cgid"): box.setCurrentIndex(i)
                 i += 1
             self.tbl_members.setCellWidget(pos, 4, box)
             self.tbl_members.setItem(pos, 5, QTableWidgetItem("{} ({})".format(q.value("invokername"), q.value("INVOKERUID"))))
     except: ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)
Ejemplo n.º 2
0
 def setupTable(self):
     try:
         self.tbl_filters.clearContents()
         self.tbl_filters.setRowCount(0)
         for o in self.cfg.options('filters'):
             pos = self.tbl_filters.rowCount
             self.tbl_filters.insertRow(pos)
             tmp = self.cfg.get('filters', o).split('|', 2)
             chk_case = QCheckBox()
             chk_case.setChecked(bool(int(tmp[0])))
             self.tbl_filters.setCellWidget(pos, 0, chk_case)
             box_type = QComboBox()
             box_type.addItems(["Prefix", "Suffix", "Contains", "Equals"])
             box_type.connect("currentIndexChanged(int)",
                              self.currentIndexChanged)
             box_type.setCurrentText(tmp[1])
             self.tbl_filters.setCellWidget(pos, 1, box_type)
             self.tbl_filters.setItem(pos, 2, QTableWidgetItem(o))
             self.tbl_filters.setItem(pos, 3, QTableWidgetItem(tmp[2]))
     except:
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)