Esempio n. 1
0
 def init(self, retico_widget):
     self.retico_widget = retico_widget
     with flx.PinboardLayout(
             style="height: 3000px; width: 3000px;") as self.mcontainer:
         self.canvas = flx.CanvasWidget(
             style="left: 0; top: 0; height:100%; width: 100%;")
     self.modules = []
     self.init_moving()
     window.setTimeout(self.center_view, 10)
    def init(self):
        super().init()
        #        self._mutate_sercon(SerialConnection('/dev/ttyACM1'))
        self.sercon = SerialConnection('/dev/sensor_0')
        #        self._mutate_serconChiller(SerialConnectionChiller('/dev/ttyUSB0'))
        self.serconChiller = SerialConnectionChiller('/dev/ttyUSB0')
        #        self._mutate_serconSensirion(SerialConnectionSensirion('/dev/ttyACM0'))
        self.serconSensirion = SerialConnectionSensirion('/dev/sensor_1') 
        #        self._mutate_ledcon(LedPulser())
        self.ledcon = LedPulser() 
        self.hvcon = SerialConnectionHV('/dev/ttyUSB4')

        self.t0 = datetime.now()
        #Always start in inhbit mode
        reply=self.sercon.sendCommand('i')
        if (reply!='INH'):
            print('Please check serial connection')

        reply=self.sercon.sendCommand('0')
        if (reply!='V0'):
            print('Please check serial connection')

        ret=self.ledcon.ledSwitch(0)
        if (ret!=0):
            print('Please check led pulser connection')

#        with flx.HBox(flex=0, spacing=10):

        with flx.PinboardLayout():
            self.tempText = flx.Label(text='T: XX.XX H: YY.YY',style='left:10px; top:120px; width:300px;height:20px;')
            self.sensirionText = flx.Label(text='T_EXT:XXX.XX H_EXT:YYY.YY DEW_EXT:ZZZ.ZZ',style='left:10px; top:140px; width:400px;height:20px;')
            self.hvText = flx.Label(text='VSET:XXX.XX VMON:XXX.XX',style='left:10px; top:180px; width:300px;height:20px;')
            self.chillerText = flx.Label(text='CHILLER TBATH:XXX.XX TSET:YYY.YY PUMP:ZZ',style='left:10px; top:160px; width:400px;height:20px;')
            self.but1 = flx.Button(text='Led Pulser',css_class="border-black",style='left:10px; top:10px; width:180px;height:100px;')
            self.but2 = flx.Button(text='HV',css_class="border-black",style='left:200px; top:10px; width:150px;height:100px;')
            self.but3 = flx.Button(text='VSEL',css_class="border-black",style='left:360px; top:10px; width:100px;height:100px;')
            self.chillerStatus = flx.Button(text='COOLING OK',css_class="border-black",style='left:470px; top:10px; width:250px;height:100px;')
#            self.label = flx.Label(text='', flex=1)  # take all remaining space

        self.refreshTemperature()
        self.refreshChiller()
        self.refreshSensirion()
        self.refreshHV()
#upload to things speak (every 60s)
        self.refreshThingSpeak()

        self.initialised=1
Esempio n. 3
0
 def init(self):
     with flx.PinboardLayout():
         self._circles = [Circle() for i in range(32)]
     self.tick()