Skip to content

Commit

Permalink
Merge pull request #998 from opengisch/validconfigvariable
Browse files Browse the repository at this point in the history
Export ValidationConfig File as Topping
  • Loading branch information
signedav authored Dec 10, 2024
2 parents b01949d + b063c7f commit b4eda32
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 36 deletions.
23 changes: 23 additions & 0 deletions QgisModelBaker/gui/topping_wizard/additives_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@

VARIABLE_PREFIX_BLACKLIST = ["default_basket", "optimize_strategy"]

VALIDATION_VARIABLE = "validator_config"


class AdditivesPage(QWizardPage, PAGE_UI):
def __init__(self, parent, title):
Expand Down Expand Up @@ -71,11 +73,28 @@ def initializePage(self) -> None:
self.variables_view.setVisible(self.variables_model.rowCount())
self.variables_label.setVisible(self.variables_model.rowCount())

if VALIDATION_VARIABLE in self.variables_model.stringList():
self.validatortopping_checkbox.setVisible(True)
self.validatortopping_checkbox.setChecked(True)
else:
self.validatortopping_checkbox.setVisible(False)
self.validatortopping_checkbox.setChecked(False)

layout_manager = QgsProject.instance().layoutManager()
layout_names = [layout.name() for layout in layout_manager.printLayouts()]
self.layouts_model.refresh_stringlist(layout_names)
self.layouts_view.setVisible(self.layouts_model.rowCount())
self.layouts_label.setVisible(self.layouts_model.rowCount())

if not (
self.mapthemes_model.rowCount()
or self.variables_model.rowCount()
or self.layouts_model.rowCount()
):
self.topping_wizard.log_panel.print_info(
self.tr("No additive settings - go on...")
)
self.topping_wizard.next()
return super().initializePage()

def validatePage(self) -> bool:
Expand All @@ -88,4 +107,8 @@ def validatePage(self) -> bool:
self.topping_wizard.topping.export_settings.layouts = (
self.layouts_model.checked_entries()
)
if self.validatortopping_checkbox.isChecked():
self.topping_wizard.topping.export_settings.path_variables = [
VALIDATION_VARIABLE
]
return super().validatePage()
77 changes: 42 additions & 35 deletions QgisModelBaker/ui/topping_wizard/additives.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,40 @@
<string>Select Files</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="variables_label">
<property name="text">
<string>Custom Project Variables</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="SpaceCheckListView" name="variables_view" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="SpaceCheckListView" name="layouts_view" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QLabel" name="layouts_label">
<property name="text">
<string>Print Layouts (exported as templates)</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="description">
<property name="minimumSize">
Expand All @@ -39,35 +73,15 @@
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="SpaceCheckListView" name="mapthemes_view" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="variables_label">
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="mapthemes_label">
<property name="text">
<string>Custom Project Variables</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="SpaceCheckListView" name="layouts_view" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<string>Map Themes</string>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="SpaceCheckListView" name="variables_view" native="true">
<item row="2" column="0" colspan="2">
<widget class="SpaceCheckListView" name="mapthemes_view" native="true">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
Expand All @@ -76,17 +90,10 @@
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="layouts_label">
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="validatortopping_checkbox">
<property name="text">
<string>Print Layouts (exported as templates)</string>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="mapthemes_label">
<property name="text">
<string>Map Themes</string>
<string>Convert validation configuration file to topping file</string>
</property>
</widget>
</item>
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.5")
MODELBAKER_LIBRARY=("modelbaker" "1.9.6")
PACKAGING=("packaging" "21.3")

PACKAGES=(
Expand Down

0 comments on commit b4eda32

Please sign in to comment.