Skip to content

Commit

Permalink
pass blacklisted models to find available language because they are i…
Browse files Browse the repository at this point in the history
…rellevant
  • Loading branch information
signedav committed Nov 5, 2024
1 parent 4b06337 commit bef85ea
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 12 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

0 comments on commit bef85ea

Please sign in to comment.