Skip to content

Commit 06e6e71

Browse files
committedNov 17, 2014
[processing] update range input widget
1 parent c9a90d9 commit 06e6e71

File tree

2 files changed

+103
-24
lines changed

2 files changed

+103
-24
lines changed
 

‎python/plugins/processing/gui/RangePanel.py

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,33 +25,20 @@
2525

2626
__revision__ = '$Format:%H$'
2727

28-
from PyQt4 import QtGui
28+
from PyQt4.QtGui import *
2929

30+
from processing.ui.ui_widgetRangeSelector import Ui_Form
3031

31-
class RangePanel(QtGui.QWidget):
32+
33+
class RangePanel(QWidget, Ui_Form):
3234

3335
def __init__(self, param):
34-
super(RangePanel, self).__init__(None)
35-
self.horizontalLayout = QtGui.QHBoxLayout(self)
36-
self.horizontalLayout.setSpacing(2)
37-
self.horizontalLayout.setMargin(0)
38-
self.labelmin = QtGui.QLabel()
39-
self.labelmin.setText(self.tr('Min'))
40-
self.textmin = QtGui.QLineEdit()
41-
self.textmin.setSizePolicy(QtGui.QSizePolicy.Expanding,
42-
QtGui.QSizePolicy.Expanding)
43-
self.labelmax = QtGui.QLabel()
44-
self.labelmax.setText(self.tr('Max'))
45-
self.textmax = QtGui.QLineEdit()
46-
self.textmin.setText(param.default.split(',')[0])
47-
self.textmax.setText(param.default.split(',')[1])
48-
self.textmax.setSizePolicy(QtGui.QSizePolicy.Expanding,
49-
QtGui.QSizePolicy.Expanding)
50-
self.horizontalLayout.addWidget(self.labelmin)
51-
self.horizontalLayout.addWidget(self.textmin)
52-
self.horizontalLayout.addWidget(self.labelmax)
53-
self.horizontalLayout.addWidget(self.textmax)
54-
self.setLayout(self.horizontalLayout)
36+
QWidget.__init__(self)
37+
self.setupUi(self)
38+
39+
values = param.default.split(',')
40+
self.spnMin.setValue(float(values[0]))
41+
self.spnMax.setValue(float(values[1]))
5542

5643
def getValue(self):
57-
return self.textmin.text() + ',' + self.textmax.text()
44+
return '{},{}'.format(self.spnMin.value(), self.spnMax.value())
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>Form</class>
4+
<widget class="QWidget" name="Form">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>345</width>
10+
<height>23</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Form</string>
15+
</property>
16+
<layout class="QHBoxLayout" name="horizontalLayout">
17+
<property name="spacing">
18+
<number>2</number>
19+
</property>
20+
<property name="margin">
21+
<number>0</number>
22+
</property>
23+
<item>
24+
<widget class="QLabel" name="label">
25+
<property name="text">
26+
<string>Min</string>
27+
</property>
28+
</widget>
29+
</item>
30+
<item>
31+
<widget class="QDoubleSpinBox" name="spnMin">
32+
<property name="sizePolicy">
33+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
34+
<horstretch>0</horstretch>
35+
<verstretch>0</verstretch>
36+
</sizepolicy>
37+
</property>
38+
<property name="decimals">
39+
<number>6</number>
40+
</property>
41+
<property name="minimum">
42+
<double>-99999999.999999001622200</double>
43+
</property>
44+
<property name="maximum">
45+
<double>99999999.999999001622200</double>
46+
</property>
47+
</widget>
48+
</item>
49+
<item>
50+
<spacer name="horizontalSpacer">
51+
<property name="orientation">
52+
<enum>Qt::Horizontal</enum>
53+
</property>
54+
<property name="sizeHint" stdset="0">
55+
<size>
56+
<width>64</width>
57+
<height>20</height>
58+
</size>
59+
</property>
60+
</spacer>
61+
</item>
62+
<item>
63+
<widget class="QLabel" name="label_2">
64+
<property name="text">
65+
<string>Max</string>
66+
</property>
67+
</widget>
68+
</item>
69+
<item>
70+
<widget class="QDoubleSpinBox" name="spnMax">
71+
<property name="sizePolicy">
72+
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
73+
<horstretch>0</horstretch>
74+
<verstretch>0</verstretch>
75+
</sizepolicy>
76+
</property>
77+
<property name="decimals">
78+
<number>6</number>
79+
</property>
80+
<property name="minimum">
81+
<double>-99999999.999999001622200</double>
82+
</property>
83+
<property name="maximum">
84+
<double>99999999.999999001622200</double>
85+
</property>
86+
</widget>
87+
</item>
88+
</layout>
89+
</widget>
90+
<resources/>
91+
<connections/>
92+
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.