예제 #1
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)
예제 #2
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             error, ownid = ts3.getClientID(schid)
             if error == ERROR_ok:
                 error, meta = ts3.getClientVariableAsString(schid, ownid, ClientProperties.CLIENT_META_DATA)
                 if error == ERROR_ok:
                     x = QWidget()
                     _meta = QInputDialog.getMultiLineText(x, "Change own Meta Data", "Meta Data:", meta)
                     if _meta == meta: return
                     error = ts3.setClientSelfVariableAsString(schid, ClientProperties.CLIENT_META_DATA, _meta)
                     if not error == ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error #%s"%error, "Unable to set own meta data!");_t.show()
         elif menuItemID == 1:
             error, ownid = ts3.getClientID(schid)
             if error == ERROR_ok:
                 error, flag = ts3.getClientVariableAsString(schid, ownid, ClientPropertiesRare.CLIENT_FLAG_AVATAR)
                 ts3.printMessageToCurrentTab("Your current avatar flag is: %s"%flag)
                 if error == ERROR_ok:
                     x = QWidget()
                     _flag = QInputDialog.getText(x, "Change own Avatar Flag", "Avatar File MD5:")
                     if _flag == "x" or _flag.strip() == flag.strip(): return
                     error = ts3.setClientSelfVariableAsString(schid, ClientPropertiesRare.CLIENT_FLAG_AVATAR, _flag)
                     error2 = ts3.flushClientSelfUpdates(schid)
                     if not error == ERROR_ok or not error2 == ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error", "Unable to set own avatar flag!");_t.show()
예제 #3
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             schid = ts3.getCurrentServerConnectionHandlerID()
             error, ownid = ts3.getClientID(schid)
             if error == ts3defines.ERROR_ok:
                 error, meta = ts3.getClientVariableAsString(schid, ownid, ts3defines.ClientProperties.CLIENT_META_DATA)
                 if error == ts3defines.ERROR_ok:
                     x = QWidget()
                     meta = QInputDialog.getMultiLineText(x, "Change own Meta Data", "Meta Data:", meta)
                     error = ts3.setClientSelfVariableAsString(schid, ts3defines.ClientProperties.CLIENT_META_DATA, meta)
                     if not error == ts3defines.ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error", "Unable to set own meta data!");t.show()
예제 #4
0
 def sendMessage(self, schid, targetMode, toID):
     x = QWidget()
     clipboard = QApplication.clipboard().text();
     _message = QInputDialog.getMultiLineText(x, "Enter long text here", "", clipboard)
     message = [_message[i:i + self.maxsize] for i in range(0, len(_message), self.maxsize)]
     if targetMode == ts3defines.TextMessageTargetMode.TextMessageTarget_CHANNEL:
         for msg in message:
             error = ts3lib.requestSendChannelTextMsg(schid, "\n"+msg, toID)
             if not error == ts3defines.ERROR_ok: _t = QMessageBox(QMessageBox.Critical, "Error #%s"%error,"Unable to send message to #%s!"%toID);_t.show();return
     elif targetMode == ts3defines.TextMessageTargetMode.TextMessageTarget_CLIENT:
         for msg in message:
             error = ts3lib.requestSendPrivateTextMsg(schid, "\n"+msg, toID)
             if not error == ts3defines.ERROR_ok: _t = QMessageBox(QMessageBox.Critical, "Error #%s"%error,"Unable to send message to #%s!"%toID);_t.show();return
예제 #5
0
 def onMenuItemEvent(self, schid, atype, menuItemID, selectedItemID):
     if atype == ts3defines.PluginMenuType.PLUGIN_MENU_TYPE_GLOBAL:
         if menuItemID == 0:
             schid = ts3.getCurrentServerConnectionHandlerID()
             error, ownid = ts3.getClientID(schid)
             if error == ts3defines.ERROR_ok:
                 error, meta = ts3.getClientVariableAsString(
                     schid, ownid,
                     ts3defines.ClientProperties.CLIENT_META_DATA)
                 if error == ts3defines.ERROR_ok:
                     x = QWidget()
                     meta = QInputDialog.getMultiLineText(
                         x, "Change own Meta Data", "Meta Data:", meta)
                     error = ts3.setClientSelfVariableAsString(
                         schid,
                         ts3defines.ClientProperties.CLIENT_META_DATA, meta)
                     if not error == ts3defines.ERROR_ok:
                         _t = QMessageBox(QMessageBox.Critical, "Error",
                                          "Unable to set own meta data!")
                         t.show()