Skip to content

Commit

Permalink
added example panel
Browse files Browse the repository at this point in the history
  • Loading branch information
physics group account committed Jun 20, 2020
1 parent acc37f6 commit 26c8519
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 0 deletions.
23 changes: 23 additions & 0 deletions example/example.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from pydm import Display
from PyQt5 import QtGui

class Example(Display):

def __init__(self, parent=None, args=None):
super(Example, self).__init__(parent=parent, args=args)
self.ui.testButton.clicked.connect(lambda:self.updateOutput("Button Pushed"))
self.ui.testCheckBox.stateChanged.connect(self.buttonToggled)

def ui_filename(self):
return 'example.ui'

def updateOutput(self, output):
print(output)
self.ui.outputBox.setText(output)

def buttonToggled(self):
self.ui.outputBox.setText("Checkbox is " + ("checked"
if self.ui.testCheckBox.isChecked()
else "not checked"))

intelclass = Example
65 changes: 65 additions & 0 deletions example/example.ui
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?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>640</width>
<height>480</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="PyDMPushButton" name="testButton">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Test Button</string>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="PyDMCheckbox" name="testCheckBox">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Test Checkbox</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="PyDMLineEdit" name="outputBox">
<property name="toolTip">
<string/>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>PyDMLineEdit</class>
<extends>QLineEdit</extends>
<header>pydm.widgets.line_edit</header>
</customwidget>
<customwidget>
<class>PyDMPushButton</class>
<extends>QPushButton</extends>
<header>pydm.widgets.pushbutton</header>
</customwidget>
<customwidget>
<class>PyDMCheckbox</class>
<extends>QCheckBox</extends>
<header>pydm.widgets.checkbox</header>
</customwidget>
</customwidgets>
<resources/>
<connections/>
</ui>
15 changes: 15 additions & 0 deletions opsDevPanel.ui
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,21 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="PyDMRelatedDisplayButton" name="devPanelExample">
<property name="toolTip">
<string/>
</property>
<property name="text">
<string>Example Dev Panel</string>
</property>
<property name="filenames" stdset="0">
<stringlist>
<string>example/example.py</string>
</stringlist>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
Expand Down

0 comments on commit 26c8519

Please sign in to comment.