@@ -78,6 +78,13 @@ class Model:
7878 MODEL_UNKNOWN = - 3
7979
8080
81+ class ControlMode :
82+ FIRMWARE_CTRL = 0x00
83+ EFFECT_CTRL = 0x01
84+ CUSTOM_CTRL = 0x02
85+ PROFILE_CTRL = 0x03
86+
87+
8188MODEL_STRINGS = {
8289 0 : "MasterKeys Pro L RGB" ,
8390 5 : "MasterKeys Pro M RGB" ,
@@ -111,9 +118,9 @@ def set_device(model):
111118 is supported in the Python library. Only the first found device
112119 of the specified model is controlled.
113120 :type model: int
114- :return: Result code
121+ :return: Result code (:class:`.ResultCode`)
115122 :rtype: int
116- :raises: TypeError upon invalid argument type
123+ :raises: `` TypeError`` upon invalid argument type
117124 """
118125 return _mk .set_device (model )
119126
@@ -123,7 +130,7 @@ def enable_control():
123130 """
124131 Enable control on the device that has been set
125132
126- :return: Result code
133+ :return: Result code (:class:`.ResultCode`)
127134 :rtype: int
128135 """
129136 return _mk .enable_control ()
@@ -134,7 +141,7 @@ def disable_control():
134141 """
135142 Disable control on the device that has been set and is controlled
136143
137- :return: Result code
144+ :return: Result code (:class:`.ResultCode`)
138145 :rtype: int
139146 """
140147 return _mk .disable_control ()
@@ -145,11 +152,11 @@ def set_effect(effect):
145152 """
146153 Set the effect to be active on the controlled keyboard
147154
148- :param effect: Effect number to set to be active
155+ :param effect: Effect number to set to be active (:class:`.Effect`)
149156 :type effect: int
150- :return: Result code
157+ :return: Result code (:class:`.ResultCode`)
151158 :rtype: int
152- :raises: TypeError upon invalid argument type
159+ :raises: `` TypeError`` upon invalid argument type
153160 """
154161 return _mk .set_effect (effect )
155162
@@ -162,10 +169,11 @@ def set_all_led_color(layout):
162169 :param layout: List of lists of color tuples such as created by
163170 build_layout_list()
164171 :type layout: List[List[Tuple[int, int, int], ...], ...]
165- :return: Result code
172+ :return: Result code (:class:`.ResultCode`)
166173 :rtype: int
167- :raises: ValueError if the wrong amount of elements is in the list
168- :raises: TypeError if invalid argument type (any element)
174+ :raises: ``ValueError`` if the wrong amount of elements is in the
175+ list
176+ :raises: ``TypeError`` if invalid argument type (any element)
169177 """
170178 return _mk .set_all_led_color (layout )
171179
@@ -181,7 +189,7 @@ def set_full_led_color(r, g, b):
181189 :type g: int
182190 :param b: blue color byte
183191 :type b: int
184- :return: Result code
192+ :return: Result code (:class:`.ResultCode`)
185193 :rtype: int
186194 """
187195 return _mk .set_full_led_color (r , g , b )
@@ -202,9 +210,9 @@ def set_ind_led_color(row, col, r, g, b):
202210 :type g: int
203211 :param b: blue color byte
204212 :type b: int
205- :return: Result code
213+ :return: Result code (:class:`.ResultCode`)
206214 :rtype: int
207- :raises: TypeError upon invalid argument type
215+ :raises: `` TypeError`` upon invalid argument type
208216 """
209217 return _mk .set_ind_led_color (row , col , r , g , b )
210218
@@ -255,7 +263,7 @@ def set_effect_details(effect, direction=0, speed=0x60, amount=0x00,
255263 For more details about the parameters, please see the libmk
256264 documentation.
257265
258- :param effect: Effect number
266+ :param effect: Effect number (:class:`.Effect`)
259267 :type effect: int
260268 :param direction: Direction of the animation of the effect
261269 :type direction: int
@@ -267,8 +275,57 @@ def set_effect_details(effect, direction=0, speed=0x60, amount=0x00,
267275 :type foreground: Tuple[int, int, int]
268276 :param background: Background color of the effect
269277 :type background: Tuple[int, int, int]
270- :return: Result code
278+ :return: Result code (:class:`.ResultCode`)
271279 :rtype: int
272280 """
273281 return _mk .set_effect_details (
274282 effect , direction , speed , amount , foreground , background )
283+
284+
285+ def get_active_profile ():
286+ # type: () -> int
287+ """
288+ Return the number of the profile active on the keyboard
289+
290+ :return: Result code (:class:`.ResultCode`) or profile number
291+ :rtype: int
292+ """
293+ return _mk .get_active_profile ()
294+
295+
296+ def set_active_profile (profile ):
297+ # type: (int) -> int
298+ """
299+ Activate a profile on the keyboard
300+
301+ :param profile: Number of profile to activate
302+ :type profile: int
303+ :return: Result code (:class:`.ResultCode`)
304+ :rtype: int
305+ """
306+ return _mk .set_active_profile (profile )
307+
308+
309+ def save_profile ():
310+ # type: () -> int
311+ """
312+ Save the changes made to the lighting to the active profile
313+
314+ :return: Result code (:class:`.ResultCode`)
315+ :rtype: int
316+ """
317+ return _mk .save_profile ()
318+
319+
320+ def set_control_mode (mode ):
321+ # type: (int) -> int
322+ """
323+ Change the control mode of the keyboard manually
324+
325+ :param mode: New control mode to set (:class:`.ControlMode`)
326+ :type mode: int
327+ :return: Result code (:class:`.ResultCode`)
328+ :rtype: int
329+ """
330+ return _mk .set_control_mode (mode )
331+
0 commit comments