예제 #1
0
def confirm(title, message):
    """
    :param title:
    :param message:
    :return:
    """
    x = QWidget()
    x.setAttribute(Qt.WA_DeleteOnClose)
    _x = QMessageBox.question(x, title, message, QMessageBox.Yes, QMessageBox.No)
    if _x == QMessageBox.Yes: return True if _x == QMessageBox.Yes else False
예제 #2
0
def inputBox(parent, title, text, default=""):
    """
    :param default:
    :param title:
    :param text:
    :return:
    """
    x = QWidget(parent)
    x.setAttribute(Qt.WA_DeleteOnClose)
    ok = BoolResult()
    text = QInputDialog.getText(x, title, text, QLineEdit.Normal, default, ok)
    if ok: return text
    else: return False
예제 #3
0
def inputBox(title, text, default=""):
    """
    :param default:
    :param title:
    :param text:
    :return:
    """
    x = QWidget()
    x.setAttribute(Qt.WA_DeleteOnClose)
    ok = BoolResult()
    if not default: default = QApplication.clipboard().text()
    text = QInputDialog.getText(x, title, text, QLineEdit.Normal, default, ok) # QDir.Home.dirName()
    if ok: return text
    else: return False
예제 #4
0
 def onMenuItemEvent(self, schid, atype, menuItemID, channel):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_CHANNEL and menuItemID == 0:
         try:
             x = QWidget()
             x.setAttribute(Qt.WA_DeleteOnClose)
             password = QInputDialog.getText(x, "Enter Channel Password",
                                             "Password:"******"clients: {0}".format(clients))
             (error, maxclients) = ts3lib.getChannelVariableAsUInt64(
                 schid, channel,
                 ts3defines.ChannelProperties.CHANNEL_MAXCLIENTS)
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "error: {0} | maxclients: {1}".format(
                         error, maxclients))
             (error, maxfamilyclients) = ts3lib.getChannelVariableAsUInt64(
                 schid, channel,
                 ts3defines.ChannelProperties.CHANNEL_MAXFAMILYCLIENTS)
             if self.debug:
                 ts3lib.printMessageToCurrentTab(
                     "error: {0} | maxfamilyclients: {1}".format(
                         error, maxfamilyclients))
             if clients < maxclients and clients < maxfamilyclients:
                 (error, ownID) = ts3lib.getClientID(schid)
                 ts3lib.requestClientMove(schid, ownID, channel, password)
                 return True
             (error, name) = ts3lib.getChannelVariableAsString(
                 schid, channel, ts3defines.ChannelProperties.CHANNEL_NAME)
             self.schid = schid
             self.channel = channel
             self.password = password
             self.cname = name
             if password == "":
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url]. [color=red]{2}[/color] client(s) remaining."
                     .format(channel, name, maxclients - clients + 1))
             else:
                 ts3lib.printMessageToCurrentTab(
                     "Queued for channel [url=channelid://{0}]{1}[/url] with password \"{2}\". [color=red]{3}[/color] client(s) remaining."
                     .format(channel, name, password,
                             maxclients - clients + 1))
         except:
             from traceback import format_exc
             ts3lib.logMessage(format_exc(),
                               ts3defines.LogLevel.LogLevel_ERROR, "pyTSon",
                               0)
예제 #5
0
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
예제 #6
0
 def on_serverList_doubleClicked(self):
     try:
         row = self.serverList.selectedItems()[0].row()
         name = self.serverList.item(row, 0).text()
         ip = self.serverList.item(row, 5).text()
         haspw = True if self.serverList.item(row,
                                              4).text() == "Yes" else False
         if haspw:
             x = QWidget()
             x.setAttribute(Qt.WA_DeleteOnClose)
             password = QInputDialog.getText(x, "Enter Server Password",
                                             "Password:"******"": return
         err, tab = ts3.guiConnect(
             ts3defines.PluginConnectTab.
             PLUGIN_CONNECT_TAB_NEW_IF_CURRENT_CONNECTED, name, ip,
             password if haspw else "", "TeamspeakUser", "", "", "", "", "",
             "", "", "", "")
         # print('item: {0} | row: {1} | item2: {2} |item2_column: {3} | text: {4}'.format(item, row, item2, item2.column(), item2.text()))
         # item.
         # item.setData(Qt.UserRole, 22);
     except:
         print(traceback.format_exc())
예제 #7
0
def inputBox(title, text):
    x = QWidget()
    x.setAttribute(Qt.WA_DeleteOnClose)
    return QInputDialog.getText(x, title, text)