-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathutilitiesForExamples.py
More file actions
42 lines (37 loc) · 2.09 KB
/
utilitiesForExamples.py
File metadata and controls
42 lines (37 loc) · 2.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from qtpy import QtWidgets
from eqt.ui import UISliderWidget
def list_all_widgets():
list_all_widgets = {
'label': QtWidgets.QLabel('test label'), 'checkBox': QtWidgets.QCheckBox('test checkbox'),
'comboBox': QtWidgets.QComboBox(), 'doubleSpinBox': QtWidgets.QDoubleSpinBox(),
'spinBox': QtWidgets.QSpinBox(), 'slider': QtWidgets.QSlider(),
'uiSliderWidget': UISliderWidget.UISliderWidget(minimum=-0.5, maximum=0.5),
'radioButton': QtWidgets.QRadioButton('test radio button'),
'textEdit': QtWidgets.QTextEdit('test text edit'),
'plainTextEdit': QtWidgets.QPlainTextEdit('test plain text edit'),
'lineEdit': QtWidgets.QLineEdit('test line edit'),
'button': QtWidgets.QPushButton('test push button')}
return list_all_widgets
def addWidgetsToExample(form):
'''
Adds a spanning widget and every type of widget to a form
'''
# add a spanning widget
form.addSpanningWidget(QtWidgets.QLabel("Input Values: "), 'input_title')
# add all widgets
form.addWidget(QtWidgets.QLabel('Label'), 'Label: ', 'label')
form.addWidget(QtWidgets.QCheckBox('check me'), 'CheckBox: ', 'checkBox')
qwidget = QtWidgets.QComboBox()
combobox_list = ['choice 1', 'choice 2']
qwidget.addItems(combobox_list)
form.addWidget(qwidget, 'ComboBox: ', 'comboBox')
form.addWidget(QtWidgets.QDoubleSpinBox(), 'DoubleSpinBox: ', 'doubleSpinBox')
form.addWidget(QtWidgets.QSpinBox(), 'SpinBox: ', 'spinBox')
form.addWidget(QtWidgets.QSlider(), 'Slider: ', 'slider')
form.addWidget(UISliderWidget.UISliderWidget(minimum=-0.5, maximum=0.5), 'UISliderWidget: ',
'uiSliderWidget')
form.addWidget(QtWidgets.QRadioButton('select me'), 'RadioButton: ', 'radioButton')
form.addWidget(QtWidgets.QTextEdit('write text here'), 'TextEdit: ', 'textEdit')
form.addWidget(QtWidgets.QPlainTextEdit('write text here'), 'PlainTextEdit: ', 'plainTextEdit')
form.addWidget(QtWidgets.QLineEdit('write text here'), 'LineEdit: ', 'lineEdit')
form.addWidget(QtWidgets.QPushButton('Click me'), 'Button: ', 'button')