Skip to content

Commit

Permalink
Merge pull request #585 from kartoza/timlinux/issue577
Browse files Browse the repository at this point in the history
Implement Make the select country more clear #577
  • Loading branch information
timlinux authored Nov 8, 2024
2 parents 4e1fc09 + 435d75e commit cc493d2
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 25 deletions.
20 changes: 20 additions & 0 deletions geest/gui/panels/setup_panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,28 @@ def initUI(self):
self.working_dir = self.previous_project_combo.currentText()
self.set_project_directory()

self.load_boundary_button.clicked.connect(self.load_boundary)

self.progress_bar.setVisible(False)

def load_boundary(self):
"""Load a boundary layer from a file."""
file_dialog = QFileDialog()
file_dialog.setFileMode(QFileDialog.ExistingFile)
file_dialog.setNameFilter("Shapefile (*.shp);;GeoPackage (*.gpkg)")
if file_dialog.exec_():
file_path = file_dialog.selectedFiles()[0]
layer = QgsVectorLayer(file_path, "Boundary", "ogr")
if not layer.isValid():
QMessageBox.critical(
self, "Error", "Could not load the boundary layer."
)
return
# Load the layer in QGIS
QgsProject.instance().addMapLayer(layer)
self.layer_combo.setLayer(layer)
self.field_combo.setLayer(layer)

def select_directory(self):
directory = QFileDialog.getExistingDirectory(
self, "Select Working Directory", self.working_dir
Expand Down
57 changes: 32 additions & 25 deletions geest/ui/setup_panel_base.ui
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="banner_label">
<property name="text">
<string/>
Expand All @@ -27,7 +27,7 @@
</property>
</widget>
</item>
<item>
<item row="1" column="0">
<widget class="QLabel" name="label_2">
<property name="text">
<string>**Geospatial Assessment of Women Employment and Business Opportunities in the Renewable Energy Sector**</string>
Expand All @@ -43,14 +43,14 @@
</property>
</widget>
</item>
<item>
<item row="2" column="0">
<widget class="Line" name="line">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="text">
<string>To get started, we need to select a project folder. The contents of this folder will be managed by Geest. It will store the project file and the working analysis results.</string>
Expand All @@ -63,7 +63,7 @@
</property>
</widget>
</item>
<item>
<item row="4" column="0">
<widget class="QPushButton" name="open_existing_project_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
Expand All @@ -76,7 +76,7 @@
</property>
</widget>
</item>
<item>
<item row="5" column="0">
<widget class="QToolButton" name="create_new_project_button">
<property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed">
Expand All @@ -89,7 +89,7 @@
</property>
</widget>
</item>
<item>
<item row="6" column="0">
<widget class="QGroupBox" name="open_project_group">
<property name="title">
<string>Open an existing project folder</string>
Expand All @@ -115,13 +115,13 @@
</layout>
</widget>
</item>
<item>
<item row="7" column="0">
<widget class="QGroupBox" name="new_project_group">
<property name="title">
<string>Start a new project</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="project_path_label">
<property name="text">
<string>The folder you select should be empty.</string>
Expand All @@ -131,14 +131,14 @@
</property>
</widget>
</item>
<item>
<item row="1" column="0" colspan="2">
<widget class="QPushButton" name="create_project_directory_button">
<property name="text">
<string>📂 Create or select a project directory</string>
</property>
</widget>
</item>
<item>
<item row="2" column="0" colspan="2">
<widget class="QLabel" name="label_8">
<property name="text">
<string>If you do not have a boundary layer you can quickly add one using the button below:</string>
Expand All @@ -148,14 +148,14 @@
</property>
</widget>
</item>
<item>
<item row="3" column="0" colspan="2">
<widget class="QPushButton" name="world_map_button">
<property name="text">
<string>Add World Layer</string>
</property>
</widget>
</item>
<item>
<item row="4" column="0" colspan="2">
<widget class="QLabel" name="label_6">
<property name="text">
<string>For new projects you need to select a boundary layer ...</string>
Expand All @@ -165,10 +165,17 @@
</property>
</widget>
</item>
<item>
<item row="5" column="0">
<widget class="QgsMapLayerComboBox" name="layer_combo"/>
</item>
<item>
<item row="5" column="1">
<widget class="QToolButton" name="load_boundary_button">
<property name="text">
<string>...</string>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QLabel" name="label_7">
<property name="text">
<string>... and the boundary name column:</string>
Expand All @@ -178,17 +185,17 @@
</property>
</widget>
</item>
<item>
<item row="7" column="0" colspan="2">
<widget class="QgsFieldComboBox" name="field_combo"/>
</item>
<item>
<item row="8" column="0" colspan="2">
<widget class="QCheckBox" name="use_boundary_crs">
<property name="text">
<string>Use Coordinate Reference System of your boundary layer</string>
</property>
</widget>
</item>
<item>
<item row="9" column="0" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="cell_size_spinbox">
Expand Down Expand Up @@ -218,7 +225,7 @@
</item>
</layout>
</item>
<item>
<item row="10" column="0" colspan="2">
<widget class="QLabel" name="label_9">
<property name="text">
<string>If needed, use the QGIS selection tool to **select your areas of interest** and then press continue to prepare the project. This may take a few minutes....</string>
Expand All @@ -231,7 +238,7 @@
</property>
</widget>
</item>
<item>
<item row="11" column="0" colspan="2">
<widget class="QPushButton" name="prepare_project_button">
<property name="text">
<string>⚙️ Prepare project</string>
Expand All @@ -241,7 +248,7 @@
</layout>
</widget>
</item>
<item>
<item row="8" column="0">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
Expand All @@ -254,14 +261,14 @@
</property>
</spacer>
</item>
<item>
<item row="9" column="0">
<widget class="QProgressBar" name="progress_bar">
<property name="value">
<number>0</number>
</property>
</widget>
</item>
<item>
<item row="11" column="0">
<widget class="QLabel" name="label_5">
<property name="text">
<string>This plugin is built with support from the Canada Clean Energy and Forest Climate Facility (CCEFCFy), the Geospatial Operational Support Team (GOST, DECSC) for the project Geospatial Assessment of Women Employment and Business Opportunities in the Renewable Energy Sector. </string>
Expand Down

0 comments on commit cc493d2

Please sign in to comment.