Bugfix type hinting, PyLoad version handling, piCtory browser

Wrong type hinting for older python versions.
Version string is parsed by regex to match the numbers and ignore rcX.
Open piCtory browser form main dialog was broken.
This commit is contained in:
2023-02-02 09:34:27 +01:00
parent bfaa07aeb4
commit 7a1038a5ab
6 changed files with 19 additions and 9 deletions

View File

@@ -2,7 +2,7 @@
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "RevPi Commander"
#define MyAppVersion "0.9.10rc5"
#define MyAppVersion "0.9.10rc6"
#define MyAppPublisher "Sven Sager"
#define MyAppURL "https://revpimodio.org/"
#define MyAppICO "data\revpicommander.ico"

View File

@@ -4,4 +4,4 @@ __author__ = "Sven Sager"
__copyright__ = "Copyright (C) 2023 Sven Sager"
__license__ = "GPLv3"
__package__ = "revpicommander"
__version__ = "0.9.10rc5"
__version__ = "0.9.10rc6"

View File

@@ -130,7 +130,7 @@ class AvahiSearch(QtWidgets.QDialog, Ui_diag_search):
self.act_connect_xmlrpc.setVisible(True)
@staticmethod
def _find_settings(address: str) -> list[RevPiSettings]:
def _find_settings(address: str):
"""Find all settings with known avahi_id."""
return [
revpi_setting
@@ -258,8 +258,11 @@ class AvahiSearch(QtWidgets.QDialog, Ui_diag_search):
return
item = selected_items[0]
# Till we could not choose https / http we are using the ip address
webbrowser.open("http://{0}/".format(item.data(WidgetData.address)))
# We should use the hostname on macOS to let safari connect in link local mode (for linux nice too)
webbrowser.open("http://{0}/".format(item.data(
WidgetData.address if platform == "win32"
else WidgetData.host_name_full
)))
@QtCore.pyqtSlot(str, str, int, str, str)
def on_avahi_added(self, avahi_id: str, server: str, port: int, conf_type: str, ip: str) -> None:

View File

@@ -11,6 +11,7 @@ from http.client import CannotSendRequest
from os import environ, remove
from os.path import exists
from queue import Queue
from re import search
from threading import Lock
from uuid import uuid4
from xmlrpc.client import Binary, ServerProxy
@@ -232,6 +233,8 @@ class ConnectionManager(QtCore.QThread):
self.pyload_version = (0, 0, 0)
"""Version number of RevPiPyLoad 0.0.0 with <class 'int'> values."""
self.pyload_version_str = ""
"""Raw string of RevPyPyLoad version, could contain rc1 at the end."""
self.xml_funcs = []
"""Name list of all supported functions of RevPiPyLoad."""
self.xml_mode = -1
@@ -315,6 +318,7 @@ class ConnectionManager(QtCore.QThread):
self.ssh_pass = ""
self.pyload_version = (0, 0, 0)
self.pyload_version_str = ""
self.xml_funcs.clear()
self.xml_mode = -1
@@ -372,7 +376,9 @@ class ConnectionManager(QtCore.QThread):
# Load values and test connection to Revolution Pi
try:
pyload_version = tuple(map(int, sp.version().split(".")))
ma = search(r"(?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)", sp.version())
pyload_version = int(ma.group("major")), int(ma.group("minor")), int(ma.group("patch"))
pyload_version_str = ma.string
xml_funcs = sp.system.listMethods()
xml_mode = sp.xmlmodus()
except Exception as e:
@@ -410,6 +416,7 @@ class ConnectionManager(QtCore.QThread):
self.settings = revpi_settings
self.ssh_pass = ssh_pass
self.pyload_version = pyload_version
self.pyload_version_str = pyload_version_str
self.xml_funcs = xml_funcs
self.xml_mode = xml_mode

View File

@@ -402,8 +402,8 @@ class RevPiCommander(QtWidgets.QMainWindow, Ui_win_revpicommander):
@QtCore.pyqtSlot()
def on_act_pictory_triggered(self):
"""Open piCtory in default browser of operating system."""
if helper.cm.address:
webbrowser.open("http://{0}/".format(helper.cm.address))
if helper.cm.settings.address:
webbrowser.open("http://{0}/".format(helper.cm.settings.address))
@QtCore.pyqtSlot()
def on_act_reset_triggered(self):

View File

@@ -24,7 +24,7 @@ class RevPiInfo(QtWidgets.QDialog, Ui_diag_revpiinfo):
def exec(self) -> int:
self.lbl_version_pyload.setText(
"{0}.{1}.{2}".format(*helper.cm.pyload_version)
helper.cm.pyload_version_str
if helper.cm.connected else "-"
)
self._load_lst_files()