コード例 #1
0
 def __init__(self, callback: UpdaterEvents):
     self.model = ConnectedDeviceModel(
         self)  # the device model using this instance as the view
     # we pass in the proxy because the device model runs on a separate thread, but we want updates to fire on the main controller thread.
     self.callback = callback
     self.scan_thread = None
     self.updater_state = UpdaterState()
     self.updater_state.on_change += lambda source: self._updater_state_changed(
         self.updater_state.state)
     self.updater_state.on_change += lambda source: callback.updater_state_changed(
         self.updater_state.state)
     self.updater_state.notify()  # trigger initial update