wacom: replace the signal forwarders with lambdas

We're doing nothing but forwarding the signal here, so let's just replace them
with lambdas so it's immediately obvious what we do with the signal.
This commit is contained in:
Peter Hutterer 2018-02-12 11:42:05 +10:00 committed by Benjamin Tissoires
parent 94bc52efb6
commit 0d825e2e3c
1 changed files with 11 additions and 12 deletions

View File

@ -766,17 +766,14 @@ class WacomDevice(GObject.Object):
logger.debug(f'{self._device.name} is using protocol {protocol}')
self._wacom_protocol.connect('drawing', self._on_drawing_received)
self._wacom_protocol.connect('battery-status', self._on_battery_status)
def _on_drawing_received(self, protocol, drawing):
self.emit('drawing', drawing)
def _on_button_press_required(self, protocol):
self.emit('button-press-required')
def _on_battery_status(self, protocol, percent, is_charging):
self.emit('battery-status', percent, is_charging)
self._wacom_protocol.connect(
'drawing',
lambda protocol, drawing, self: self.emit('drawing', drawing),
self)
self._wacom_protocol.connect(
'battery-status',
lambda prot, percent, is_charging, self: self.emit('battery-status', percent, is_charging),
self)
@GObject.Property
def uuid(self):
@ -793,7 +790,9 @@ class WacomDevice(GObject.Object):
logger.debug(f'{self._device.address}: registering device, assigned {self.uuid}')
wp = WacomRegisterHelper(self._device)
s = wp.connect('button-press-required', self._on_button_press_required)
s = wp.connect('button-press-required',
lambda protocol, self: self.emit('button-press-required'),
self)
protocol = wp.register_device(self._uuid)
wp.disconnect(s)
del wp