Skip to content

Commit

Permalink
Merge pull request #943 from opengisch/fix_service_file
Browse files Browse the repository at this point in the history
Fix exceptions on no service file found
  • Loading branch information
signedav authored Jul 12, 2024
2 parents 7d07454 + 8dd5f32 commit 452be33
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 13 deletions.
19 changes: 12 additions & 7 deletions QgisModelBaker/gui/panel/pg_config_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
# Available in typing module from v3.12 on
from typing_extensions import override

import QgisModelBaker.libs.modelbaker.libs.pgserviceparser as pgserviceparser
import QgisModelBaker.libs.modelbaker.utils.db_utils as db_utils
from QgisModelBaker.libs.modelbaker.iliwrapper.globals import DbIliMode
from QgisModelBaker.libs.modelbaker.iliwrapper.ili2dbconfig import (
Expand Down Expand Up @@ -117,7 +116,8 @@ def __init__(self, parent, db_action_type):

# Fill pg_services combo box
self.pg_service_combo_box.addItem(self.tr("None"), None)
for service in pgserviceparser.service_names():
services, _ = db_utils.get_service_names()
for service in services:
self.pg_service_combo_box.addItem(service, service)

self.pg_service_combo_box.currentIndexChanged.connect(
Expand Down Expand Up @@ -223,7 +223,12 @@ def get_fields(self, configuration):
@override
def set_fields(self, configuration):

if configuration.dbservice is None:
service_config, error = db_utils.get_service_config(configuration.dbservice)
if error:
logging.warning(error)

# if no dbservice in the configuration or one is there but the servicefile is not available anymore
if not service_config:

indexNoService = self.pg_service_combo_box.findData(
None, PgConfigPanel._SERVICE_COMBOBOX_ROLE.DBSERVICE
Expand Down Expand Up @@ -287,8 +292,6 @@ def set_fields(self, configuration):

# Only apply stored QSettings if the
# PG service didn't have a value for them
service_config = pgserviceparser.service_config(configuration.dbservice)

if not service_config.get("host"):
self.pg_host_line_edit.setText(configuration.dbhost)

Expand Down Expand Up @@ -352,9 +355,11 @@ def _pg_service_combo_box_changed(self):
if self._current_service is None:
self._keep_custom_settings()

if service:
service_config = pgserviceparser.service_config(service)
service_config, error = db_utils.get_service_config(service)
if error:
logging.warning(error)

if service_config:
# QGIS cannot handle manually set hosts with service
# So it needs to have a host defined in service conf or it takes localhost
self.pg_host_line_edit.setText(service_config.get("host", "localhost"))
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/background_info/catalogues.md
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ It's not possible to export data with validation from a model that uses codelist
![tree_validation](../assets/catalogues_treevalidation.png)

#### Reason
There is a constraint in the the class `CatalogueReference` of [`CatalogeObjectTrees_V1`](http://models.geo.admin.ch/CH/CHBase_Part3_CATALOGUEOBJECTS_V1.ili):
There is a constraint in the class `CatalogueReference` of [`CatalogeObjectTrees_V1`](http://models.geo.admin.ch/CH/CHBase_Part3_CATALOGUEOBJECTS_V1.ili):
```
MANDATORY CONSTRAINT
Reference->IsUseable;
Expand Down
6 changes: 3 additions & 3 deletions docs/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ plugins:
Basket and Dataset Handling: Dataset und Basket Handling
OID Generator: OID Generator
UsabILIty Hub: UsabILIty Hub
Overview: Overview
Overview: Übersicht
Model Baker Integration: Model Baker Integration
Technical Concept: Technisches Konzept
Optimized Projects for Extended Models: Optimierte Projekte für erweiterte
Expand All @@ -105,12 +105,12 @@ plugins:
primary: blue grey
toggle:
icon: material/weather-night
name: Switch to dark mode
name: Wechsel zu Nachmodus
- scheme: slate
primary: blue grey
toggle:
icon: material/weather-sunny
name: Switch to light mode
name: Wechsel zu Tagmodus
primary: white

# Page tree
Expand Down
1 change: 0 additions & 1 deletion docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
mkdocs-material==9.5.20
mkdocs-material==9.5.27
mkdocs-static-i18n==1.2.3
python-slugify
2 changes: 1 addition & 1 deletion scripts/package_pip_packages.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
LIBS_DIR="QgisModelBaker/libs"

MODELBAKER_LIBRARY=("modelbaker" "1.8.0")
MODELBAKER_LIBRARY=("modelbaker" "1.8.1")
PACKAGING=("packaging" "21.3")

PACKAGES=(
Expand Down

0 comments on commit 452be33

Please sign in to comment.