Пример #1
0
    def _auto_gas_exchange(self):
        self.info('Starting auto gas exchange')
        self._timer = Timer(1000, self._update_pressure)
        self._timer.Start()
#        self.controller.start_update_timer()
        if not self.confirmation_dialog('Are both gas cylinders closed', title='Auto Gas Exchange'):
            self._timer.Stop()
            return

        self.controller.do_auto_vac()
        if not self.confirmation_dialog('Open Premix Cylinder, set secondary pressure to 6.5 - 7.5 bar', title='Auto Gas Exchange'):
            self._timer.Stop()
            return

        self.controller.do_auto_gas_exchange()
        self.information_dialog('Close Premix Gas Cylinder', title='Auto Gas Exchange')
        self._timer.Stop()
Пример #2
0
    def _start_stop_button_fired(self):
        if self._alive:
            self._timer.Stop()
            self._base_time = self.current_time
        else:
            self._start_time = time.time()

            t = Timer(1000, self._iter)
            self._timer = t

        self._alive = not self._alive
 def fade_out(self):
     interval = self.fade_out_time / self.fade_out_steps
     self.timer = Timer(interval, self._fade_out_step)
Пример #4
0
class UVGasHandlerManager(SwitchManager):
    canvas = Instance(ExtractionLineCanvas2D)
    controller = Any
    use_explanation = False
    mode = 'normal'

    auto_gas_exchange = Button

    # energy_readback=DelegatesTo('controller')
    pressure_readback = DelegatesTo('controller')

    #    pressure_readback=Float
    def set_software_lock(self, name, lock):
        if lock:
            self.lock(name)
        else:
            self.unlock(name)

    def load(self):
        path = os.path.join(paths.extraction_line_dir,
                            'uv_gas_handling_valves.xml')
        self._load_valves_from_file(path)
        return True

    def open_valve(self, name, mode):
        pass
#        v = self.get_valve_by_name(name)
#        self.controller.open_valve(v.address)
#        return True

    def close_valve(self, name, mode):
        pass
#        v = self.get_valve_by_name(name)
#        self.controller.close_valve(v.address)
#        return True

    def _auto_gas_exchange(self):
        self.info('Starting auto gas exchange')
        self._timer = Timer(1000, self._update_pressure)
        self._timer.Start()
        #        self.controller.start_update_timer()
        if not self.confirmation_dialog('Are both gas cylinders closed',
                                        title='Auto Gas Exchange'):
            self._timer.Stop()
            return

        self.controller.do_auto_vac()
        if not self.confirmation_dialog(
                'Open Premix Cylinder, set secondary pressure to 6.5 - 7.5 bar',
                title='Auto Gas Exchange'):
            self._timer.Stop()
            return

        self.controller.do_auto_gas_exchange()
        self.information_dialog('Close Premix Gas Cylinder',
                                title='Auto Gas Exchange')
        self._timer.Stop()

    def _update_pressure(self):
        self.controller.get_pressure()

# ===============================================================================
# handlers
# ===============================================================================

    def _auto_gas_exchange_fired(self):
        self._auto_gas_exchange()

    def _canvas_default(self):
        p = os.path.join(paths.canvas2D_dir, 'uv_gas_handling_canvas.xml')
        canvas = ExtractionLineCanvas2D(manager=self)
        canvas.load_canvas_file(p)
        return canvas

    def traits_view(self):
        ctrl_grp = HGroup(Item('auto_gas_exchange', show_label=False))
        info_grp = HGroup(
            # Item('energy_readback', width=50,style='readonly'),
            Item('pressure_readback', width=50, style='readonly'))
        v = View(ctrl_grp,
                 info_grp,
                 Item(
                     'canvas',
                     show_label=False,
                     editor=ComponentEditor(),
                 ),
                 resizable=True,
                 width=700,
                 height=500)
        return v
Пример #5
0
 def configure_traits(self, *args, **kws):
     # Start up the timer! We should do this only when the demo actually
     # starts and not when the demo object is created.
     self.timer = Timer(PERIOD, self.controller.timer_tick)
     return super(LightSensorApplication, self).configure_traits(*args, **kws)