From 6c2d64843b5e634a4841f38ade8368514357e5de Mon Sep 17 00:00:00 2001 From: John Morrison Date: Sun, 1 May 2022 10:21:29 +0100 Subject: [PATCH] Align debug messages with method called --- kmk/kmk_keyboard.py | 68 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 56 insertions(+), 12 deletions(-) diff --git a/kmk/kmk_keyboard.py b/kmk/kmk_keyboard.py index a121c27..8972e99 100644 --- a/kmk/kmk_keyboard.py +++ b/kmk/kmk_keyboard.py @@ -335,14 +335,22 @@ class KMKKeyboard: module.before_matrix_scan(self) except Exception as err: if self.debug_enabled: - print('Failed to run pre matrix function in module: ', err, module) + print( + 'Failed to run before matrix scan function in module: ', + err, + module, + ) for ext in self.extensions: try: ext.before_matrix_scan(self.sandbox) except Exception as err: if self.debug_enabled: - print('Failed to run pre matrix function in extension: ', err, ext) + print( + 'Failed to run before matrix scan function in extension: ', + err, + ext, + ) def after_matrix_scan(self): for module in self.modules: @@ -350,14 +358,22 @@ class KMKKeyboard: module.after_matrix_scan(self) except Exception as err: if self.debug_enabled: - print('Failed to run post matrix function in module: ', err, module) + print( + 'Failed to run after matrix scan function in module: ', + err, + module, + ) for ext in self.extensions: try: ext.after_matrix_scan(self.sandbox) except Exception as err: if self.debug_enabled: - print('Failed to run post matrix function in extension: ', err, ext) + print( + 'Failed to run after matrix scan function in extension: ', + err, + ext, + ) def before_hid_send(self): for module in self.modules: @@ -365,14 +381,22 @@ class KMKKeyboard: module.before_hid_send(self) except Exception as err: if self.debug_enabled: - print('Failed to run pre hid function in module: ', err, module) + print( + 'Failed to run before hid send function in module: ', + err, + module, + ) for ext in self.extensions: try: ext.before_hid_send(self.sandbox) except Exception as err: if self.debug_enabled: - print('Failed to run pre hid function in extension: ', err, ext) + print( + 'Failed to run before hid send function in extension: ', + err, + ext, + ) def after_hid_send(self): for module in self.modules: @@ -380,14 +404,18 @@ class KMKKeyboard: module.after_hid_send(self) except Exception as err: if self.debug_enabled: - print('Failed to run post hid function in module: ', err, module) + print( + 'Failed to run after hid send function in module: ', err, module + ) for ext in self.extensions: try: ext.after_hid_send(self.sandbox) except Exception as err: if self.debug_enabled: - print('Failed to run post hid function in extension: ', err, ext) + print( + 'Failed to run after hid send function in extension: ', err, ext + ) def powersave_enable(self): for module in self.modules: @@ -395,14 +423,22 @@ class KMKKeyboard: module.on_powersave_enable(self) except Exception as err: if self.debug_enabled: - print('Failed to run post hid function in module: ', err, module) + print( + 'Failed to run on powersave enable function in module: ', + err, + module, + ) for ext in self.extensions: try: ext.on_powersave_enable(self.sandbox) except Exception as err: if self.debug_enabled: - print('Failed to run post hid function in extension: ', err, ext) + print( + 'Failed to run on powersave enable function in extension: ', + err, + ext, + ) def powersave_disable(self): for module in self.modules: @@ -410,13 +446,21 @@ class KMKKeyboard: module.on_powersave_disable(self) except Exception as err: if self.debug_enabled: - print('Failed to run post hid function in module: ', err, module) + print( + 'Failed to run on powersave disable function in module: ', + err, + module, + ) for ext in self.extensions: try: ext.on_powersave_disable(self.sandbox) except Exception as err: if self.debug_enabled: - print('Failed to run post hid function in extension: ', err, ext) + print( + 'Failed to run on powersave disable function in extension: ', + err, + ext, + ) def go(self, hid_type=HIDModes.USB, secondary_hid_type=None, **kwargs): self._init(hid_type=hid_type, secondary_hid_type=secondary_hid_type, **kwargs)