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

Add tools to handle link with OpenCatalog #67

Merged
merged 11 commits into from
Aug 28, 2019
32 changes: 27 additions & 5 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 Expand Up @@ -986,14 +1001,21 @@ def update_search_form(self, search: MetadataSearch):
self.update_status_bar(prog_step=0, status_msg=self.tr("Search form updated"))

@pyqtSlot(int, str)
def update_status_bar(self, prog_step: int = 1, status_msg: str = ""):
def update_status_bar(self, prog_step: int = 1, status_msg: str = "", duration: int = 0, color: str = None):
"""Display message into status bar.

:param int prog_step: step to increase the progress bar. Defaults to 1.
:param str status_msg: message to display into the status bar
:param int duration: duration of the message in milliseconds.
:param str color: color to apply to the message
"""
# custom message foreground color
if color is not None:
self.ui.lbl_statusbar.setStyleSheet("color: {}".format(color))
else:
self.ui.lbl_statusbar.setStyleSheet("")
# status bar and systray
self.ui.lbl_statusbar.showMessage(status_msg)
self.ui.lbl_statusbar.showMessage(status_msg, msecs=duration)
self.tray_icon.setToolTip(status_msg)
# progressbar
prog_val = self.ui.pgb_exports.value() + prog_step
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ wheel = "*"

[packages]
docxtpl = "*"
isogeo-pysdk = ">=3.1.*"
isogeo-pysdk = ">=3.2.*"
openpyxl = "==2.6.*"
progressbar2 = "*"
"pyqt5" = "==5.13.*"
Expand Down
64 changes: 42 additions & 22 deletions i18n/IsogeoToOffice_en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="938"/>
<location filename="../IsogeoToOffice.py" line="953"/>
<source>Export {} metadata</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -43,7 +43,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="986"/>
<location filename="../IsogeoToOffice.py" line="1001"/>
<source>Search form updated</source>
<translation type="unfinished"></translation>
</message>
Expand Down Expand Up @@ -120,26 +120,31 @@ application will be closed.</source>
<source>Application information has been retrieved.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="862"/>
<source>New version available.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="866"/>
<source>Version is up-to-date.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="1006"/>
<location filename="../IsogeoToOffice.py" line="1028"/>
<source>Export operations are over.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="903"/>
<location filename="../IsogeoToOffice.py" line="918"/>
<source>No results found. Please, try other filters.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="862"/>
<source>New version available. You can download it here: </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../IsogeoToOffice.py" line="885"/>
<source>OpenCatalog is missing in one share at least. Check the settings tab to identify which one and fix it.</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>SystrayMenu</name>
Expand Down Expand Up @@ -167,79 +172,94 @@ application will be closed.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="78"/>
<location filename="../modules/threads.py" line="79"/>
<source> and powered by </source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="74"/>
<location filename="../modules/threads.py" line="75"/>
<source>share:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="78"/>
<location filename="../modules/threads.py" line="79"/>
<source>shares:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="94"/>
<location filename="../modules/threads.py" line="109"/>
<source>Updated:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="99"/>
<location filename="../modules/threads.py" line="115"/>
<source>Contact:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="103"/>
<source>OpenCatalog status:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="99"/>
<source>enabled</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="103"/>
<source>disabled</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ThreadExportExcel</name>
<message>
<location filename="../modules/threads.py" line="193"/>
<location filename="../modules/threads.py" line="211"/>
<source>Processing Excel: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="226"/>
<location filename="../modules/threads.py" line="244"/>
<source>Excel finished</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ThreadExportWord</name>
<message>
<location filename="../modules/threads.py" line="268"/>
<location filename="../modules/threads.py" line="286"/>
<source>Processing Word: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="298"/>
<location filename="../modules/threads.py" line="316"/>
<source>Word: error occurred during saving step. Check the log.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="307"/>
<location filename="../modules/threads.py" line="325"/>
<source>Word finished</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ThreadExportXml</name>
<message>
<location filename="../modules/threads.py" line="351"/>
<location filename="../modules/threads.py" line="369"/>
<source>Processing XML: {}</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>ThreadThumbnails</name>
<message>
<location filename="../modules/threads.py" line="442"/>
<location filename="../modules/threads.py" line="460"/>
<source>Preparing thumbnail table for: {}</source>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../modules/threads.py" line="479"/>
<location filename="../modules/threads.py" line="497"/>
<source>Thumbnail table finished</source>
<translation type="unfinished"></translation>
</message>
Expand Down
Loading