janitor: convert double quotes into single quotes

Let's the developers of tuhi to consume more energy in their monitor
to light up more pixel when displaying single quotes whereas double
quotes.

It also makes the whole bit more uniform.

Fixes #32
pull/44/head
Benjamin Tissoires 2018-01-29 12:04:51 +01:00 committed by Peter Hutterer
parent 04f25a0a38
commit 9f118bbe15
7 changed files with 123 additions and 123 deletions

View File

@ -36,9 +36,9 @@ class ColorFormatter(logging.Formatter):
'CRITICAL': YELLOW,
'ERROR': RED,
}
RESET_SEQ = "\033[0m"
COLOR_SEQ = "\033[%dm"
BOLD_SEQ = "\033[1m"
RESET_SEQ = '\033[0m'
COLOR_SEQ = '\033[%dm'
BOLD_SEQ = '\033[1m'
def __init__(self, *args, **kwargs):
logging.Formatter.__init__(self, *args, **kwargs)
@ -47,11 +47,11 @@ class ColorFormatter(logging.Formatter):
levelname = record.levelname
color = self.COLOR_SEQ % (self.COLORS[levelname])
message = logging.Formatter.format(self, record)
message = message.replace("$RESET", self.RESET_SEQ)\
.replace("$BOLD", self.BOLD_SEQ)\
.replace("$COLOR", color)
message = message.replace('$RESET', self.RESET_SEQ)\
.replace('$BOLD', self.BOLD_SEQ)\
.replace('$COLOR', color)
for k, v in self.COLORS.items():
message = message.replace("$" + k, self.COLOR_SEQ % (v + 30))
message = message.replace('$' + k, self.COLOR_SEQ % (v + 30))
return message + self.RESET_SEQ
@ -143,7 +143,7 @@ class TuhiKeteDevice(_DBusObject):
@classmethod
def is_device_address(cls, string):
if re.match(r"[0-9a-f]{2}(:[0-9a-f]{2}){5}$", string.lower()):
if re.match(r'[0-9a-f]{2}(:[0-9a-f]{2}){5}$', string.lower()):
return string
raise argparse.ArgumentTypeError(f'"{string}" is not a valid device address')
@ -216,7 +216,7 @@ class TuhiKeteDevice(_DBusObject):
class TuhiKeteManager(_DBusObject):
__gsignals__ = {
"pairable-device":
'pairable-device':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
}
@ -319,7 +319,7 @@ class TuhiKeteManager(_DBusObject):
class Worker(GObject.Object):
"""Implements a command to be executed.
'''Implements a command to be executed.
Subclasses need to overwrite run() that will be executed
to setup the command (before the mainloop).
Subclass can also implement the stop() method which
@ -328,7 +328,7 @@ class Worker(GObject.Object):
The variable need_mainloop needs to be set from the
subclass if the command requires the mainloop to be
run from an undetermined amount of time."""
run from an undetermined amount of time.'''
need_mainloop = False
@ -528,7 +528,7 @@ class Fetcher(Worker):
svgpoints.append((mode, x, y))
mode = 'L'
path = svgwrite.path.Path(d=svgpoints,
style="fill:none;stroke:black;stroke-width:5")
style='fill:none;stroke:black;stroke-width:5')
g.add(path)
svg.add(g)
@ -615,7 +615,7 @@ class TuhiKeteShell(cmd.Cmd):
try:
self.cmdloop(init)
except KeyboardInterrupt as e:
print("^C")
print('^C')
self.run('')
def start_worker(self, worker_class, args=None):
@ -828,7 +828,7 @@ class TuhiKeteShell(cmd.Cmd):
def do_pair(self, args):
if not self._manager.searching and '-h' not in args.split():
print("please call search first")
print('please call search first')
return
desc = '''
@ -1009,5 +1009,5 @@ def main(args):
logger.error(e.message)
if __name__ == "__main__":
if __name__ == '__main__':
main(sys.argv)

View File

