Beispiel #1
0
 def start_service(self, sm_config):
     print 'Starting', sm_config.config_name
     self.processmgr.start(sm_config.config_name)
     # TODO: handle errors
     sm_config.status = SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING
     SerialMuxConfigs.check_device(sm_config)
     # update UI
     self.ui.update_row_values(sm_config)
Beispiel #2
0
 def update_service(self, sm_config):
     do_restart = (sm_config.status == SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING)
     self.processmgr.update(sm_config.config_name,
                            sm_config.com_port, sm_config.listener_port, do_restart)
     if do_restart:
         sm_config.status = SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING
         SerialMuxConfigs.check_device(sm_config)
     else:
         sm_config.status = SerialMuxConfigs.SerialMuxConfig.STATUS_STOPPED
     # update UI
     self.ui.update_row_values(sm_config)
Beispiel #3
0
    def scan(self):
        mux_configs = scan_configs(self.processmgr.SERIAL_MUX_CONFIG_DIR)
        for mux_config in mux_configs:
            smc = self.model.add(mux_config['config_name'])
            smc.listener_port = mux_config['listener_port']
            smc.com_port = mux_config['com_port']
            
        svc_configs = scan_services()
        for svc_config in svc_configs:
            #print 'Scanning', svc_config['service_name']
            smc = self.model.find_config(svc_config['service_name'])
            if svc_config['state'] == 'Running':
                smc.status = SerialMuxConfigs.SerialMuxConfig.STATUS_RUNNING
                SerialMuxConfigs.check_device(smc)
            elif svc_config['state'] == 'Stopped':
                smc.status = SerialMuxConfigs.SerialMuxConfig.STATUS_STOPPED

        self._all_ports = get_virtual_serial_ports()
Beispiel #4
0
 def create_service(self):
     config_dir = self.processmgr.SERIAL_MUX_CONFIG_DIR
     # create config
     config_name = SerialMuxConfigs.find_available_name(config_dir)
     self.model.add(config_name)
     ProcessManager.create_config(config_dir, config_name)
     # create daemon/service
     self.processmgr.create(config_name)
     # update UI
     self.ui.update(self.model)
Beispiel #5
0
def main():
    # Create the UI
    ui = SMConfigUI()
    # Create the Model
    sm_data = SerialMuxConfigs.SerialMuxTable()
    # Create the controller
    controller = SerialMuxController(ui, sm_data)
    ui.register_controller(controller)

    # Update the UI 
    controller.refresh()

    # Run the UI main loop
    ui.run()