Skip to content
This repository has been archived by the owner on Dec 18, 2024. It is now read-only.

Commit

Permalink
inform the user if one opencatalog is missing #54
Browse files Browse the repository at this point in the history
  • Loading branch information
Guts committed Aug 28, 2019
1 parent 58d47e2 commit cbc471a
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
21 changes: 18 additions & 3 deletions IsogeoToOffice.py
Original file line number Diff line number Diff line change
Expand Up @@ -844,9 +844,9 @@ def settings_reset(self):
self.close()

# -- UI Slots -------------------------------------------------------------
@pyqtSlot(str, str)
@pyqtSlot(str, str, bool)
def fill_app_props(
self, app_infos_retrieved: str = "", latest_online_version: str = ""
self, app_infos_retrieved: str = "", latest_online_version: str = "", opencatalog_warning: bool = 0
):
"""Get app properties and fillfull the share frame in settings tab.
Expand All @@ -859,7 +859,7 @@ def fill_app_props(
try:
if semver.compare(__version__, latest_online_version) < 0:
logger.info("A newer version is available.")
version_msg = self.tr("New version available.")
version_msg = self.tr("New version available. You can download it here: ") + "/~https://github.com/isogeo/isogeo-2-office/releases/latest"
self.setWindowTitle(self.windowTitle() + " ! " + version_msg)
else:
logger.debug("Used version is up-to-date")
Expand All @@ -880,6 +880,21 @@ def fill_app_props(
status_msg=self.tr("Application information has been retrieved"),
)

# if needed, inform the user about a missing OpenCatalog
if opencatalog_warning:
oc_msg = self.tr("OpenCatalog is missing in one share at least. Check the settings tab to identify which one and fix it.")
self.tray_icon.showMessage(
"Isogeo to Office",
oc_msg,
QIcon("resources/favicon.png"),
)
self.update_status_bar(
prog_step=0,
status_msg=oc_msg,
color="orange"
)


@pyqtSlot()
def update_credentials(self):
"""Executed after credentials have been updated.
Expand Down
12 changes: 9 additions & 3 deletions modules/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
# API REQUESTS ----------------------------------------------------------------
class ThreadAppProperties(QThread):
# signals
sig_finished = pyqtSignal(str, str)
sig_finished = pyqtSignal(str, str, bool)

def __init__(self, api_manager: object):
QThread.__init__(self)
Expand All @@ -57,6 +57,9 @@ def __init__(self, api_manager: object):
def run(self):
"""Get application informations and build the text to display into the settings tab.
"""
# local vers
opencatalog_warning = 0

# insert text
text = "<html>" # opening html content
# properties of the authenticated application
Expand Down Expand Up @@ -100,6 +103,7 @@ def run(self):
text += "<p>{} <span style='color: red;'>{}</span</p>".format(
self.tr("OpenCatalog status:"), self.tr("disabled")
)
opencatalog_warning = 1

# last modification (share renamed, changes in catalogs or applications, etc.)
text += "<p>{} {}</p>".format(
Expand All @@ -124,15 +128,17 @@ def run(self):
).json()[0]
online_version = latest_v.get("tag_name")
except Exception as e:
logger.error("Unable to get the latest application version from Github: ".format(e))
logger.error(
"Unable to get the latest application version from Github: ".format(e)
)
online_version = "0.0.0"

# handle version label starting with a non digit char
if not online_version[0].isdigit():
online_version = online_version[1:]

# Now inform the main thread with the output (fill_app_props)
self.sig_finished.emit(text, online_version)
self.sig_finished.emit(text, online_version, opencatalog_warning)


class ThreadSearch(QThread):
Expand Down

0 comments on commit cbc471a

Please sign in to comment.