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

Export ValidationConfig File as Topping #998

Merged
merged 4 commits into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
19 changes: 19 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()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice one

return super().initializePage()

def validatePage(self) -> bool:
Expand Down
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
Loading