From 6eed75a81b702a92e2143654f2495380f2cdcd22 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 4 May 2011 02:24:11 +0200 Subject: [PATCH] power on/off --- software/modules/ModuleC.py | 31 +++++++++++-------------------- software/modules/ModuleC.ui | 21 ++++----------------- 2 files changed, 15 insertions(+), 37 deletions(-) diff --git a/software/modules/ModuleC.py b/software/modules/ModuleC.py index 3ab88c9..b112ee2 100644 --- a/software/modules/ModuleC.py +++ b/software/modules/ModuleC.py @@ -51,29 +51,20 @@ class ModuleCWidget(QWidget): 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 + @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, 1) + self.dev.setout(1, checked and 1 or 0) if self.mode == ['DC', 'C']: - self.dev.setout(2, 1) + self.dev.setout(2, checked and 1 or 0) 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 - if self.mode == ['DC', 'L']: - self.dev.setout(1, 0) - if self.mode == ['DC', 'C']: - self.dev.setout(2, 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 diff --git a/software/modules/ModuleC.ui b/software/modules/ModuleC.ui index a15fcdf..4f20769 100644 --- a/software/modules/ModuleC.ui +++ b/software/modules/ModuleC.ui @@ -136,7 +136,7 @@ - + 10 @@ -146,23 +146,10 @@ - Start + OFF - - - - false - - - - 10 - 280 - 81 - 31 - - - - Stop + + true