Beispiel #1
0
 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()
Beispiel #2
0
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
Beispiel #3
0
 def confirm(self, title, message):
     x = QDialog()
     x.setAttribute(Qt.WA_DeleteOnClose)
     _t = QMessageBox.question(x, title, message, QMessageBox.Yes,
                               QMessageBox.No)
     if _t == QMessageBox.Yes: return True
     else: return False
Beispiel #4
0
 def getText(self,
             multimsg=True,
             multiline=False,
             title="Enter text here",
             text="",
             max=1024):
     try:
         x = QDialog()
         x.setAttribute(Qt.WA_DeleteOnClose)
         if multiline:
             clipboard = QApplication.clipboard().text()
             _message = QInputDialog.getMultiLineText(
                 x, title, text, clipboard)
         else:
             _message = QInputDialog.getText(x, title, text,
                                             QLineEdit.Normal, "", self.ok)
         if multimsg:
             return [
                 _message[i:i + max] for i in range(0, len(_message), max)
             ]
         else:
             return _message[:max]
     except:
         from traceback import format_exc
         ts3lib.logMessage(format_exc(), ts3defines.LogLevel.LogLevel_ERROR,
                           "pyTSon", 0)
Beispiel #5
0
 def updateReply(self, reply):
     version = loads(reply.readAll().data().decode('utf-8'))["version"]
     if version != self.version:
         x = QDialog()
         x.setAttribute(Qt.WA_DeleteOnClose)
         _x = QMessageBox.question(
             x, "{} v{} by {}".format(self.name, self.version, self.author),
             "Noua versiune v{} la linksteam a fost gasita, dai update acum?"
             .format(version), QMessageBox.Yes, QMessageBox.No)
         if _x == QMessageBox.Yes:
             QDesktopServices.openUrl(QUrl(self.repourl))
Beispiel #6
0
def confirm(title, message):
    """

    :param title:
    :param message:
    :return:
    """
    x = QDialog()
    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
Beispiel #7
0
def inputBox(title, text, default=""):
    """

    :param default:
    :param title:
    :param text:
    :return:
    """
    x = QDialog()
    x.setAttribute(Qt.WA_DeleteOnClose)
    ok = BoolResult()
    # if default is None: default = QApplication.clipboard().text()
    text = QInputDialog.getText(x, title, text, QLineEdit.Normal, default,
                                ok)  # QDir.Home.dirName()
    if ok: return text
    else: return False
Beispiel #8
0
def inputBox(title, text):
    x = QDialog()
    x.setAttribute(Qt.WA_DeleteOnClose)
    (text, ok) = QInputDialog.getText(x, title, text)
    if ok: return text
    else: return False
Beispiel #9
0
def inputBox(title, text):
    x = QDialog()
    x.setAttribute(Qt.WA_DeleteOnClose)
    return QInputDialog.getText(x, title, text)