@ -29,11 +29,11 @@ WACOM_COMPANY_ID = 0x4755
class TuhiDevice(GObject.Object):
"""
'''
Glue object to combine the backend bluez DBus object (that talks to the
real device) with the frontend DBusServer object that exports the device
over Tuhi's DBus interface
"""
'''
__gsignals__ = {
# Signal sent when an error occurs on the device itself.
# Argument is a Wacom*Exception
@ -141,9 +141,9 @@ class TuhiDevice(GObject.Object):
class Tuhi(GObject.Object):
__gsignals__ = {
"device-added":
'device-added':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
"device-connected":
'device-connected':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
}
@ -264,7 +264,7 @@ class Tuhi(GObject.Object):
def main(args=sys.argv):
desc = "Daemon to extract the pen stroke data from Wacom SmartPad devices"
desc = 'Daemon to extract the pen stroke data from Wacom SmartPad devices'
parser = argparse.ArgumentParser(description=desc)
parser.add_argument('-v', '--verbose',
help='Show some debugging informations',

View File

@ -22,17 +22,17 @@ ORG_BLUEZ_ADAPTER1 = 'org.bluez.Adapter1'
class BlueZCharacteristic(GObject.Object):
"""
'''
Abstraction for a org.bluez.GattCharacteristic1 object.
Use start_notify() to receive notifications about the characteristics.
Hook up a property with connect_property() first.
"""
'''
def __init__(self, obj):
"""
'''
:param obj: the org.bluez.GattCharacteristic1 DBus proxy object
"""
'''
self.obj = obj
self.objpath = obj.get_object_path()
self.interface = obj.get_interface(ORG_BLUEZ_GATTCHARACTERISTIC1)
@ -46,7 +46,7 @@ class BlueZCharacteristic(GObject.Object):
self._on_properties_changed)
def connect_property(self, propname, callback):
"""
'''
Connect the property with the given name to the callback function
provide. When the property chages, callback is invoked as:
@ -54,7 +54,7 @@ class BlueZCharacteristic(GObject.Object):
The common way is connect_property('Value', do_something) to get
notified about Value changes on this characteristic.
"""
'''
self._property_callbacks[propname] = callback
def start_notify(self):
@ -76,7 +76,7 @@ class BlueZCharacteristic(GObject.Object):
class BlueZDevice(GObject.Object):
"""
'''
Abstraction for a org.bluez.Device1 object
The device initializes itself based on the given object manager and
@ -89,21 +89,21 @@ class BlueZDevice(GObject.Object):
established.
The device's characteristics are in self.characteristics[uuid]
"""
'''
__gsignals__ = {
"connected":
'connected':
(GObject.SIGNAL_RUN_FIRST, None, ()),
"disconnected":
'disconnected':
(GObject.SIGNAL_RUN_FIRST, None, ()),
"updated":
'updated':
(GObject.SIGNAL_RUN_FIRST, None, ()),
}
def __init__(self, om, obj):
"""
'''
:param om: The ObjectManager for name org.bluez path /
:param obj: The org.bluez.Device1 DBus proxy object
"""
'''
GObject.Object.__init__(self)
self.objpath = obj.get_object_path()
self.obj = obj
@ -152,12 +152,12 @@ class BlueZDevice(GObject.Object):
return None
def resolve(self, om):
"""
'''
Resolve the GattServices and GattCharacteristics. This function does
not need to be called for existing objects but if a device comes in
at runtime not all services may have been resolved by the time the
org.bluez.Device1 shows up.
"""
'''
objects = om.get_objects()
self._resolve_gatt_services(objects)
@ -195,10 +195,10 @@ class BlueZDevice(GObject.Object):
self.characteristics[chrc.uuid] = chrc
def connect_device(self):
"""
'''
Connect to the bluetooth device via bluez. This function is
asynchronous and returns immediately.
"""
'''
i = self.obj.get_interface(ORG_BLUEZ_DEVICE1)
if self.connected:
logger.info(f'{self.address}: Device is already connected')
@ -219,10 +219,10 @@ class BlueZDevice(GObject.Object):
logger.error(f'Connection failed: {result}')
def disconnect_device(self):
"""
'''
Disconnect the bluetooth device via bluez. This function is
asynchronous and returns immediately.
"""
'''
i = self.obj.get_interface(ORG_BLUEZ_DEVICE1)
if not i.get_cached_property('Connected').get_boolean():
logger.info(f'{self.address}: Device is already disconnected')
@ -252,10 +252,10 @@ class BlueZDevice(GObject.Object):
self.emit('updated')
def connect_gatt_value(self, uuid, callback):
"""
'''
Connects Value property changes of the given GATT Characteristics
UUID to the callback.
"""
'''
try:
chrc = self.characteristics[uuid]
chrc.connect_property('Value', callback)
@ -268,18 +268,18 @@ class BlueZDevice(GObject.Object):
class BlueZDeviceManager(GObject.Object):
"""
'''
Manager object that connects to org.bluez's root object and handles the
devices.
"""
'''
__gsignals__ = {
"device-added":
'device-added':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT, GObject.TYPE_BOOLEAN)),
"device-updated":
'device-updated':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
"discovery-started":
'discovery-started':
(GObject.SIGNAL_RUN_FIRST, None, ()),
"discovery-stopped":
'discovery-stopped':
(GObject.SIGNAL_RUN_FIRST, None, ()),
}
@ -289,11 +289,11 @@ class BlueZDeviceManager(GObject.Object):
self._discovery = False
def connect_to_bluez(self):
"""
'''
Connect to bluez's DBus interface. Once called, devices will be
resolved as they come in. The device-added signal is emitted for
each device.
"""
'''
self._om = Gio.DBusObjectManagerClient.new_for_bus_sync(
Gio.BusType.SYSTEM,
Gio.DBusObjectManagerClientFlags.NONE,
@ -316,14 +316,14 @@ class BlueZDeviceManager(GObject.Object):
return False
def start_discovery(self, timeout=0):
"""
'''
Start discovery mode, terminating after the specified timeout (in
seconds). If timeout is 0, no timeout is imposed and the discovery
mode stays on.
This emits the discovery-started signal
"""
self.emit("discovery-started")
'''
self.emit('discovery-started')
if self._discovery:
return
@ -354,11 +354,11 @@ class BlueZDeviceManager(GObject.Object):
# signal with the status code
def stop_discovery(self):
"""
'''
Stop an ongoing discovery mode. Any errors are logged but ignored.
This emits the discovery-stopped signal
"""
'''
if not self._discovery:
return
@ -379,16 +379,16 @@ class BlueZDeviceManager(GObject.Object):
# reset the discovery filters
i.SetDiscoveryFilter('(a{sv})', {})
self.emit("discovery-stopped")
self.emit('discovery-stopped')
def _on_device_updated(self, device):
"""Callback for Device's properties-changed"""
'''Callback for Device's properties-changed'''
logger.debug(f'Object updated: {device.name}')
self.emit("device-updated", device)
self.emit('device-updated', device)
def _on_om_object_added(self, om, obj):
"""Callback for ObjectManager's object-added"""
'''Callback for ObjectManager's object-added'''
objpath = obj.get_object_path()
logger.debug(f'Object added: {objpath}')
needs_resolve = self._process_object(obj, event=True)
@ -401,12 +401,12 @@ class BlueZDeviceManager(GObject.Object):
d.resolve(om)
def _on_om_object_removed(self, om, obj):
"""Callback for ObjectManager's object-removed"""
'''Callback for ObjectManager's object-removed'''
objpath = obj.get_object_path()
logger.debug(f'Object removed: {objpath}')
def _process_object(self, obj, event=True):
"""Process a single DBusProxyObject"""
'''Process a single DBusProxyObject'''
if obj.get_interface(ORG_BLUEZ_ADAPTER1) is not None:
self._process_adapter(obj)
@ -424,8 +424,8 @@ class BlueZDeviceManager(GObject.Object):
def _process_device(self, obj, event=True):
dev = BlueZDevice(self._om, obj)
self.devices.append(dev)
dev.connect("updated", self._on_device_updated)
self.emit("device-added", dev, event)
dev.connect('updated', self._on_device_updated)
self.emit('device-added', dev, event)
def _process_characteristic(self, obj):
objpath = obj.get_object_path()

View File

@ -42,9 +42,9 @@ class TuhiConfig(GObject.Object):
@property
def devices(self):
"""
'''
Returns a dictionary with the bluetooth address as key
"""
'''
return self._devices
def _scan_config_dir(self):
@ -110,7 +110,7 @@ class TuhiConfig(GObject.Object):
logger.debug(f'{address}: adding new drawing, timestamp {drawing.timestamp}')
path = os.path.join(ROOT_PATH, address, f'{drawing.timestamp}.json')
with open(path, "w") as f:
with open(path, 'w') as f:
f.write(drawing.to_json())
def load_drawings(self, address):

View File

@ -18,7 +18,7 @@ from gi.repository import GObject, Gio, GLib
logger = logging.getLogger('tuhi.dbus')
INTROSPECTION_XML = """
INTROSPECTION_XML = '''
<node>
<interface name='org.freedesktop.tuhi1.Manager'>
<property type='ao' name='Devices' access='read'>
@ -81,7 +81,7 @@ INTROSPECTION_XML = """
</signal>
</interface>
</node>
"""
'''
BASE_PATH = '/org/freedesktop/tuhi1'
BUS_NAME = 'org.freedesktop.tuhi1'
INTF_MANAGER = 'org.freedesktop.tuhi1.Manager'
@ -96,11 +96,11 @@ class _TuhiDBus(GObject.Object):
self.interface = interface
def properties_changed(self, props, dest=None):
"""
'''
Send a PropertiesChanged signal to the given destination (if any).
The props argument is a { name: value } dictionary of the
property values, the values are GVariant.bool, etc.
"""
'''
builder = GLib.VariantBuilder(GLib.VariantType('a{sv}'))
for name, value in props.items():
de = GLib.Variant.new_dict_entry(GLib.Variant.new_string(name),
@ -110,8 +110,8 @@ class _TuhiDBus(GObject.Object):
inval_props = GLib.VariantBuilder(GLib.VariantType('as'))
inval_props = inval_props.end()
self.connection.emit_signal(dest, self.objpath,
"org.freedesktop.DBus.Properties",
"PropertiesChanged",
'org.freedesktop.DBus.Properties',
'PropertiesChanged',
GLib.Variant.new_tuple(
GLib.Variant.new_string(self.interface),
properties,
@ -124,12 +124,12 @@ class _TuhiDBus(GObject.Object):
class TuhiDBusDevice(_TuhiDBus):
"""
'''
Class representing a DBus object for a Tuhi device. This class only
handles the DBus bits, communication with the device is done elsewhere.
"""
'''
__gsignals__ = {
"pair-requested":
'pair-requested':
(GObject.SIGNAL_RUN_FIRST, None, ()),
}
@ -307,7 +307,7 @@ class TuhiDBusDevice(_TuhiDBus):
self.properties_changed({'DrawingsAvailable': ts})
def notify_button_press_required(self):
logger.debug("Sending ButtonPressRequired signal")
logger.debug('Sending ButtonPressRequired signal')
self.signal('ButtonPressRequired')
def __repr__(self):
@ -315,22 +315,22 @@ class TuhiDBusDevice(_TuhiDBus):
class TuhiDBusServer(_TuhiDBus):
"""
'''
Class for the DBus server.
"""
'''
__gsignals__ = {
"bus-name-acquired":
'bus-name-acquired':
(GObject.SIGNAL_RUN_FIRST, None, ()),
"bus-name-lost":
'bus-name-lost':
(GObject.SIGNAL_RUN_FIRST, None, ()),
# Signal arguments:
# search_stop_handler(status)
# to be called when the search process has terminated, with
# an integer status code (0 == success, negative errno)
"search-start-requested":
'search-start-requested':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
"search-stop-requested":
'search-stop-requested':
(GObject.SIGNAL_RUN_FIRST, None, ()),
}
@ -405,7 +405,7 @@ class TuhiDBusServer(_TuhiDBus):
def _start_search(self, connection, sender):
if self.is_searching:
logger.debug("Already searching")
logger.debug('Already searching')
# silently ignore it for the current client but send EAGAIN to
# other clients
@ -426,7 +426,7 @@ class TuhiDBusServer(_TuhiDBus):
user_data=sender)
self._searching_client = (sender, s)
self.emit("search-start-requested", self._on_search_stop)
self.emit('search-start-requested', self._on_search_stop)
for d in self._devices:
if not d.paired:
self._emit_pairable_signal(d)
@ -446,16 +446,16 @@ class TuhiDBusServer(_TuhiDBus):
connection.signal_unsubscribe(self._searching_client[1])
self.is_searching = False
self.emit("search-stop-requested")
self.emit('search-stop-requested')
def _on_search_stop(self, status):
"""
'''
Called by whoever handles the search-start-requested signal
"""
logger.debug("Search has stopped")
'''
logger.debug('Search has stopped')
self.is_searching = False
status = GLib.Variant.new_int32(status)
self.signal("SearchStopped", status, dest=self._searching_client[0])
self.signal('SearchStopped', status, dest=self._searching_client[0])
self._searching_client = None
for dev in self._devices:

View File

@ -72,10 +72,10 @@ class Stroke(GObject.Object):
class Drawing(GObject.Object):
"""
'''
Abstracts a drawing. The drawing is composed Strokes, each of which has
Points.
"""
'''
JSON_FILE_FORMAT_VERSION = 1
def __init__(self, name, dimensions, timestamp):
@ -93,9 +93,9 @@ class Drawing(GObject.Object):
return self.strokes[self._current_stroke]
def new_stroke(self):
"""
'''
Create a new stroke and make it the current stroke
"""
'''
l = Stroke(self)
self.strokes.append(l)
self._current_stroke += 1

View File

@ -50,7 +50,7 @@ def signed_char_to_int(v):
def b2hex(bs):
'''Convert bytes() to a two-letter hex string in the form "1a 2b c3"'''
hx = binascii.hexlify(bs).decode("ascii")
hx = binascii.hexlify(bs).decode('ascii')
return ' '.join([''.join(s) for s in zip(hx[::2], hx[1::2])])
@ -92,19 +92,19 @@ class WacomCorruptDataException(WacomException):
class WacomDevice(GObject.Object):
"""
'''
Class to communicate with the Wacom device. Communication is handled in
a separate thread.
:param device: the BlueZDevice object that is this wacom device
"""
'''
__gsignals__ = {
"drawing":
'drawing':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT,)),
"done":
'done':
(GObject.SIGNAL_RUN_FIRST, None, (GObject.TYPE_PYOBJECT, )),
"button-press-required":
'button-press-required':
(GObject.SIGNAL_RUN_FIRST, None, ()),
}
@ -135,7 +135,7 @@ class WacomDevice(GObject.Object):
return self._uuid
def is_slate(self):
return self.name == "Bamboo Slate"
return self.name == 'Bamboo Slate'
def _on_pen_data_changed(self, name, value):
logger.debug(binascii.hexlify(bytes(value)))
@ -180,11 +180,11 @@ class WacomDevice(GObject.Object):
data = data[6:]
def _on_pen_data_received(self, name, data):
self.fw_logger.debug(f"RX Pen <-- {list2hex(data)}")
self.fw_logger.debug(f'RX Pen <-- {list2hex(data)}')
self.pen_data_buffer.extend(data)
def _on_nordic_data_received(self, name, value):
self.fw_logger.debug(f"RX Nordic <-- {list2hex(value)}")
self.fw_logger.debug(f'RX Nordic <-- {list2hex(value)}')
self.nordic_answer = value
def send_nordic_command(self, command, arguments):
@ -195,14 +195,14 @@ class WacomDevice(GObject.Object):
def check_nordic_incoming(self):
if self.nordic_answer is None:
raise WacomTimeoutException(f"{self.name}: Timeout while reading data")
raise WacomTimeoutException(f'{self.name}: Timeout while reading data')
answer = self.nordic_answer
self.nordic_answer = None
length = answer[1]
args = answer[2:]
if length != len(args):
raise WacomException(f"error while processing answer, should get an answer of size {length} instead of {len(args)}")
raise WacomException(f'error while processing answer, should get an answer of size {length} instead of {len(args)}')
return NordicData(answer)
def wait_nordic_data(self, expected_opcode, timeout):
@ -216,23 +216,23 @@ class WacomDevice(GObject.Object):
if isinstance(expected_opcode, list):
if data.opcode not in expected_opcode:
raise WacomException(f"unexpected opcode: {data.opcode:02x}")
raise WacomException(f'unexpected opcode: {data.opcode:02x}')
else:
if data.opcode != expected_opcode:
raise WacomException(f"unexpected opcode: {data.opcode:02x}")
raise WacomException(f'unexpected opcode: {data.opcode:02x}')
return data
def check_ack(self, data):
if len(data) != 1:
str_b = binascii.hexlify(bytes(data))
raise WacomException(f"unexpected data: {str_b}")
raise WacomException(f'unexpected data: {str_b}')
if data[0] == 0x07:
raise WacomNotPairedException(f"wrong device, please redo pairing")
raise WacomNotPairedException(f'wrong device, please redo pairing')
if data[0] == 0x02:
raise WacomEEAGAINException(f"unexpected answer: {data[0]:02x}")
raise WacomEEAGAINException(f'unexpected answer: {data[0]:02x}')
if data[0] == 0x01:
raise WacomWrongModeException(f"wrong device mode")
raise WacomWrongModeException(f'wrong device mode')
def send_nordic_command_sync(self,
command,
@ -270,7 +270,7 @@ class WacomDevice(GObject.Object):
def set_time(self):
# Device time is UTC
self.current_time = time.strftime("%y%m%d%H%M%S", time.gmtime())
self.current_time = time.strftime('%y%m%d%H%M%S', time.gmtime())
args = [int(i) for i in binascii.unhexlify(self.current_time)]
self.send_nordic_command_sync(command=0xb6,
expected_opcode=0xb3,
@ -352,7 +352,7 @@ class WacomDevice(GObject.Object):
# logger.debug(f'cc returned {data} ')
count = int.from_bytes(data[0:4], byteorder='little')
str_timestamp = ''.join([f'{d:02x}' for d in data[4:]])
timestamp = time.strptime(str_timestamp, "%y%m%d%H%M%S")
timestamp = time.strptime(str_timestamp, '%y%m%d%H%M%S')
return count, timestamp
def get_stroke_data_spark(self):
@ -367,7 +367,7 @@ class WacomDevice(GObject.Object):
# logger.debug(f'cc returned {data} ')
str_timestamp = ''.join([f'{d:02x}' for d in data])
timestamp = time.strptime(str_timestamp, "%y%m%d%H%M%S")
timestamp = time.strptime(str_timestamp, '%y%m%d%H%M%S')
return count, timestamp
def get_stroke_data(self):
@ -379,12 +379,12 @@ class WacomDevice(GObject.Object):
data = self.send_nordic_command_sync(command=0xc3,
expected_opcode=0xc8)
if data[0] != 0xbe:
raise WacomException(f"unexpected answer: {data[0]:02x}")
raise WacomException(f'unexpected answer: {data[0]:02x}')
def wait_for_end_read(self):
data = self.wait_nordic_data(0xc8, 5)
if data[0] != 0xed:
raise WacomException(f"unexpected answer: {data[0]:02x}")
raise WacomException(f'unexpected answer: {data[0]:02x}')
crc = data[1:]
if not self.is_slate():
data = self.wait_nordic_data(0xc9, 5)
@ -457,10 +457,10 @@ class WacomDevice(GObject.Object):
return v, dv, is_rel
def parse_pen_data(self, data, timestamp):
"""
'''
:param timestamp: a tuple with 9 entries, corresponding to the
local time
"""
'''
offset = 0
x, y, p = 0, 0, 0
dx, dy, dp = 0, 0, 0
@ -517,11 +517,11 @@ class WacomDevice(GObject.Object):
transaction_count = 0
while self.is_data_available():
count, timestamp = self.get_stroke_data()
logger.info(f"receiving {count} bytes drawn on {time.asctime(timestamp)}")
logger.info(f'receiving {count} bytes drawn on {time.asctime(timestamp)}')
self.start_reading()
pen_data = self.wait_for_end_read()
str_pen = binascii.hexlify(bytes(pen_data))
logger.info(f"received {str_pen}")
logger.info(f'received {str_pen}')
prefix = pen_data[:4]
# not sure if we really need this check
# note: \x38\x62\x74 translates to '8bt'
@ -558,13 +558,13 @@ class WacomDevice(GObject.Object):
logger.debug(f'firmware is {fw_high}-{fw_low}')
self.ec_command()
if self.read_offline_data() == 0:
logger.info("no data to retrieve")
logger.info('no data to retrieve')
except WacomEEAGAINException:
logger.warning("no data, please make sure the LED is blue and the button is pressed to switch it back to green")
logger.warning('no data, please make sure the LED is blue and the button is pressed to switch it back to green')
def pair_device_slate(self):
self.register_connection()
logger.info("Press the button now to confirm")
logger.info('Press the button now to confirm')
self.emit('button-press-required')
data = self.wait_nordic_data([0xe4, 0xb3], 10)
if data.opcode == 0xb3:
@ -590,7 +590,7 @@ class WacomDevice(GObject.Object):
pass
self.send_nordic_command(command=0xe3,
arguments=[0x01])
logger.info("Press the button now to confirm")
logger.info('Press the button now to confirm')
self.emit('button-press-required')
# Wait for the button confirmation event, or any error
data = self.wait_nordic_data([0xe4, 0xb3], 10)
@ -636,7 +636,7 @@ class WacomDevice(GObject.Object):
finally:
self._pairing_mode = False
self._is_running = False
self.emit("done", exception)
self.emit('done', exception)
def start(self, pairing_mode):
self._pairing_mode = pairing_mode