Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix exceptions on no service file found #943

Merged
merged 7 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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