Skip to content

Commit

Permalink
Merge pull request #954 from opengisch/fix_925
Browse files Browse the repository at this point in the history
Show warning message in TID manager when OIDs cannot be found
  • Loading branch information
signedav authored Aug 22, 2024
2 parents 9f5fdb1 + 0fa2b24 commit c8863b1
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
7 changes: 7 additions & 0 deletions QgisModelBaker/gui/panel/tid_configurator_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ def setup_dialog(self, qgis_project, configuration=None):
)
if valid:
self.configuration.tool = mode

if self.configuration and self.configuration.tool:
self._reset_tid_configuration()
return True, ""
else:
return False, self.tr(
"To use the OID Manager, configure a connection to an INTERLIS based database."
)

def _reset_tid_configuration(self):
self.layer_tids_panel.load_tid_config(self.qgis_project)
Expand Down
17 changes: 14 additions & 3 deletions QgisModelBaker/gui/tid_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
***************************************************************************/
"""

from qgis.core import QgsMapLayer, QgsProject
from qgis.PyQt.QtWidgets import QDialog, QMessageBox
from qgis.core import Qgis, QgsMapLayer, QgsProject
from qgis.gui import QgsMessageBar
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import QDialog, QMessageBox, QSizePolicy

from QgisModelBaker.gui.panel.tid_configurator_panel import TIDConfiguratorPanel
from QgisModelBaker.utils import gui_utils
Expand Down Expand Up @@ -46,7 +48,16 @@ def __init__(self, iface, parent=None, base_config=None):

self.setStyleSheet(gui_utils.DEFAULT_STYLE)

self.tid_configurator_panel.setup_dialog(QgsProject.instance())
self.bar = QgsMessageBar()
self.bar.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Fixed)
self.layout().addWidget(self.bar, 0, 0, Qt.AlignTop)

result, message = self.tid_configurator_panel.setup_dialog(
QgsProject.instance()
)
if not result:
self.tid_configurator_panel.setEnabled(False)
self.bar.pushMessage(message, Qgis.Warning)

def _close_editing(self):
editable_layers = []
Expand Down

0 comments on commit c8863b1

Please sign in to comment.