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

UsabILItyHub: Override optimize strategy by topping #857

Merged
merged 2 commits into from
Dec 6, 2023
Merged
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
22 changes: 16 additions & 6 deletions QgisModelBaker/gui/workflow_wizard/project_creation_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,6 @@ def _create_project(self):
mapthemes = {}
resolved_layouts = {}
custom_variables = {}
transaction_mode = None

if self.projecttopping_id:
# Project topping file for legend and layers: collect and download
Expand Down Expand Up @@ -449,7 +448,7 @@ def _create_project(self):
if "variables" in projecttopping_data:
custom_variables = projecttopping_data["variables"]

# properties (inoffical)
# properties
if "properties" in projecttopping_data:
custom_project_properties = projecttopping_data[
"properties"
Expand All @@ -463,9 +462,8 @@ def _create_project(self):

self.progress_bar.setValue(55)

transaction_mode = custom_project_properties.get(
"transaction_mode", None
)
# override transaction mode if give n by topic
transaction_mode = custom_project_properties.get("transaction_mode", None)

if Qgis.QGIS_VERSION_INT < 32600:
# pass transaction_mode as boolean
Expand Down Expand Up @@ -493,10 +491,22 @@ def _create_project(self):
transaction_mode = Qgis.TransactionMode.Disabled.name
# otherwise it's already a string and could be everything

# override optimize strategy if give n by topic
optimize_strategy = custom_project_properties.get("ili_optimize_strategy", None)

if optimize_strategy == "HIDE":
optimize_strategy = OptimizeStrategy.HIDE
elif optimize_strategy == "GROUP":
optimize_strategy = OptimizeStrategy.GROUP
elif optimize_strategy == "NONE":
optimize_strategy = OptimizeStrategy.NONE
else:
optimize_strategy = self.optimize_combo.currentData()

project = Project(
auto_transaction=transaction_mode,
context={"catalogue_datasetname": CATALOGUE_DATASETNAME},
optimize_strategy=self.optimize_combo.currentData(),
optimize_strategy=optimize_strategy,
)
project.layers = available_layers
project.relations = relations
Expand Down
Loading