Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

power on/off

  • Loading branch information...
commit 6eed75a81b702a92e2143654f2495380f2cdcd22 1 parent 19bd37a
@prusnak prusnak authored
Showing with 15 additions and 37 deletions.
  1. +11 −20 software/modules/ModuleC.py
  2. +4 −17 software/modules/ModuleC.ui
View
31 software/modules/ModuleC.py
@@ -51,29 +51,20 @@ def on_radioLC_clicked(self):
self.mode[1] = 'LC'
self.setup_hw()
- @pyqtSlot()
- def on_btnStart_clicked(self):
- self.ui.btnStart.setEnabled(False)
- self.ui.btnStop.setEnabled(True)
- self.current = 3.3
- if self.mode == ['DC', 'L']:
- self.dev.setout(1, 1)
- if self.mode == ['DC', 'C']:
- self.dev.setout(2, 1)
- if self.mode == ['DC', 'LC']:
- self.dev.setout(3, 1)
-
- @pyqtSlot()
- def on_btnStop_clicked(self):
- self.ui.btnStart.setEnabled(True)
- self.ui.btnStop.setEnabled(False)
- self.current = 0.0
+ @pyqtSlot(bool)
+ def on_btnPower_clicked(self, checked):
+ if checked:
+ self.current = 3.3
+ self.ui.btnPower.setText('ON')
+ else:
+ self.current = 0.0
+ self.ui.btnPower.setText('OFF')
if self.mode == ['DC', 'L']:
- self.dev.setout(1, 0)
+ self.dev.setout(1, checked and 1 or 0)
if self.mode == ['DC', 'C']:
- self.dev.setout(2, 0)
+ self.dev.setout(2, checked and 1 or 0)
if self.mode == ['DC', 'LC']:
- self.dev.setout(3, 0)
+ self.dev.setout(3, checked and 1 or 1)
def setup_hw(self):
if self.mode == ['DC', 'L']: # AD6
View
21 software/modules/ModuleC.ui
@@ -136,7 +136,7 @@
</property>
</widget>
</widget>
- <widget class="QPushButton" name="btnStart">
+ <widget class="QPushButton" name="btnPower">
<property name="geometry">
<rect>
<x>10</x>
@@ -146,23 +146,10 @@
</rect>
</property>
<property name="text">
- <string>Start</string>
+ <string>OFF</string>
</property>
- </widget>
- <widget class="QPushButton" name="btnStop">
- <property name="enabled">
- <bool>false</bool>
- </property>
- <property name="geometry">
- <rect>
- <x>10</x>
- <y>280</y>
- <width>81</width>
- <height>31</height>
- </rect>
- </property>
- <property name="text">
- <string>Stop</string>
+ <property name="checkable">
+ <bool>true</bool>
</property>
</widget>
</widget>
Please sign in to comment.
Something went wrong with that request. Please try again.