| 1 |
# SPDX-License-Identifier: GPL-2.0-or-later |
| 2 |
|
| 3 |
""" |
| 4 |
BlackWidow Macro accessors |
| 5 |
""" |
| 6 |
from openrazer_daemon.dbus_services import endpoint |
| 7 |
|
| 8 |
|
| 9 |
@endpoint('razer.device.macro', 'getMacros', out_sig='s') |
| 10 |
def get_macros(self): |
| 11 |
""" |
| 12 |
Get macros |
| 13 |
|
| 14 |
:return: JSON of macros |
| 15 |
:rtype: str |
| 16 |
""" |
| 17 |
self.logger.debug("DBus call get_macros") |
| 18 |
|
| 19 |
return self.key_manager.dbus_get_macros() |
| 20 |
|
| 21 |
|
| 22 |
@endpoint('razer.device.macro', 'deleteMacro', in_sig='s') |
| 23 |
def delete_macro(self, macro_key): |
| 24 |
""" |
| 25 |
Delete macro from key |
| 26 |
|
| 27 |
:param macro_key: Macro key to delete bound macro from |
| 28 |
:type macro_key: str |
| 29 |
""" |
| 30 |
self.logger.debug("DBus call delete_macro") |
| 31 |
|
| 32 |
self.key_manager.dbus_delete_macro(macro_key) |
| 33 |
|
| 34 |
|
| 35 |
@endpoint('razer.device.macro', 'addMacro', in_sig='ss') |
| 36 |
def add_macro(self, macro_bind_key, macro_json): |
| 37 |
""" |
| 38 |
Add macro to key |
| 39 |
|
| 40 |
The macro_json should be JSON form of a list of dictionaries |
| 41 |
:param macro_bind_key: Macro key to delete bound macro from |
| 42 |
:type macro_bind_key: str |
| 43 |
|
| 44 |
:param macro_json: JSON list |
| 45 |
:type macro_json: str |
| 46 |
""" |
| 47 |
self.logger.debug("DBus call add_macro") |
| 48 |
|
| 49 |
self.key_manager.dbus_add_macro(macro_bind_key, macro_json) |