def closeStuff(signum,stack): app.shutdown() PowerInputControl.turnOffSupply()
def build(self): self.control_window = ControlWindow() self.fan_controller = FanController() self.control_window.bind_channels(self.fan_controller) Window.full_screen = 1 return self.control_window def shutdown(self): if self.control_window is not None: self.control_window.shutdown() if __name__ == '__main__': app = LabPowerSupplyCtrlApp() def closeStuff(signum,stack): app.shutdown() PowerInputControl.turnOffSupply() try: PowerInputControl.turnOnSupply() #signal.signal(signal.SIGINT,closeStuff) #signal.signal(signal.SIGHUP,closeStuff) app.run() except: print("Unexpected error:", sys.exc_info()[0]) raise finally: app.shutdown() PowerInputControl.turnOffSupply()
App.__init__(self) self.control_window = None def build(self): self.control_window = ControlWindow() self.fan_controller = FanController() self.control_window.bind_channels(self.fan_controller) Window.full_screen = 1 return self.control_window def shutdown(self): if self.control_window is not None: self.control_window.shutdown() if __name__ == '__main__': app = LabPowerSupplyCtrlApp() def closeStuff(signum,stack): app.shutdown() PowerInputControl.turnOffSupply() try: PowerInputControl.turnOnSupply() #signal.signal(signal.SIGINT,closeStuff) #signal.signal(signal.SIGHUP,closeStuff) app.run() finally: app.shutdown() PowerInputControl.turnOffSupply()