def inputInt(title="", label="", val=0, min=-2147483647, max=2147483647, step=1): x = QDialog() x.setAttribute(Qt.WA_DeleteOnClose) ok = BoolResult() i = QInputDialog.getInt(x, title, label, val, min, max, step, ok) if ok: return i else: return False
def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID): if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL: if menuItemID == 0: self.channel = selectedItemID ts3lib.printMessageToCurrentTab('[{:%Y-%m-%d %H:%M:%S}] '.format(datetime.now())+" Set target channel to [color=yellow]"+str(self.channel)+"[/color]") elif menuItemID == 1: (e, cgid) = ts3lib.getServerVariableAsUInt64(schid, ts3defines.VirtualServerPropertiesRare.VIRTUALSERVER_DEFAULT_CHANNEL_GROUP) x = QDialog() x.setAttribute(Qt.WA_DeleteOnClose) dbid = QInputDialog.getInt(x, "Manually change channel group", "Enter DBID", QLineEdit.Normal) if self.channel == 0: (e, ownID) = ts3lib.getClientID(schid) (e, self.channel) = ts3lib.getChannelOfClient(schid, ownID) name = "DBID: %s"%dbid if self.debug: ts3lib.printMessageToCurrentTab("toggle: {0} | debug: {1} | channel: {2} | groups: {3} | dbid: {4} | name: {5}".format(self.toggle,self.debug,self.channel,self.groups,dbid,name)) ts3lib.printMessageToCurrentTab("schid: {0} | cgid: {1} | dbid: {2}".format(schid,cgid,dbid)) if not self.dlg: self.dlg = ChannelGroupDialog(schid, cgid, dbid, name, self.channel, self.groups) self.dlg.show();self.dlg.raise_();self.dlg.activateWindow() elif atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CLIENT: if menuItemID == 0: if self.channel == 0: (e, ownID) = ts3lib.getClientID(schid) (e, self.channel) = ts3lib.getChannelOfClient(schid, ownID) (e, dbid) = ts3lib.getClientVariableAsUInt64(schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_DATABASE_ID) (e, cgid) = ts3lib.getClientVariableAsUInt64(schid, selectedItemID, ts3defines.ClientPropertiesRare.CLIENT_CHANNEL_GROUP_ID) (e, name) = ts3lib.getClientVariableAsString(schid, selectedItemID, ts3defines.ClientProperties.CLIENT_NICKNAME) if self.debug: ts3lib.printMessageToCurrentTab("toggle: {0} | debug: {1} | channel: {2} | groups: {3} | dbid: {4} | name: {5}".format(self.toggle,self.debug,self.channel,self.groups,dbid,name)) if not self.dlg: self.dlg = ChannelGroupDialog(schid, cgid, dbid, name, self.channel, self.groups) self.dlg.show();self.dlg.raise_();self.dlg.activateWindow()
def inputInt(title="", label="", val=0, min=-2147483647, max=2147483647, step=1): """ :param title: :param label: :param val: :param min: :param max: :param step: :return: """ x = QWidget() x.setAttribute(Qt.WA_DeleteOnClose) ok = BoolResult() i = QInputDialog.getInt(x, title, label, val, min, max, step, ok) if ok: return i else: return False
def on_pageLabel_clicked(self, event): try: page = QInputDialog.getInt(self, "Goto Page", "Page:") if page > 0: if self.cooldown_page: self.status.setText("You have to wait "+str(self.cooldown_time_page/1000)+" second(s) before switching pages!") palette = QPalette() palette.setColor(QPalette.Foreground,Qt.red) self.status.setPalette(palette) return self.page = page self.listServers() if not self.cooldown: self.cooldown_page = True self.previous.setEnabled(False) self.next.setEnabled(False) QTimer.singleShot(self.cooldown_time_page, self.disable_cooldown_page) except: ts3.logMessage(traceback.format_exc(), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon", 0)