def pytest_funcarg__manager(request): touchpad = request.getfuncargvalue('touchpad') # make sure, that we have a QApplication object before creating the manager request.getfuncargvalue('qtapp') manager = TouchpadManager(touchpad) request.addfinalizer(manager.stop) return manager
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()
def pytest_funcarg__touchpad_manager(request): # the touchpad manager requires a X11 display connection request.getfuncargvalue('qtapp') touchpad = request.getfuncargvalue('touchpad') return TouchpadManager(touchpad)