def hook_it_up(splash, device=None): """Attachs comms core to GUI and presents main screen""" # get main screen up from vmc.gtk.models.application import ApplicationModel from vmc.gtk.views.application import ApplicationView from vmc.gtk.controllers.application import ApplicationController splash.pulse() model = ApplicationModel() ctrl = ApplicationController(model, splash) view = ApplicationView(ctrl) # we keep a reference of the controller in the model model.ctrl = ctrl if not device: ctrl.start() return unsolicited_notifications_callbacks = { N.SIG_RSSI: ctrl._change_signal_level, N.SIG_RFSWITCH: ctrl._change_radio_state, N.SIG_SPEED: ctrl._change_net_stats_cb, N.SIG_NEW_CONN_MODE: ctrl._conn_mode_changed, N.SIG_NEW_NETWORK: ctrl._network_changed, N.SIG_SMS: ctrl._on_sms_received, N.SIG_CALL: None, N.SIG_CREG: None, N.SIG_CONNECTED: None, N.SIG_CONN: None, # Why are there two notifications for 'Connect'? N.SIG_DISCONNECTED: None, } profile_name = config.get('profile', 'name') statemachine_callbacks = {} if not profile_name: # user never run the app before statemachine_callbacks['InitExit'] = lambda: ctrl.ask_for_new_profile( startup=True, aux_ctrl=ctrl) else: statemachine_callbacks['InitExit'] = ctrl.start splash.start_pulse() def on_auth_exit(): splash.set_text(_('Authenticated!')) splash.stop_pulse() statemachine_callbacks['AuthEnter'] = lambda: splash.set_text( _('Authenticating...')) statemachine_callbacks['AuthExit'] = on_auth_exit statemachine_callbacks['NetRegExit'] = ctrl.on_netreg_exit statemachine_errbacks = { 'AlreadyConnecting': None, 'AlreadyConnected': None, 'IllegalOperationError': ctrl.on_illegal_operation, } from vmc.gtk.wrapper import GTKWrapper ctrl.model.wrapper = GTKWrapper(device, unsolicited_notifications_callbacks, statemachine_callbacks, statemachine_errbacks, ctrl) ctrl.model.wrapper.start_behaviour(ctrl)
def hook_it_up(splash, device_listener, device=None): """Attachs comms core to GUI and presents main screen""" # get main screen up from vmc.gtk.models.application import ApplicationModel from vmc.gtk.views.application import ApplicationView from vmc.gtk.controllers.application import ApplicationController splash.pulse() model = ApplicationModel() ctrl = ApplicationController(model, device_listener, splash) view = ApplicationView(ctrl) # we keep a reference of the controller in the model model.ctrl = ctrl if not device: ctrl.start() return unsolicited_notifications_callbacks = { N.SIG_RSSI : ctrl._change_signal_level, N.SIG_SPEED : ctrl._change_net_stats_cb, N.SIG_NEW_CONN_MODE : ctrl._conn_mode_changed, N.SIG_SMS : ctrl._on_sms_received, N.SIG_CALL : None, } profile_name = config.get('profile', 'name') statemachine_callbacks = {} if not profile_name: # user never run the app before def configure_device(): _model = NewProfileModel(device) _ctrl = NewProfileController(_model, startup=True, aux_ctrl=ctrl) _view = NewProfileView(_ctrl) _view.set_parent_view(view) # center on main screen _view.show() statemachine_callbacks['PostInitExit'] = configure_device else: statemachine_callbacks['PostInitExit'] = ctrl.start try: splash.start_pulse() except: pass def on_auth_exit(): splash.set_text(_('Authenticated!')) try: splash.stop_pulse() except: pass statemachine_callbacks['PreInitExit'] = lambda: splash.set_text(_('Authenticating...')) statemachine_callbacks['AuthExit'] = on_auth_exit statemachine_errbacks = { 'AlreadyConnecting' : None, 'AlreadyConnected' : None, 'IllegalOperationError' : ctrl.on_illegal_operation, } from vmc.gtk.wrapper import GTKWrapper ctrl.model.wrapper = GTKWrapper(device, unsolicited_notifications_callbacks, statemachine_callbacks, statemachine_errbacks, ctrl) ctrl.model.wrapper.start_behaviour(ctrl)
def hook_it_up(splash, device=None): """Attachs comms core to GUI and presents main screen""" # get main screen up from vmc.gtk.models.application import ApplicationModel from vmc.gtk.views.application import ApplicationView from vmc.gtk.controllers.application import ApplicationController splash.pulse() model = ApplicationModel() ctrl = ApplicationController(model, splash) view = ApplicationView(ctrl) # we keep a reference of the controller in the model model.ctrl = ctrl if not device: ctrl.start() return unsolicited_notifications_callbacks = { N.SIG_RSSI : ctrl._change_signal_level, N.SIG_RFSWITCH : ctrl._change_radio_state, N.SIG_SPEED : ctrl._change_net_stats_cb, N.SIG_NEW_CONN_MODE : ctrl._conn_mode_changed, N.SIG_NEW_NETWORK : ctrl._network_changed, N.SIG_SMS : ctrl._on_sms_received, N.SIG_CALL : None, N.SIG_CREG : None, N.SIG_CONNECTED : None, N.SIG_CONN : None, # Why are there two notifications for 'Connect'? N.SIG_DISCONNECTED : None, } profile_name = config.get('profile', 'name') statemachine_callbacks = {} if not profile_name: # user never run the app before statemachine_callbacks['InitExit'] = lambda: ctrl.ask_for_new_profile(startup=True, aux_ctrl=ctrl) else: statemachine_callbacks['InitExit'] = ctrl.start splash.start_pulse() def on_auth_exit(): splash.set_text(_('Authenticated!')) splash.stop_pulse() statemachine_callbacks['AuthEnter'] = lambda: splash.set_text(_('Authenticating...')) statemachine_callbacks['AuthExit'] = on_auth_exit statemachine_callbacks['NetRegExit'] = ctrl.on_netreg_exit statemachine_errbacks = { 'AlreadyConnecting' : None, 'AlreadyConnected' : None, 'IllegalOperationError' : ctrl.on_illegal_operation, } from vmc.gtk.wrapper import GTKWrapper ctrl.model.wrapper = GTKWrapper(device, unsolicited_notifications_callbacks, statemachine_callbacks, statemachine_errbacks, ctrl) ctrl.model.wrapper.start_behaviour(ctrl)
def hook_it_up(splash, device_listener, device=None): """Attachs comms core to GUI and presents main screen""" # get main screen up from vmc.gtk.models.application import ApplicationModel from vmc.gtk.views.application import ApplicationView from vmc.gtk.controllers.application import ApplicationController splash.pulse() model = ApplicationModel() ctrl = ApplicationController(model, device_listener, splash) view = ApplicationView(ctrl) # we keep a reference of the controller in the model model.ctrl = ctrl if not device: ctrl.start() return unsolicited_notifications_callbacks = { N.SIG_RSSI: ctrl._change_signal_level, N.SIG_SPEED: ctrl._change_net_stats_cb, N.SIG_NEW_CONN_MODE: ctrl._conn_mode_changed, N.SIG_SMS: ctrl._on_sms_received, N.SIG_CALL: None, } profile_name = config.get('profile', 'name') statemachine_callbacks = {} if not profile_name: # user never run the app before def configure_device(): _model = NewProfileModel(device) _ctrl = NewProfileController(_model, startup=True, aux_ctrl=ctrl) _view = NewProfileView(_ctrl) _view.set_parent_view(view) # center on main screen _view.show() statemachine_callbacks['PostInitExit'] = configure_device else: statemachine_callbacks['PostInitExit'] = ctrl.start try: splash.start_pulse() except: pass def on_auth_exit(): splash.set_text(_('Authenticated!')) try: splash.stop_pulse() except: pass statemachine_callbacks['PreInitExit'] = lambda: splash.set_text( _('Authenticating...')) statemachine_callbacks['AuthExit'] = on_auth_exit statemachine_errbacks = { 'AlreadyConnecting': None, 'AlreadyConnected': None, 'IllegalOperationError': ctrl.on_illegal_operation, } from vmc.gtk.wrapper import GTKWrapper ctrl.model.wrapper = GTKWrapper(device, unsolicited_notifications_callbacks, statemachine_callbacks, statemachine_errbacks, ctrl) ctrl.model.wrapper.start_behaviour(ctrl)