예제 #1
0
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_ModuleB()
        self.ui.setupUi(self)

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)

        self.scene_nobat = QGraphicsScene()
        self.scene_nobat.addPixmap(QPixmap('modules/ModuleB-nobat.png'))
        self.scene_off = QGraphicsScene()
        self.scene_off.addPixmap(QPixmap('modules/ModuleB-off.png'))
        self.scene_on = QGraphicsScene()
        self.scene_on.addPixmap(QPixmap('modules/ModuleB-on.png'))
        self.scene_nobulb = QGraphicsScene()
        self.scene_nobulb.addPixmap(QPixmap('modules/ModuleB-nobulb.png'))
        self.ui.widgetImg.setScene(self.scene_nobat)
예제 #2
0
파일: ModuleB.py 프로젝트: brmlab/edubrm
class ModuleBWidget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_ModuleB()
        self.ui.setupUi(self)

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)

        self.scene_nobat = QGraphicsScene()
        self.scene_nobat.addPixmap(QPixmap("modules/ModuleB-nobat.png"))
        self.scene_off = QGraphicsScene()
        self.scene_off.addPixmap(QPixmap("modules/ModuleB-off.png"))
        self.scene_on = QGraphicsScene()
        self.scene_on.addPixmap(QPixmap("modules/ModuleB-on.png"))
        self.scene_nobulb = QGraphicsScene()
        self.scene_nobulb.addPixmap(QPixmap("modules/ModuleB-nobulb.png"))
        self.ui.widgetImg.setScene(self.scene_nobat)

    def read_inputs(self):
        r = self.dev.read()
        us = r[1] / 1023.0 * 3.3
        uc = r[2] / 1023.0 * 3.3
        i = (us - uc) / 18 * 1000
        if i < 0.0 or uc == 0.0:
            i = 0.0
        self.ui.labelUs.setText("Us = %0.3f V" % us)
        self.ui.labelUc.setText("Uc = %0.3f V" % uc)
        self.ui.labelI.setText("I = %0.2f mA" % i)
        if us < 1.5:
            self.ui.widgetImg.setScene(self.scene_nobat)
        else:
            if uc < 0.9:
                self.ui.widgetImg.setScene(self.scene_off)
            elif uc > 2.0:
                self.ui.widgetImg.setScene(self.scene_nobulb)
            else:
                self.ui.widgetImg.setScene(self.scene_on)
예제 #3
0
class ModuleBWidget(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_ModuleB()
        self.ui.setupUi(self)

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)

        self.scene_nobat = QGraphicsScene()
        self.scene_nobat.addPixmap(QPixmap('modules/ModuleB-nobat.png'))
        self.scene_off = QGraphicsScene()
        self.scene_off.addPixmap(QPixmap('modules/ModuleB-off.png'))
        self.scene_on = QGraphicsScene()
        self.scene_on.addPixmap(QPixmap('modules/ModuleB-on.png'))
        self.scene_nobulb = QGraphicsScene()
        self.scene_nobulb.addPixmap(QPixmap('modules/ModuleB-nobulb.png'))
        self.ui.widgetImg.setScene(self.scene_nobat)

    def read_inputs(self):
        r = self.dev.read()
        us = r[1] / 1023.0 * 3.3
        uc = r[2] / 1023.0 * 3.3
        i = (us - uc) / 18 * 1000
        if i < 0.0 or uc == 0.0:
            i = 0.0
        self.ui.labelUs.setText('Us = %0.3f V' % us)
        self.ui.labelUc.setText('Uc = %0.3f V' % uc)
        self.ui.labelI.setText('I = %0.2f mA' % i)
        if us < 1.5:
            self.ui.widgetImg.setScene(self.scene_nobat)
        else:
            if uc < 0.9:
                self.ui.widgetImg.setScene(self.scene_off)
            elif uc > 2.0:
                self.ui.widgetImg.setScene(self.scene_nobulb)
            else:
                self.ui.widgetImg.setScene(self.scene_on)
예제 #4
0
파일: ModuleB.py 프로젝트: brmlab/edubrm
    def __init__(self):
        QWidget.__init__(self)
        self.ui = Ui_ModuleB()
        self.ui.setupUi(self)

        self.timer = QTimer()
        QObject.connect(self.timer, SIGNAL("timeout()"), self.read_inputs)

        self.scene_nobat = QGraphicsScene()
        self.scene_nobat.addPixmap(QPixmap("modules/ModuleB-nobat.png"))
        self.scene_off = QGraphicsScene()
        self.scene_off.addPixmap(QPixmap("modules/ModuleB-off.png"))
        self.scene_on = QGraphicsScene()
        self.scene_on.addPixmap(QPixmap("modules/ModuleB-on.png"))
        self.scene_nobulb = QGraphicsScene()
        self.scene_nobulb.addPixmap(QPixmap("modules/ModuleB-nobulb.png"))
        self.ui.widgetImg.setScene(self.scene_nobat)