Skip to content

Commit

Permalink
Merge pull request #856 from opengisch/transactionmode
Browse files Browse the repository at this point in the history
set transaction mode as enum
  • Loading branch information
signedav authored Dec 1, 2023
2 parents f042415 + ce00dfb commit 95b31fd
Showing 1 changed file with 29 additions and 4 deletions.
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

0 comments on commit 95b31fd

Please sign in to comment.