diff --git a/src/revpicommander/helper.py b/src/revpicommander/helper.py index 4b1a817..04e203b 100644 --- a/src/revpicommander/helper.py +++ b/src/revpicommander/helper.py @@ -33,6 +33,7 @@ class ConnectionFail(IntEnum): NO_XML_RPC = 1 SSH_CONNECT = 2 SSH_AUTH = 4 + NO_XML_RPC_VIA_TUNNEL = 9 # Includes NO_XML_RPC Bit class WidgetData(IntEnum): @@ -347,6 +348,10 @@ class ConnectionManager(QtCore.QThread): ) try: ssh_tunnel_port = ssh_tunnel_server.connect_by_credentials(revpi_settings.ssh_user, ssh_pass) + + if getattr(revpi_settings, "ssh_enable_revpipyload", False): + ssh_tunnel_server.send_cmd("sudo systemctl enable --now revpipyload") + except AuthenticationException: self.connect_error.emit( self.tr("Error"), self.tr( @@ -394,7 +399,7 @@ class ConnectionManager(QtCore.QThread): "- The RevPiPyLoad XML-RPC service is NOT bind to localhost\n" "- The ACL permission is not set for 127.0.0.1!!!" ), - ConnectionFail.NO_XML_RPC, + ConnectionFail.NO_XML_RPC_VIA_TUNNEL, revpi_settings, ) else: diff --git a/src/revpicommander/locale/revpicommander_de.qm b/src/revpicommander/locale/revpicommander_de.qm index a3e9896..5051499 100644 Binary files a/src/revpicommander/locale/revpicommander_de.qm and b/src/revpicommander/locale/revpicommander_de.qm differ diff --git a/src/revpicommander/locale/revpicommander_de.ts b/src/revpicommander/locale/revpicommander_de.ts index 5849aff..b8af8ad 100644 --- a/src/revpicommander/locale/revpicommander_de.ts +++ b/src/revpicommander/locale/revpicommander_de.ts @@ -229,62 +229,62 @@ Wurde eine Hardwarekonfiguration in piCtory erzeugt? ConnectionManager - + SIMULATING SIMULATION - + NOT CONNECTED NICHT VERBUNDEN - + SERVER ERROR SERVER FEHLER - + RUNNING LÄUFT - + PLC FILE NOT FOUND SPS PROGRAMM NICHT GEFUNDEN - + NOT RUNNING (NO STATUS) LÄUFT NICHT (KEIN STATUS) - + PROGRAM KILLED PROGRAMM GETÖTET - + PROGRAM TERMED PROGRAMM BEENDET - + NOT RUNNING LÄUFT NICHT - + FINISHED WITH CODE {0} BEENDET MIT CODE {0} - + Error Fehler - + The combination of username and password was rejected from the SSH server. Try again. @@ -293,7 +293,7 @@ Try again. Bitte erneut versuchen. - + Could not establish a SSH connection to server: {0} @@ -352,7 +352,7 @@ Das kann eine der folgenden Ursachen haben: Benutze "Über SSH verbinden" um eine verschlüsselte Verbindung aufzubauen oder führe 'sudo revpipyload_secure_installation' auf dem Revolution Pi aus, um eine direkte Verbindung zu konfigurieren! - + Can not connect to RevPiPyLoad XML-RPC service! This could have the following reasons: @@ -373,7 +373,7 @@ Das kann eine der folgenden Ursachen haben: Benutze "Über SSH verbinden" um eine verschlüsselte Verbindung aufzubauen oder führe 'sudo revpipyload_secure_installation' auf dem Revolution Pi aus, um eine direkte Verbindung zu konfigurieren! - + Can not connect to RevPiPyLoad service through SSH tunnel! This could have the following reasons: @@ -426,37 +426,37 @@ Das kann eine der folgenden Ursachen haben: DebugIos - + signed - + big_endian - + as text - + as number - + Can not use format text Formatierung nicht möglich - + Can not convert bytes {0} to a text for IO '{1}'. Switch to number format instead! Kann bytes {0} für '{1}' nicht in Text konvertieren. Wechseln Sie auf Nummernformat! - + switch wordorder Wordorder tauschen @@ -489,86 +489,86 @@ Ungesicherte Änderungen gehen verloren. RevPiCommander - + Simulator started... Simulator gestartet... - + Can not start... Kann nicht gestartet werden... - + Warning Warnung - + This version of Logviewer ist not supported in version {0} of RevPiPyLoad on your RevPi! You need at least version 0.4.1. Diese Version vom Logbetrachter wird in RevPiPyLoad Version {0} nicht unterstützt! Es wird mindestens Version 0.4.1 benötigt. - + XML-RPC access mode in the RevPiPyLoad configuration is too small to access this dialog! XML-RPC Zugriffsberechtigung in der RevPiPyLoad Konfiguraiton ist zu klein für diese Einstellungen! - + Error Fehler - + The Version of RevPiPyLoad on your Revolution Pi ({0}) is to old. This Version of RevPiCommander require at least version 0.6.0 of RevPiPyLoad. Please update your Revolution Pi! Die Version von RevPiPyLoad ({0}) auf dem Revolution Pi ist zu alt. Diese Version vom RevPiCommander braucht mindestens Version 0.6.0. Bitte aktualisiere deinen Revolution Pi! - + Question Frage - + Are you sure to reset piControl? The pictory configuration will be reloaded. During that time the process image will be interrupted and could rise errors on running control programs! Soll piControl wirklich zurückgesetzt werden? Die piCtory Konfiguration wird neu geladen. Das Prozessabbild wird in dieser Zeit nicht verfügbar sein und es könnten Fehler in Steuerungsprogrammen ausgelöst werden! - + Success Erfolgreich - + piControl reset executed successfully piControl wurde erfolgreich zurückgesetzt - + piControl reset could not be executed successfully piControl konnte nicht zurückgesetzt werden - + Reset to piCtory defaults... Standardwerte von piCtory laden... - + The watch mode ist not supported in version {0} of RevPiPyLoad on your RevPi! You need at least version 0.5.3! Maybe the python3-revpimodio2 module is not installed on your RevPi at least version 2.0.0. Der SPS Betrachter ist in Version {0} von RevPiPyLoad auf dem Rev Pi nicht unterstützt! Es muss mindestens Version 0.5.3 installiert sein! Vielleicht fehlt auch das python3-revpimodio2 Modul, welches mindestens Version 2.0.0 haben muss. - + Can not load this function, because your ACL level is to low! You need at least level 1 to read or level 3 to write. Für diese Funktion ist das Berechtigungslevel zu gering! Es muss mindestens Level 1 zum Lesen oder Level 3 zu Schreiben sein. - + Can not load piCtory configuration. Did you create a hardware configuration? Please check this in piCtory! Kann piCtory Konfiguration nicht laden. @@ -588,7 +588,7 @@ Das kann eine der folgenden Ursachen haben: Der Rev Pi ist nicht online, der XML Führe 'sudo revpipyload_secure_installation' auf dem Revolution Pi aus um diese Funktion zu konfigurieren! - + The simulator is running! You can work with this simulator if your call RevPiModIO with this additional parameters: @@ -605,42 +605,65 @@ configrsc={1} Dies kann aus der Textbox oben kopiert werden. - + Can not start the simulator! Maybe the piCtory file is corrupt or you have no write permissions for '{0}'. Kann Simulator nicht starten! Vielleicht ist die piCtory Datei defekt oder es gibt keine Schreibberechtigung für '{0}'. - + Do you want to reset your process image to {0} values? You have to stop other RevPiModIO programs before doing that, because they could reset the outputs. Soll das virtuelle Prozessabbild auf {0} zurückgesetzt werden? Es sollten alle RevPiModIO Programme vorher beendet werden, da diese ihre IO Werte sofort wieder schreiben würden. - + zero null - + piCtory default piCtory Standardwerte - + Revolution Pi connected! Revolution Pi verbunden! - + Connecting... Verbinde... - + Establish a connection to the Revolution Pi... Baue eine Verbindung zum Revolution Pi auf... + + + Can not connect to RevPiPyLoad service through SSH tunnel! + +We are trying to activate this service now and reconnect. The settings can be changed at any time via web status. + Über den SSH Tunnel kann keine Verbindung zu RevPiPyLoad hergestellt werden! + +Wir werden versuchen den Dienst zu starten und eine neue Verbindung herzustellen. Diese Einstellung kann im Webstatus geändert werden. + + + + Information + Information + + + + Can not connect to RevPiPyLoad service through SSH tunnel! + +We are trying to activate this service now and reconnect. The settings can be changed at any time via 'webstatus'. + Vielleicht läuft der RevPiPyLoad Dienst nicht. + +Wir versuchen diesen Dienst jetzt zu aktivieren und verbinden uns neu. Die Einstellungen können über 'Webstatus' jederzeit geändert werden. + RevPiFiles @@ -1216,12 +1239,12 @@ Dies ist kein Fehler von RevPi Commander. Simulator - + Select downloaded piCtory file... Heruntergeladene piCtory Datei auswählen... - + piCtory file (*.rsc);;All files (*.*) piCtory Datei (*.rsc);;Alle Dateien (*.*) diff --git a/src/revpicommander/revpicommander.py b/src/revpicommander/revpicommander.py index 4bf0f0a..094dd6d 100644 --- a/src/revpicommander/revpicommander.py +++ b/src/revpicommander/revpicommander.py @@ -128,10 +128,22 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander): :param fail_code: Type of error :param revpi_settings: Settings of the revpi with the error """ - QtWidgets.QMessageBox.critical(self, title, text) - if fail_code is ConnectionFail.SSH_AUTH: - # On failed credentials, we try to connect again and remove password form keychain, if exists - self._pyload_connect(revpi_settings, True) + if fail_code is ConnectionFail.NO_XML_RPC_VIA_TUNNEL: + # If RevPiPyLoad is not running, we can try to activate it via ssh + QtWidgets.QMessageBox.information( + self, self.tr("Information"), self.tr( + "Can not connect to RevPiPyLoad service through SSH tunnel!\n\n" + "We are trying to activate this service now and reconnect. The settings can be " + "changed at any time via 'webstatus'." + ), + ) + revpi_settings.ssh_enable_revpipyload = True + self._pyload_connect(revpi_settings, False) + else: + QtWidgets.QMessageBox.critical(self, title, text) + if fail_code is ConnectionFail.SSH_AUTH: + # On failed credentials, we try to connect again and remove password form keychain, if exists + self._pyload_connect(revpi_settings, True) @QtCore.pyqtSlot(str) def on_cm_connection_error_observed(self, message: str):