Skip to content

Commit

Permalink
[processing] harmonize and improve UI spacing
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvn authored Dec 27, 2017
1 parent 9fb386a commit 3b89052
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
8 changes: 5 additions & 3 deletions python/plugins/processing/gui/ParametersPanel.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
from qgis.PyQt import uic
from qgis.PyQt.QtCore import QCoreApplication, Qt
from qgis.PyQt.QtWidgets import (QWidget, QHBoxLayout, QToolButton,
QLabel, QCheckBox)
QLabel, QCheckBox, QSizePolicy)
from qgis.PyQt.QtGui import QIcon

from processing.gui.DestinationSelectionPanel import DestinationSelectionPanel
Expand All @@ -66,6 +66,7 @@ def __init__(self, parent, alg):

self.grpAdvanced.hide()

self.scrollAreaWidgetContents.setContentsMargins(4, 4, 4, 4)
self.layoutMain = self.scrollAreaWidgetContents.layout()
self.layoutAdvanced = self.grpAdvanced.layout()

Expand Down Expand Up @@ -122,12 +123,13 @@ def initWidgets(self):
if widget is not None:
if isinstance(param, QgsProcessingParameterFeatureSource):
layout = QHBoxLayout()
layout.setSpacing(2)
layout.setSpacing(6)
layout.setMargin(0)
layout.addWidget(widget)
button = QToolButton()
icon = QIcon(os.path.join(pluginPath, 'images', 'iterate.png'))
button.setIcon(icon)
button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
button.setToolTip(self.tr('Iterate over this layer, creating a separate output for every feature in the layer'))
button.setCheckable(True)
layout.addWidget(button)
Expand All @@ -139,7 +141,7 @@ def initWidgets(self):

widget.setToolTip(param.toolTip())

if type(widget) is QCheckBox:
if isinstance(widget, QCheckBox):
# checkbox widget - so description is embedded in widget rather than a separate
# label
widget.setText(desc)
Expand Down
14 changes: 7 additions & 7 deletions python/plugins/processing/gui/wrappers.py
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ def createWidget(self):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
layout.addWidget(self.combo)
btn = QToolButton()
btn.setText('…')
Expand Down Expand Up @@ -709,7 +709,7 @@ def createWidget(self):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
self.combo = QgsMapLayerComboBox()
layout.addWidget(self.combo)
btn = QToolButton()
Expand Down Expand Up @@ -751,7 +751,7 @@ def createWidget(self):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
layout.addWidget(self.combo)
btn = QToolButton()
btn.setText('…')
Expand Down Expand Up @@ -878,7 +878,7 @@ def createWidget(self):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
self.combo = QgsMapLayerComboBox()
layout.addWidget(self.combo)
layout.setAlignment(self.combo, Qt.AlignTop)
Expand All @@ -892,7 +892,7 @@ def createWidget(self):
vl = QVBoxLayout()
vl.setMargin(0)
vl.setContentsMargins(0, 0, 0, 0)
vl.setSpacing(2)
vl.setSpacing(6)
vl.addLayout(layout)

self.use_selection_checkbox = QCheckBox(self.tr('Selected features only'))
Expand Down Expand Up @@ -1181,7 +1181,7 @@ def createWidget(self):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
self.combo = QgsMapLayerComboBox()
layout.addWidget(self.combo)
btn = QToolButton()
Expand Down Expand Up @@ -1238,7 +1238,7 @@ def createWidget(self):
layout = QHBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(2)
layout.setSpacing(6)
layout.addWidget(self.combo)
btn = QToolButton()
btn.setText('…')
Expand Down
4 changes: 2 additions & 2 deletions python/plugins/processing/ui/widgetBaseSelector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
<number>6</number>
</property>
<property name="margin">
<number>0</number>
Expand All @@ -39,7 +39,7 @@
</sizepolicy>
</property>
<property name="text">
<string>...</string>
<string></string>
</property>
</widget>
</item>
Expand Down
6 changes: 3 additions & 3 deletions python/plugins/processing/ui/widgetLayerSelector.ui
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
</sizepolicy>
</property>
<property name="text">
<string>...</string>
<string></string>
</property>
</widget>
</item>
Expand All @@ -48,14 +48,14 @@
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
<verstretch>1</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Iterate over this layer</string>
</property>
<property name="text">
<string>...</string>
<string></string>
</property>
<property name="checkable">
<bool>true</bool>
Expand Down

0 comments on commit 3b89052

Please sign in to comment.