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

set transaction mode as enum #856

Merged
merged 2 commits into from
Dec 1, 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
33 changes: 29 additions & 4 deletions QgisModelBaker/gui/workflow_wizard/project_creation_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,36 @@ def _create_project(self):

self.progress_bar.setValue(55)

# on geopackages we don't use the transaction mode on default, since this leaded to troubles, except the topping sais so
transaction_mode = custom_project_properties.get("transaction_mode", None)

if Qgis.QGIS_VERSION_INT < 32600:
# pass transaction_mode as boolean
if transaction_mode is None:
# on geopackages we don't use the transaction mode on default otherwise we do
transaction_mode = not bool(self.configuration.tool & DbIliMode.gpkg)
else:
transaction_mode = (
custom_transaction_mode == Qgis.TransactionMode.AutomaticGroups.name
)
else:
# pass transaction_mode as string
if transaction_mode is None:
# on geopackages we don't use the transaction mode on default otherwise we do
transaction_mode = (
"Disabled"
if not bool(self.configuration.tool & DbIliMode.gpkg)
else Qgis.TransactionMode.AutomaticGroups.name
)
else:
# in case the topping used True/False value we need to convert
if transaction_mode is True:
transaction_mode = Qgis.TransactionMode.AutomaticGroups.name
if transaction_mode is False:
transaction_mode = Qgis.TransactionMode.Disabled.name
# otherwise it's already a string and could be everything

project = Project(
auto_transaction=not bool(self.configuration.tool & DbIliMode.gpkg)
or custom_project_properties.get("transaction_mode", "")
== "AutomaticGroups",
auto_transaction=transaction_mode,
context={"catalogue_datasetname": CATALOGUE_DATASETNAME},
optimize_strategy=self.optimize_combo.currentData(),
)
Expand Down
Loading