From 779243c7c52ff9bfba74a1b0804d4356319b89b4 Mon Sep 17 00:00:00 2001 From: fdobad <8339628-fdobad@users.noreply.gitlab.com> Date: Wed, 9 Oct 2024 14:10:55 -0300 Subject: [PATCH 1/3] two groups --- pan_batido/pan_batido_dialog.py | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/pan_batido/pan_batido_dialog.py b/pan_batido/pan_batido_dialog.py index 420da7a..a898a18 100644 --- a/pan_batido/pan_batido_dialog.py +++ b/pan_batido/pan_batido_dialog.py @@ -27,7 +27,7 @@ from qgis.core import Qgis from qgis.PyQt.QtCore import Qt -from qgis.PyQt.QtWidgets import (QCheckBox, QComboBox, QDialog, +from qgis.PyQt.QtWidgets import (QCheckBox, QComboBox, QDialog, QGroupBox, QDialogButtonBox, QGridLayout, QHBoxLayout, QLabel, QSizePolicy, QSlider, QSpacerItem, QSpinBox, QVBoxLayout, QWidget) @@ -47,8 +47,9 @@ def __init__(self, parent=None): self.setLayout(self.verticalLayout) # each row is a name | weight | resample | utility function + self.input_groupbox = QGroupBox('Input rasters') self.grid = QGridLayout() - self.grid.addWidget(QLabel("raster"), 0, 0) + self.grid.addWidget(QLabel("name"), 0, 0) self.grid.addWidget(QLabel("weight"), 0, 1) self.grid.addWidget(QLabel("resample/interpolation algo."), 0, 2) self.grid.addWidget(QLabel("utility func."), 0, 3) @@ -144,33 +145,36 @@ def __init__(self, parent=None): "b_slider": b_slider, } ] - self.verticalLayout.addLayout(self.grid) + self.input_groupbox.setLayout(self.grid) + self.verticalLayout.addWidget(self.input_groupbox) self.verticalLayout.addItem(QSpacerItem(1, 1, QSizePolicy.Minimum, QSizePolicy.Expanding)) # target resolution x,y; pixel size, data type - self.target_layout = QHBoxLayout() - self.target_layout.addWidget(QLabel("target resolution width[px]:")) + self.target_groupbox = QGroupBox('Output configuration') + self.target_layout = QGridLayout() + self.target_layout.addWidget(QLabel("width [px]:"), 0, 0) self.resolution_x = QSpinBox() self.resolution_x.setRange(1, 2147483647) self.resolution_x.setValue(1920) - self.target_layout.addWidget(self.resolution_x) - self.target_layout.addWidget(QLabel("height[px]:")) + self.target_layout.addWidget(self.resolution_x, 0, 1) + self.target_layout.addWidget(QLabel("height [px]:"), 1, 0) self.resolution_y = QSpinBox() self.resolution_y.setRange(1, 2147483647) self.resolution_y.setValue(1080) - self.target_layout.addWidget(self.resolution_y) - self.target_layout.addWidget(QLabel("pixel size[m]:")) + self.target_layout.addWidget(self.resolution_y, 1, 1) + self.target_layout.addWidget(QLabel("pixel size [m]:"), 0, 2) self.pixel_size = QSpinBox() self.pixel_size.setRange(1, 2147483647) self.pixel_size.setValue(100) - self.target_layout.addWidget(self.pixel_size) - self.target_layout.addWidget(QLabel("data type:")) + self.target_layout.addWidget(self.pixel_size, 0, 3) + self.target_layout.addWidget(QLabel("data type:"), 1, 2) self.data_type = QComboBox() self.data_type.addItems(list(DATATYPES.keys())) self.data_type.setCurrentIndex(2) - self.target_layout.addWidget(self.data_type) - self.verticalLayout.addLayout(self.target_layout) + self.target_layout.addWidget(self.data_type, 1, 3) + self.target_groupbox.setLayout(self.target_layout) + self.verticalLayout.addWidget(self.target_groupbox) # add a QtButtonBox to the bottom of the dialog with Ok, and Cancel self.buttonBox = QDialogButtonBox( From a11fbd89a184fac18436590fa4c2bb0942bce829 Mon Sep 17 00:00:00 2001 From: fdobad <8339628-fdobad@users.noreply.gitlab.com> Date: Wed, 9 Oct 2024 14:19:45 -0300 Subject: [PATCH 2/3] fix ok => result == 1 --- pan_batido/pan_batido.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pan_batido/pan_batido.py b/pan_batido/pan_batido.py index ba827c7..b49ee02 100644 --- a/pan_batido/pan_batido.py +++ b/pan_batido/pan_batido.py @@ -236,7 +236,7 @@ def run(self): result = self.dlg.exec_() # qprint(f"{result=} {self.dlg.DialogCode()=}") # See if OK was pressed - if result: + if result == 1: self.dlg.rescale_weights() extent = self.iface.mapCanvas().extent() From f53ec6e09285f1cfb8561da2fc8d8165992af2cf Mon Sep 17 00:00:00 2001 From: fdobad <8339628-fdobad@users.noreply.gitlab.com> Date: Wed, 9 Oct 2024 14:24:03 -0300 Subject: [PATCH 3/3] changelog --- pan_batido/metadata.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/pan_batido/metadata.txt b/pan_batido/metadata.txt index 5ce03dc..6e93e10 100644 --- a/pan_batido/metadata.txt +++ b/pan_batido/metadata.txt @@ -15,6 +15,7 @@ hasProcessingProvider=no # Uncomment the following line and add your changelog: changelog= + 0.0.3 UI grouped in inputs and outputs, bug fix on dialog always calculating 0.0.2 Handling of nans and nodatas, qgis pseudocolor painting and no resample option 0.0.1 Initial: only happy path implemented! Don't edge case it!