Skip to content

Commit 6be779b

Browse files
authored
Merge pull request #65 from tudelft3d/gio-dev
Update admin_dialog.py
2 parents 46d863f + 14675d4 commit 6be779b

File tree

1 file changed

+30
-6
lines changed

1 file changed

+30
-6
lines changed

cdb4/gui_admin/admin_dialog.py

+30-6
Original file line numberDiff line numberDiff line change
@@ -489,16 +489,17 @@ def evt_btnConnectToDb_clicked(self) -> None:
489489

490490
###########################################################
491491
# Only for testing purposes
492-
# qgis_pkg_curr_version_txt : str = "0.7.3"
493-
# qgis_pkg_curr_version_major : int = 0
494-
# qgis_pkg_curr_version_minor : int = 7
495-
# qgis_pkg_curr_version_minor_rev: int = 3
492+
# qgis_pkg_curr_version_major: int = 0
493+
# qgis_pkg_curr_version_minor: int = 9
494+
# qgis_pkg_curr_version_minor_rev: int = 5
495+
# qgis_pkg_curr_version_txt: str = ".".join([str(qgis_pkg_curr_version_major), str(qgis_pkg_curr_version_minor), str(qgis_pkg_curr_version_minor_rev)])
496496
###########################################################
497497

498498
# Check that the QGIS Package version is >= than the minimum required for this version of the plugin (see cdb4_constants.py)
499499
if all((qgis_pkg_curr_version_major == c.QGIS_PKG_MIN_VERSION_MAJOR,
500500
qgis_pkg_curr_version_minor == c.QGIS_PKG_MIN_VERSION_MINOR,
501-
qgis_pkg_curr_version_minor_rev >= c.QGIS_PKG_MIN_VERSION_MINOR_REV)):
501+
qgis_pkg_curr_version_minor_rev >= c.QGIS_PKG_MIN_VERSION_MINOR_REV,
502+
)):
502503

503504
# Set/update the status check variable
504505
self.checks.is_qgis_pkg_supported = True
@@ -524,7 +525,30 @@ def evt_btnConnectToDb_clicked(self) -> None:
524525
# Finish setting up the GUI
525526
ti_wf.setup_post_qgis_pkg_installation(dlg=self)
526527

527-
else: # Wrong (outdated?) version of QGIS Package
528+
elif any((qgis_pkg_curr_version_major > c.QGIS_PKG_MIN_VERSION_MAJOR,
529+
all((qgis_pkg_curr_version_major == c.QGIS_PKG_MIN_VERSION_MAJOR, qgis_pkg_curr_version_minor > c.QGIS_PKG_MIN_VERSION_MINOR))
530+
)):
531+
# This is a future, most likely incompatible version of the QGIS Package.
532+
# For example: 1.x.x or 0.11.x, if the current is 0.10.x)
533+
534+
# Set/update the status check variable
535+
self.checks.is_qgis_pkg_supported = False
536+
537+
# Update the Connection Status label
538+
self.lblMainInst_out.setText(c.warning_html.format(text=c.INST_FAIL_VERSION_MSG))
539+
540+
# Deactivate the Main Installation Group box
541+
self.gbxMainInst.setDisabled(True)
542+
# Deactivate the User Installation Group box
543+
self.gbxUserInstCont.setDisabled(False)
544+
545+
# Inform the user
546+
msg = f"The QGIS Package (v. {qgis_pkg_curr_version_txt}) installed in the database you are connecting to is more recent than the one supported by this plug-in (v. {c.QGIS_PKG_MIN_VERSION_MAJOR}.{c.QGIS_PKG_MIN_VERSION_MINOR}.x).<br><br>Please upgrade your plug-in to a more recent version or contact the database administrator."
547+
QMessageBox.warning(self, "Unsupported QGIS Package version", msg)
548+
549+
return None # Exit
550+
551+
else: # Wrong (outdated) version of QGIS Package
528552
# Set/update the status check variable
529553
self.checks.is_qgis_pkg_supported = False
530554

0 commit comments

Comments
 (0)