From d5333b1d17a2fd896421a4deaecd15fdab7c6894 Mon Sep 17 00:00:00 2001 From: "Julien M." Date: Tue, 30 Apr 2024 14:59:36 +0200 Subject: [PATCH] fix(webviewer): setWindowsTitle was failing when default browser is selected --- qtribu/logic/web_viewer.py | 2 ++ qtribu/toolbelt/commons.py | 3 ++- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/qtribu/logic/web_viewer.py b/qtribu/logic/web_viewer.py index 5acb9023..bece78c2 100644 --- a/qtribu/logic/web_viewer.py +++ b/qtribu/logic/web_viewer.py @@ -11,6 +11,7 @@ # Standard library import logging +from typing import Optional # PyQGIS from qgis.PyQt.QtCore import QCoreApplication, Qt @@ -44,6 +45,7 @@ class WebViewer: def __init__(self): """Class initialization.""" self.log = PlgLogger().log + self.wdg_web: Optional[QWidget] = None def display_web_page(self, url: str): """Parse the feed XML as string and store items into an ordered tuple of tuples. diff --git a/qtribu/toolbelt/commons.py b/qtribu/toolbelt/commons.py index 36fac1fe..b24c1e0f 100644 --- a/qtribu/toolbelt/commons.py +++ b/qtribu/toolbelt/commons.py @@ -28,4 +28,5 @@ def open_url_in_webviewer(url: str, window_title: str) -> None: :type window_title: str """ web_viewer.display_web_page(url) - web_viewer.set_window_title(window_title) + if web_viewer.wdg_web: + web_viewer.set_window_title(window_title)