Skip to content

Commit

Permalink
Merge pull request #979 from opengisch/modelfilter
Browse files Browse the repository at this point in the history
Pass blacklisted models to find available language because they are irrelevant
  • Loading branch information
signedav authored Nov 5, 2024
2 parents 9fb1bee + a3d7c1f commit 71f10a7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
21 changes: 13 additions & 8 deletions QgisModelBaker/gui/workflow_wizard/project_creation_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
from QgisModelBaker.libs.modelbaker.utils.qt_utils import make_file_selector
from QgisModelBaker.utils import gui_utils
from QgisModelBaker.utils.globals import CATALOGUE_DATASETNAME, displayLanguages
from QgisModelBaker.utils.gui_utils import TRANSFERFILE_MODELS_BLACKLIST, LogLevel
from QgisModelBaker.utils.gui_utils import MODELS_BLACKLIST, LogLevel

PAGE_UI = gui_utils.get_ui_class("workflow_wizard/project_creation.ui")

Expand Down Expand Up @@ -244,8 +244,17 @@ def _update_translation_combo(self):
self.translation_combo.clear()

if self.db_connector:
for lang in self.db_connector.get_available_languages():
self.translation_combo.addItem(displayLanguages.get(lang, lang), lang)
available_languages = self.db_connector.get_available_languages(
MODELS_BLACKLIST
)
if len(available_languages) > 1:
for lang in available_languages:
self.translation_combo.addItem(
displayLanguages.get(lang, lang), lang
)
self.translation_combo.setEnabled(True)
else:
self.translation_combo.setEnabled(False)

self.translation_combo.addItem(self.tr("Original model language"), "__")

Expand Down Expand Up @@ -725,11 +734,7 @@ def _modelnames(self):
for db_model in db_models:
for modelname in regex.split(db_model["modelname"]):
name = modelname.strip()
if (
name
and name not in TRANSFERFILE_MODELS_BLACKLIST
and name not in modelnames
):
if name and name not in MODELS_BLACKLIST and name not in modelnames:
modelnames.append(name)
return modelnames

Expand Down
8 changes: 4 additions & 4 deletions QgisModelBaker/utils/gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class DropMode(Enum):
"XLSX",
]

TRANSFERFILE_MODELS_BLACKLIST = [
MODELS_BLACKLIST = [
"CHBaseEx_MapCatalogue_V1",
"CHBaseEx_WaterNet_V1",
"CHBaseEx_Sewage_V1",
Expand Down Expand Up @@ -112,6 +112,7 @@ class DropMode(Enum):
"StandardSymbology",
"Time",
"Units",
"",
]

# style
Expand Down Expand Up @@ -714,8 +715,7 @@ def _transfer_file_models(self, data_file_path):
for sub_element in element:
if (
"NAME" in sub_element.attrib
and sub_element.attrib["NAME"]
not in TRANSFERFILE_MODELS_BLACKLIST
and sub_element.attrib["NAME"] not in MODELS_BLACKLIST
):
model = {}
model["name"] = sub_element.attrib["NAME"]
Expand Down Expand Up @@ -1049,7 +1049,7 @@ def refresh_model(self, db_connectors=[]):
name = modelname.strip()
if (
name
and name not in TRANSFERFILE_MODELS_BLACKLIST
and name not in MODELS_BLACKLIST
and name not in modelnames
):
modelnames.append(name)
Expand Down
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.9.0")
MODELBAKER_LIBRARY=("modelbaker" "1.9.1")
PACKAGING=("packaging" "21.3")

PACKAGES=(
Expand Down

0 comments on commit 71f10a7

Please sign in to comment.