Skip to content
Permalink
Browse files

[processing] update range input widget

  • Loading branch information
alexbruy committed Nov 8, 2014
1 parent c9a90d9 commit 06e6e718414f13c2711e0ca6fee7d8b6b5ca9bd0
Showing with 103 additions and 24 deletions.
  1. +11 −24 python/plugins/processing/gui/RangePanel.py
  2. +92 −0 python/plugins/processing/ui/widgetRangeSelector.ui
@@ -25,33 +25,20 @@

__revision__ = '$Format:%H$'

from PyQt4 import QtGui
from PyQt4.QtGui import *

from processing.ui.ui_widgetRangeSelector import Ui_Form

class RangePanel(QtGui.QWidget):

class RangePanel(QWidget, Ui_Form):

def __init__(self, param):
super(RangePanel, self).__init__(None)
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.labelmin = QtGui.QLabel()
self.labelmin.setText(self.tr('Min'))
self.textmin = QtGui.QLineEdit()
self.textmin.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
self.labelmax = QtGui.QLabel()
self.labelmax.setText(self.tr('Max'))
self.textmax = QtGui.QLineEdit()
self.textmin.setText(param.default.split(',')[0])
self.textmax.setText(param.default.split(',')[1])
self.textmax.setSizePolicy(QtGui.QSizePolicy.Expanding,
QtGui.QSizePolicy.Expanding)
self.horizontalLayout.addWidget(self.labelmin)
self.horizontalLayout.addWidget(self.textmin)
self.horizontalLayout.addWidget(self.labelmax)
self.horizontalLayout.addWidget(self.textmax)
self.setLayout(self.horizontalLayout)
QWidget.__init__(self)
self.setupUi(self)

values = param.default.split(',')
self.spnMin.setValue(float(values[0]))
self.spnMax.setValue(float(values[1]))

def getValue(self):
return self.textmin.text() + ',' + self.textmax.text()
return '{},{}'.format(self.spnMin.value(), self.spnMax.value())
@@ -0,0 +1,92 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Form</class>
<widget class="QWidget" name="Form">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>345</width>
<height>23</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Min</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="spnMin">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-99999999.999999001622200</double>
</property>
<property name="maximum">
<double>99999999.999999001622200</double>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>64</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Max</string>
</property>
</widget>
</item>
<item>
<widget class="QDoubleSpinBox" name="spnMax">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="decimals">
<number>6</number>
</property>
<property name="minimum">
<double>-99999999.999999001622200</double>
</property>
<property name="maximum">
<double>99999999.999999001622200</double>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

0 comments on commit 06e6e71

Please sign in to comment.
You can’t perform that action at this time.