Skip to content

Commit

Permalink
Merge pull request #825 from opengisch/extended-model-optimization
Browse files Browse the repository at this point in the history
GUI for extended model optimization
  • Loading branch information
signedav authored Oct 5, 2023
2 parents 8f24470 + d56f837 commit 98017b2
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 23 deletions.
12 changes: 12 additions & 0 deletions QgisModelBaker/gui/workflow_wizard/project_creation_page.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from QgisModelBaker.libs.modelbaker.generator.generator import Generator
from QgisModelBaker.libs.modelbaker.iliwrapper.globals import DbIliMode
from QgisModelBaker.libs.modelbaker.iliwrapper.ilicache import IliToppingFileItemModel
from QgisModelBaker.libs.modelbaker.utils.globals import OptimizeStrategy
from QgisModelBaker.utils import gui_utils
from QgisModelBaker.utils.globals import CATALOGUE_DATASETNAME
from QgisModelBaker.utils.gui_utils import LogColor
Expand All @@ -48,6 +49,15 @@ def __init__(self, parent, title):
self.setTitle(title)
self.setStyleSheet(gui_utils.DEFAULT_STYLE)

self.optimize_combo.clear()
self.optimize_combo.addItem(
self.tr("Hide unused base class layers"), OptimizeStrategy.HIDE
)
self.optimize_combo.addItem(
self.tr("Group unused base class layers"), OptimizeStrategy.GROUP
)
self.optimize_combo.addItem(self.tr("No optimization"), OptimizeStrategy.NONE)

self.db_simple_factory = DbSimpleFactory()
self.configuration = None

Expand All @@ -74,6 +84,7 @@ def _create_project(self):
self.configuration.dbschema,
mgmt_uri=mgmt_uri,
consider_basket_handling=True,
optimize_strategy=self.optimize_combo.currentData(),
)
generator.stdout.connect(self.workflow_wizard.log_panel.print_info)
generator.new_message.connect(self.workflow_wizard.log_panel.show_message)
Expand Down Expand Up @@ -263,6 +274,7 @@ def _create_project(self):
or custom_project_properties.get("transaction_mode", "")
== "AutomaticGroups",
context={"catalogue_datasetname": CATALOGUE_DATASETNAME},
optimize_strategy=self.optimize_combo.currentData(),
)
project.layers = available_layers
project.relations = relations
Expand Down
88 changes: 66 additions & 22 deletions QgisModelBaker/ui/workflow_wizard/project_creation.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,63 @@
<string>Select Files</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="1">
<widget class="QComboBox" name="optimize_combo">
<property name="sizePolicy">
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Hide unused base class layers:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;- Base class layers with same named extensions will be &lt;span style=&quot; font-style:italic;&quot;&gt;hidden&lt;/span&gt; and and base class layers with multiple extensions as well. Except if the extension is in the same model, then it's will &lt;span style=&quot; font-style:italic;&quot;&gt;not&lt;/span&gt; be &lt;span style=&quot; font-style:italic;&quot;&gt;hidden&lt;/span&gt; but &lt;span style=&quot; font-style:italic;&quot;&gt;renamed&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;- Relations of hidden layers will &lt;span style=&quot; font-style:italic;&quot;&gt;not&lt;/span&gt; be &lt;span style=&quot; font-style:italic;&quot;&gt;created&lt;/span&gt; and with them &lt;span style=&quot; font-style:italic;&quot;&gt;no&lt;/span&gt; widgets&lt;br/&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Group unused base class layers:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;- Base class layers with same named extensions will be &lt;span style=&quot; font-style:italic;&quot;&gt;collected in a group&lt;/span&gt; and base class layers with multiple extensions as well. Except if the extension is in the same model, then it's will &lt;span style=&quot; font-style:italic;&quot;&gt;not&lt;/span&gt; be &lt;span style=&quot; font-style:italic;&quot;&gt;grouped&lt;/span&gt; but &lt;span style=&quot; font-style:italic;&quot;&gt;renamed&lt;/span&gt;.&lt;/p&gt;&lt;p&gt;- Relations of grouped layers will be &lt;span style=&quot; font-style:italic;&quot;&gt;created&lt;/span&gt; but the widgets &lt;span style=&quot; font-style:italic;&quot;&gt;notapplied&lt;/span&gt; to the form.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<item>
<property name="text">
<string>Hide unused base class layers</string>
</property>
</item>
<item>
<property name="text">
<string>Group unused base class layers</string>
</property>
</item>
<item>
<property name="text">
<string>No optimization</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;If you don't get it - nevermind and keep the default. If it's not like expected - try again with 'No optimization'...&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Project optimization strategy concerning inheritances</string>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="description">
<property name="minimumSize">
Expand All @@ -39,27 +96,7 @@
</property>
</widget>
</item>
<item row="4" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
<item row="2" column="0" colspan="2">
<widget class="QProgressBar" name="progress_bar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item row="5" column="0">
<item row="6" column="0">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
Expand All @@ -72,13 +109,20 @@
</property>
</spacer>
</item>
<item row="5" column="1">
<item row="6" column="1">
<widget class="QCommandLinkButton" name="create_project_button">
<property name="text">
<string>Generate</string>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QProgressBar" name="progress_bar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
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.4.4")
MODELBAKER_LIBRARY=("modelbaker" "1.5.0")
PACKAGING=("packaging" "21.3")

PACKAGES=(
Expand Down

0 comments on commit 98017b2

Please sign in to comment.