From 53b9459d7d9676f4d9193a4854c237492caf05a4 Mon Sep 17 00:00:00 2001 From: giumas Date: Sun, 28 Jan 2024 20:17:16 +0100 Subject: [PATCH] fixed issues with SSM SIS --- hyo2/ssm2/app/gui/soundspeedsettings/gui.py | 2 +- hyo2/ssm2/app/gui/ssm_sis/__init__.py | 28 ++++++++++----------- hyo2/ssm2/app/gui/ssm_sis/gui.py | 2 +- hyo2/ssm2/app/gui/ssm_sis/mainwin.py | 11 ++++---- 4 files changed, 22 insertions(+), 21 deletions(-) diff --git a/hyo2/ssm2/app/gui/soundspeedsettings/gui.py b/hyo2/ssm2/app/gui/soundspeedsettings/gui.py index 7f3a45b1..6d578746 100644 --- a/hyo2/ssm2/app/gui/soundspeedsettings/gui.py +++ b/hyo2/ssm2/app/gui/soundspeedsettings/gui.py @@ -4,7 +4,7 @@ from PySide6 import QtCore, QtWidgets -from hyo2.abc2.app.app_style import AppStyle +from hyo2.abc2.app.app_style.app_style import AppStyle from hyo2.abc2.lib.logging import set_logging set_logging(ns_list=["hyo2.abc2", "hyo2.ssm2", "hyo2.sdm2"]) diff --git a/hyo2/ssm2/app/gui/ssm_sis/__init__.py b/hyo2/ssm2/app/gui/ssm_sis/__init__.py index 558e59ba..5d92a378 100644 --- a/hyo2/ssm2/app/gui/ssm_sis/__init__.py +++ b/hyo2/ssm2/app/gui/ssm_sis/__init__.py @@ -1,22 +1,22 @@ import logging import os -from hyo2.abc2.app.app_info import AppInfo -from hyo2.abc2.lib.lib_info import LibInfo - - -name = "SSM-SIS" -__version__ = "1.2.0" +from hyo2.ssm2 import pkg_info logger = logging.getLogger(__name__) logger.addHandler(logging.NullHandler()) -app_info = AppInfo() +app_path = os.path.abspath(os.path.dirname(__file__)) +app_media_path = os.path.join(app_path, "media") -app_info.app_name = name -app_info.app_version = __version__ -app_info.app_url = "https://www.hydroffice.org/ssm_sis/" -app_info.app_latest_url = "https://www.hydroffice.org/latest/ssm_sis.txt" -app_info.app_path = os.path.abspath(os.path.dirname(__file__)) -app_info.app_media_path = os.path.join(app_info.app_path, "media") -app_info.app_icon_path = os.path.join(app_info.app_media_path, "ssm_sis.png") +app_info = pkg_info.app_info( + app_name="SSM-SIS", + app_version="1.2.0", + app_beta=True, + app_url="https://www.hydroffice.org/ssm_sis/", + app_latest_url="https://www.hydroffice.org/latest/ssm_sis.txt", + app_path=app_path, + app_media_path=app_media_path, + app_license_path=os.path.join(app_media_path, "LICENSE"), + app_icon_path=os.path.join(app_media_path, "ssm_sis.png") +) diff --git a/hyo2/ssm2/app/gui/ssm_sis/gui.py b/hyo2/ssm2/app/gui/ssm_sis/gui.py index 96a8a6d9..d9d014c4 100644 --- a/hyo2/ssm2/app/gui/ssm_sis/gui.py +++ b/hyo2/ssm2/app/gui/ssm_sis/gui.py @@ -5,7 +5,7 @@ from PySide6 import QtCore, QtWidgets from hyo2.abc2.lib.logging import set_logging -from hyo2.abc2.app.app_style import AppStyle +from hyo2.abc2.app.app_style.app_style import AppStyle set_logging(ns_list=["hyo2.abc2", "hyo2.ssm2", "hyo2.sdm2"]) logger = logging.getLogger(__name__) diff --git a/hyo2/ssm2/app/gui/ssm_sis/mainwin.py b/hyo2/ssm2/app/gui/ssm_sis/mainwin.py index 0d56305b..18321df4 100644 --- a/hyo2/ssm2/app/gui/ssm_sis/mainwin.py +++ b/hyo2/ssm2/app/gui/ssm_sis/mainwin.py @@ -4,7 +4,7 @@ from urllib.request import urlopen from hyo2.abc2.lib.package.pkg_helper import PkgHelper -from hyo2.abc2.app.web_renderer import WebRenderer +from hyo2.abc2.app.browser.web_renderer import WebRenderer from hyo2.ssm2.app.gui.ssm_sis import app_info from hyo2.ssm2.app.gui.ssm_sis.controlpanel import ControlPanel @@ -45,9 +45,9 @@ def __init__(self): def _check_web_page(self, token: str = ""): try: if len(token) > 0: - url = "%s_%s" % (PkgHelper(lib_info=app_info).web_url(), token) + url = "%s_%s" % (PkgHelper(pkg_info=app_info).web_url(), token) else: - url = "%s" % PkgHelper(lib_info=app_info).web_url() + url = "%s" % PkgHelper(pkg_info=app_info).web_url() self._web.open(url=url) # logger.debug('check %s' % url) @@ -57,7 +57,7 @@ def _check_web_page(self, token: str = ""): @classmethod def _check_latest_release(cls): try: - response = urlopen(app_info.lib_latest_url, timeout=1) + response = urlopen(app_info.app_latest_url, timeout=1) latest_version = response.read().split()[0].decode() cur_maj, cur_min, cur_fix = app_info.app_version.split('.') lat_maj, lat_min, lat_fix = latest_version.split('.') @@ -72,7 +72,7 @@ def _check_latest_release(cls): logger.info("new bugfix available: %s" % latest_version) except Exception as e: - logger.warning(e) + logger.warning(e, exc_info=True) def _do_you_really_want(self, title="Quit", text="quit"): """helper function that show to the user a message windows asking to confirm an action""" @@ -80,6 +80,7 @@ def _do_you_really_want(self, title="Quit", text="quit"): msg_box.setWindowTitle(title) msg_box.setIconPixmap(QtGui.QPixmap(app_info.app_icon_path).scaled(QtCore.QSize(36, 36))) msg_box.setText('Do you really want to %s?' % text) + # noinspection PyUnresolvedReferences msg_box.setStandardButtons(QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No) msg_box.setDefaultButton(QtWidgets.QMessageBox.No) return msg_box.exec_()