Skip to content

Commit

Permalink
Show warning message in TID manager when OIDs cannot be find
Browse files Browse the repository at this point in the history
  • Loading branch information
gacarrillor committed Aug 19, 2024
1 parent 9f5fdb1 commit ccb942e
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
6 changes: 6 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,13 @@ 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()
else:
return False, self.tr(
"We couldn't find a proper Interlis data source in the current project and there is no configured connection to a Interlis database."
)

def _reset_tid_configuration(self):
self.layer_tids_panel.load_tid_config(self.qgis_project)
Expand Down
15 changes: 13 additions & 2 deletions QgisModelBaker/gui/tid_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
"""

from qgis.core import QgsMapLayer, QgsProject
from qgis.PyQt.QtWidgets import QDialog, QMessageBox
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.pushWarning(self.tr("Warning"), message)

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

0 comments on commit ccb942e

Please sign in to comment.