Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

power on/off

  • Loading branch information...
commit 6eed75a81b702a92e2143654f2495380f2cdcd22 1 parent 19bd37a
Pavol Rusnak authored May 04, 2011
31  software/modules/ModuleC.py
@@ -51,29 +51,20 @@ def on_radioLC_clicked(self):
51 51
         self.mode[1] = 'LC'
52 52
         self.setup_hw()
53 53
 
54  
-    @pyqtSlot()
55  
-    def on_btnStart_clicked(self):
56  
-        self.ui.btnStart.setEnabled(False)
57  
-        self.ui.btnStop.setEnabled(True)
58  
-        self.current = 3.3
59  
-        if self.mode == ['DC', 'L']:
60  
-            self.dev.setout(1, 1)
61  
-        if self.mode == ['DC', 'C']:
62  
-            self.dev.setout(2, 1)
63  
-        if self.mode == ['DC', 'LC']:
64  
-            self.dev.setout(3, 1)
65  
-
66  
-    @pyqtSlot()
67  
-    def on_btnStop_clicked(self):
68  
-        self.ui.btnStart.setEnabled(True)
69  
-        self.ui.btnStop.setEnabled(False)
70  
-        self.current = 0.0
  54
+    @pyqtSlot(bool)
  55
+    def on_btnPower_clicked(self, checked):
  56
+        if checked:
  57
+            self.current = 3.3
  58
+            self.ui.btnPower.setText('ON')
  59
+        else:
  60
+            self.current = 0.0
  61
+            self.ui.btnPower.setText('OFF')
71 62
         if self.mode == ['DC', 'L']:
72  
-            self.dev.setout(1, 0)
  63
+            self.dev.setout(1, checked and 1 or 0)
73 64
         if self.mode == ['DC', 'C']:
74  
-            self.dev.setout(2, 0)
  65
+            self.dev.setout(2, checked and 1 or 0)
75 66
         if self.mode == ['DC', 'LC']:
76  
-            self.dev.setout(3, 0)
  67
+            self.dev.setout(3, checked and 1 or 1)
77 68
 
78 69
     def setup_hw(self):
79 70
         if self.mode == ['DC', 'L']:  # AD6
21  software/modules/ModuleC.ui
@@ -136,7 +136,7 @@
136 136
     </property>
137 137
    </widget>
138 138
   </widget>
139  
-  <widget class="QPushButton" name="btnStart">
  139
+  <widget class="QPushButton" name="btnPower">
140 140
    <property name="geometry">
141 141
     <rect>
142 142
      <x>10</x>
@@ -146,23 +146,10 @@
146 146
     </rect>
147 147
    </property>
148 148
    <property name="text">
149  
-    <string>Start</string>
  149
+    <string>OFF</string>
150 150
    </property>
151  
-  </widget>
152  
-  <widget class="QPushButton" name="btnStop">
153  
-   <property name="enabled">
154  
-    <bool>false</bool>
155  
-   </property>
156  
-   <property name="geometry">
157  
-    <rect>
158  
-     <x>10</x>
159  
-     <y>280</y>
160  
-     <width>81</width>
161  
-     <height>31</height>
162  
-    </rect>
163  
-   </property>
164  
-   <property name="text">
165  
-    <string>Stop</string>
  151
+   <property name="checkable">
  152
+    <bool>true</bool>
166 153
    </property>
167 154
   </widget>
168 155
  </widget>

0 notes on commit 6eed75a

Please sign in to comment.
Something went wrong with that request. Please try again.