Skip to content

Commit

Permalink
Default index score should produce floats
Browse files Browse the repository at this point in the history
  • Loading branch information
timlinux committed Dec 2, 2024
1 parent e6e2efa commit 28beb8f
Show file tree
Hide file tree
Showing 4 changed files with 415 additions and 127 deletions.
2 changes: 1 addition & 1 deletion geest/core/workflows/default_index_score_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def __init__(
super().__init__(
item, cell_size_m, feedback, context
) # ⭐️ Item is a reference - whatever you change in this item will directly update the tree
self.index_score = int(
self.index_score = float(
(self.attributes.get("default_index_score", 0) / 100) * 5
)
self.features_layer = True # Normally we would set this to a QgsVectorLayer but in this workflow it is not needed
Expand Down
6 changes: 6 additions & 0 deletions geest/gui/panels/create_project_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ def initUI(self):
self.banner_label.setPixmap(
QPixmap(resources_path("resources", "geest-banner.png"))
)
self.folder_status_label.setPixmap(
QPixmap(resources_path("resources", "icons", "failed.svg"))
)
self.layer_combo.setFilters(QgsMapLayerProxyModel.PolygonLayer)

# self.field_combo = QgsFieldComboBox() # QgsFieldComboBox for selecting fields
Expand Down Expand Up @@ -109,6 +112,9 @@ def create_new_project_folder(self):
) # Update last used project
self.project_path_label.setText(directory)
self.create_project_directory_button.setText("📂 Change Project Folder")
self.folder_status_label.setPixmap(
QPixmap(resources_path("resources", "icons", "completed-success.svg"))
)

def create_project(self):
"""Triggered when the Continue button is pressed."""
Expand Down
272 changes: 146 additions & 126 deletions geest/ui/create_project_panel_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -14,44 +14,88 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="12" column="0" colspan="2">
<widget class="QSpinBox" name="cell_size_spinbox">
<property name="enabled">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="banner_label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>../resources/geest-banner.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;GEEST Project Creation&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="minimum">
<number>10</number>
</property>
<property name="maximum">
<number>100000</number>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;A GEEST project is simply a folder with files that are managed by the GEEST plugin. The outputs and working files created during the analysis will be stored in this folder. &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;It needs to be an empty folder that contains no other files.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="singleStep">
<number>100</number>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
</property>
<property name="value">
<number>100</number>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="project_path_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string/>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Now select a layer containing the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Admin0&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; boundary for your study area and the column in your dataset with the name of our area.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="8" column="1">
<item row="7" column="0">
<widget class="QgsMapLayerComboBox" name="layer_combo">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
</widget>
</item>
<item row="7" column="1">
<widget class="QToolButton" name="load_boundary_button">
<property name="font">
<font>
Expand All @@ -63,7 +107,14 @@
</property>
</widget>
</item>
<item row="11" column="0" colspan="2">
<item row="9" column="0">
<widget class="QCheckBox" name="use_boundary_crs">
<property name="text">
<string>Use Coordinate Reference System of your boundary layer</string>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QLabel" name="label">
<property name="enabled">
<bool>true</bool>
Expand All @@ -82,32 +133,85 @@
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<item row="12" 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="11" column="0" colspan="2">
<widget class="QSpinBox" name="cell_size_spinbox">
<property name="enabled">
<bool>true</bool>
</property>
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;Now select a layer containing the &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;Admin0&lt;/span&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt; boundary for your study area and the column in your dataset with the name of our area.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<property name="minimum">
<number>10</number>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
<property name="maximum">
<number>100000</number>
</property>
<property name="wordWrap">
<bool>true</bool>
<property name="singleStep">
<number>100</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<item row="8" column="0" colspan="2">
<widget class="QgsFieldComboBox" name="field_combo">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
</widget>
</item>
<item row="14" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="folder_status_label">
<property name="maximumSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property>
<property name="text">
<string>TextLabel</string>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="create_project_directory_button">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>📂 Create or select a project directory</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="13" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="previous_button">
Expand Down Expand Up @@ -166,101 +270,17 @@
</item>
</layout>
</item>
<item row="8" column="0">
<widget class="QgsMapLayerComboBox" name="layer_combo">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<widget class="QCheckBox" name="use_boundary_crs">
<property name="text">
<string>Use Coordinate Reference System of your boundary layer</string>
<item row="5" column="0" colspan="2">
<widget class="QLabel" name="project_path_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="banner_label">
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap>../resources/geest-banner.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="0" colspan="2">
<widget class="QgsFieldComboBox" name="field_combo">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
</widget>
</item>
<item row="3" column="0" colspan="2">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-size:12pt;&quot;&gt;A GEEST project is simply a folder with files that are managed by the GEEST plugin. The outputs and working files created during the analysis will be stored in this folder. &lt;/span&gt;&lt;span style=&quot; font-size:12pt; font-weight:600;&quot;&gt;It needs to be an empty folder that contains no other files.&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="alignment">
<set>Qt::AlignJustify|Qt::AlignTop</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QLabel" name="label_2">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p align=&quot;center&quot;&gt;&lt;span style=&quot; font-size:16pt; font-weight:600;&quot;&gt;GEEST Project Creation&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item row="13" column="0" colspan="2">
<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="4" column="0" colspan="2">
<widget class="QPushButton" name="create_project_directory_button">
<property name="font">
<font>
<pointsize>16</pointsize>
</font>
</property>
<property name="text">
<string>📂 Create or select a project directory</string>
</property>
</widget>
</item>
</layout>
Expand Down
Loading

0 comments on commit 28beb8f

Please sign in to comment.