def Login(self): self.saveSettings() # Grab credentials from the currently available fields, not saved settings. if self.settingsDialog.group_account: Username = self.settingsDialog.group_account.input_username.text Password = self.settingsDialog.group_account.input_password.text # Headers and payload. Headers = {"User-Agent": "ScreenCloud-Cloudup"} Payload = { "client_id": "ah5Oa7F3hT8", "grant_type": "password", "username": Username, "password": Password } try: r = requests.post("https://cloudup.com/oauth/access_token", data = Payload, headers = Headers) j = json.loads(r.text) if r.status_code == 400: QMessageBox.critical(self.settingsDialog, "Cloudup Login Error", j["error_description"]) self.Key = j["access_token"] self.saveSettings() self.loadSettings() self.updateUi() QMessageBox.information(self.settingsDialog, "Success!", "You have successfully signed into your Cloudup account.") except Exception as e: QMessageBox.critical(self.settingsDialog, "Cloudup Login Error", "Error occurred during login. " + e.message)
def onLoadMenusButtonChanged(self, state): if state == Qt.Checked: self.cfg.set("general", "loadAllMenus", "True") else: self.cfg.set("general", "loadAllMenus", "False") QMessageBox.information(self, self._tr("Restart required"), self._tr("Changes only take effect after a " "restart."))
def getList(self): import dynamic_graph from dynamic_graph.sot.core.robot_simu import RobotSimu chaine = "\n".join(dynamic_graph.entity.Entity.entityClassNameList) # Show the list of entities used with QMessageBox QMessageBox.information(None, "Entity list", chaine, QMessageBox.Ok, QMessageBox.Ok)
def Logout(self): Settings = QSettings() Settings.beginGroup("uploaders") Settings.beginGroup("cloudup") Settings.remove("token") Settings.endGroup() Settings.endGroup() self.loadSettings() self.updateUi() QMessageBox.information(self.settingsDialog, "Success!", "You have successfully signed out of your Cloudup account.")
def getNodeInformation(self, e): signals = eval( self.cmd.run("[ s.name for s in dg.entity.Entity.entities['" + e + "'].signals() ]")) chaine = "\n" for s in signals: ss = s.split("::") if len(ss) != 3: print("Cannot handle" + s) elif ss[1].startswith("in"): InfType = ss[1] text = InfType[InfType.find('(') + 1:InfType.find(')')] chaine = chaine + "input : " + ss[2] + ", type :" + text + "\n" elif ss[1].startswith("out"): InfType = ss[1] text = InfType[InfType.find('(') + 1:InfType.find(')')] chaine = chaine + "output : " + ss[2] + ", type :" + text + "\n" QMessageBox.information(None, "Node : " + e, chaine, QMessageBox.Ok, QMessageBox.Ok)
def parseUpdateReply(cls, repstr): def platform_str(): try: import platform except: raise Exception("Error importing platform module") if sys.platform == "linux": if platform.architecture()[0] == "64bit": return "linux_amd64" else: return "linux_x86" elif sys.platform == "win32": return "win%s" % platform.architecture()[0][:2] else: return "mac" try: obj = json.loads(repstr) if obj["tag_name"] == "v%s" % pytson.getVersion(): QMessageBox.information( None, cls._tr("pyTSon Update Check"), cls._tr("You are running the latest " "pyTSon release")) else: for a in obj["assets"]: if a["name"] == "pyTSon_%s.ts3_plugin" % platform_str(): msg = cls._tr("There is an update of pyTSon for your " "platform. Get it from <a href='{url}'>" "here</a>").format(url=obj["html_url"]) QMessageBox.information(None, cls._tr("pyTSon Update Check"), msg) return QMessageBox.information( None, cls._tr("pyTSon Update Check"), cls._tr("You are running the latest " "pyTSon release (at least for " "your platform)")) except: logprint( cls._tr("Error parsing reply from update check: {trace}" ).format(trace=traceback.format_exc()), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon.PluginHost.parseUpdateReply")
def parseUpdateReply(cls, repstr): def platform_str(): try: import platform except: raise Exception("Error importing platform module") if sys.platform == "linux": if platform.architecture()[0] == "64bit": return "linux_amd64" else: return "linux_x86" elif sys.platform == "win32": return "win%s" % platform.architecture()[0][:2] else: return "mac" try: obj = json.loads(repstr) if obj["tag_name"] == "v%s" % pytson.getVersion(): QMessageBox.information(None, cls._tr("pyTSon Update Check"), cls._tr("You are running the latest " "pyTSon release")) else: for a in obj["assets"]: if a["name"] == "pyTSon_%s.ts3_plugin" % platform_str(): msg = cls._tr("There is an update of pyTSon for your " "platform. Get it from <a href='{url}'>" "here</a>").format(url=obj["html_url"]) QMessageBox.information(None, cls._tr("pyTSon Update Check"), msg) return QMessageBox.information(None, cls._tr("pyTSon Update Check"), cls._tr("You are running the latest " "pyTSon release (at least for " "your platform)")) except: logprint(cls._tr("Error parsing reply from update check: {trace}"). format(trace=traceback.format_exc()), ts3defines.LogLevel.LogLevel_ERROR, "pyTSon.PluginHost.parseUpdateReply")
def showSettingsUI(self, parentWidget): QMessageBox.information(parentWidget, 'Vgy', 'This plugin has no settings.')
def handleDisplayError(self, message): QMessageBox.information(None, "Error", message) pass
def displayMessage(self, title, msg): QMessageBox.information(None, title, msg)
def showSettingsUI(self, parentWidget): QMessageBox.information(parentWidget, 'NoelShack', 'This plugin has no settings.')
def showSettingsUI(self, parentWidget): QMessageBox.information(parentWidget, "NoelShack", "This plugin has no settings.")