Пример #1
0
 def setup_manager(self, touchpad):
     self.touchpad_manager = TouchpadManager(touchpad, self)
     ManagerConfiguration.load(self.touchpad_manager)
     # transition upon touchpad_on_action
     self.touchpad_manager.add_touchpad_switch_action(
         self.touchpad_on_action)
     # update checked state of touchpad_on_action
     self.touchpad_manager.states['on'].assignProperty(
         self.touchpad_on_action, 'checked', True)
     self.touchpad_manager.states['off'].assignProperty(
         self.touchpad_on_action, 'checked', False)
     # update the overlay icon
     self.touchpad_manager.states['on'].entered.connect(
         partial(self.setOverlayIconByName, 'touchpad-off'))
     self.touchpad_manager.states['on'].exited.connect(
         partial(self.setOverlayIconByName, ''))
     # only show notification if the touchpad is permanently switched
     # off
     self.touchpad_manager.states['off'].entered.connect(
         partial(self.notify_touchpad_state, True))
     self.touchpad_manager.states['off'].exited.connect(
         partial(self.notify_touchpad_state, False))
     # and eventually start managing the touchpad
     self.touchpad_manager.start()