Ejemplo n.º 1
0
    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)
Ejemplo n.º 2
0
    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."))
Ejemplo n.º 3
0
    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)
Ejemplo n.º 4
0
    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.")
Ejemplo n.º 5
0
    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)
Ejemplo n.º 6
0
    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")
Ejemplo n.º 7
0
    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")
Ejemplo n.º 8
0
 def showSettingsUI(self, parentWidget):
     QMessageBox.information(parentWidget,
                             'Vgy',
                             'This plugin has no settings.')
Ejemplo n.º 9
0
 def handleDisplayError(self, message):
     QMessageBox.information(None, "Error", message)
     pass
Ejemplo n.º 10
0
 def displayMessage(self, title, msg):
     QMessageBox.information(None, title, msg)
Ejemplo n.º 11
0
 def handleDisplayError(self, message):
     QMessageBox.information(None, "Error", message)
     pass
Ejemplo n.º 12
0
 def displayMessage(self, title, msg):
     QMessageBox.information(None, title, msg)
Ejemplo n.º 13
0
 def showSettingsUI(self, parentWidget):
     QMessageBox.information(parentWidget, 'NoelShack',
                             'This plugin has no settings.')
Ejemplo n.º 14
0
 def showSettingsUI(self, parentWidget):
     QMessageBox.information(parentWidget, "NoelShack", "This plugin has no settings.")