Oliver Fabel 1 год назад
Родитель
Сommit
f8d12ca8d8

+ 3 - 1
docs/pages/conf.py

@@ -57,4 +57,6 @@ autodoc_default_options = {
     'member-order': 'bysource',
 }
 
-add_module_names = True
+add_module_names = True
+
+maximum_signature_line_length = 50

+ 3 - 0
docs/pages/reference.rst

@@ -86,6 +86,7 @@ Display message dialogs on the display for user infos and confirm actions.
 .. autofunction:: flipperzero.dialog_message_set_header
 .. autofunction:: flipperzero.dialog_message_set_text
 .. autofunction:: flipperzero.dialog_message_set_button
+.. autofunction:: flipperzero.dialog_message_show
 
 Built-In
 --------
@@ -101,6 +102,8 @@ They're members of the global namespace instead.
    :param sep: The separator to use between the objects.
    :param end: The line terminator character to use.
 
+   .. versionadded:: 1.0.0
+
    .. attention::
       
       This function prints to the internal log buffer.

+ 42 - 0
flipperzero/_canvas.py

@@ -2,6 +2,8 @@ def canvas_update() -> None:
     '''
     Updates the display buffer with your drawings from the canvas.
 
+    .. versionadded:: 1.0.0
+
     .. note::
 
         Your drawings will only appear on the display after this function call.
@@ -12,6 +14,8 @@ def canvas_clear() -> None:
     '''
     Clear the whole canvas. This does not affect the current display buffer.
     You need to call :func:`canvas_update` to reveal your changes.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -19,6 +23,8 @@ def canvas_width() -> int:
     '''
     Get the canvas width in pixels.
 
+    .. versionadded:: 1.0.0
+
     :returns: The canvas width.
     '''
     pass
@@ -27,6 +33,8 @@ def canvas_height() -> int:
     '''
     Get the canvas height in pixels.
 
+    .. versionadded:: 1.0.0
+
     :returns: The canvas height.
     '''
     pass
@@ -34,17 +42,23 @@ def canvas_height() -> int:
 COLOR_BLACK: int
 '''
 Constant value for the color `black`.
+
+.. versionadded:: 1.0.0
 '''
 
 COLOR_WHITE: int
 '''
 Constant value for the color `white`.
+
+.. versionadded:: 1.0.0
 '''
 
 def canvas_set_color(color: int) -> None:
     '''
     Set the color to use when drawing or writing on the canvas.
 
+    .. versionadded:: 1.0.0
+
     :param color: The color to use.
     '''
     pass
@@ -52,16 +66,22 @@ def canvas_set_color(color: int) -> None:
 ALIGN_BEGIN: int
 '''
 Align element at `begin` (horizontal or vertical, depends on the context).
+
+.. versionadded:: 1.0.0
 '''
 
 ALIGN_END: int
 '''
 Align element at `end` (horizontal or vertical, depends on the context).
+
+.. versionadded:: 1.0.0
 '''
 
 ALIGN_CENTER: int
 '''
 Align element at `center` (horizontal or vertical, depends on the context).
+
+.. versionadded:: 1.0.0
 '''
 
 def canvas_set_text_align(x: int, y: int) -> None:
@@ -71,17 +91,23 @@ def canvas_set_text_align(x: int, y: int) -> None:
 
     :param x: The horizontal alignment.
     :param y: The vertical alignment.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
 FONT_PRIMARY: int
 '''
 Constant value for the primary font.
+
+.. versionadded:: 1.0.0
 '''
 
 FONT_SECONDARY: int
 '''
 Constant value for the secondary font.
+
+.. versionadded:: 1.0.0
 '''
 
 def canvas_set_font(font: int) -> None:
@@ -89,6 +115,8 @@ def canvas_set_font(font: int) -> None:
     Change the font to use when writing on the canvas using the :func:`canvas_set_text` function.
 
     :param font: The font to use.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -99,6 +127,8 @@ def canvas_set_text(x: int, y: int, text: str) -> None:
     :param x: The horizontal position.
     :param y: The vertical position.
     :param text: The text to write.
+
+    .. versionadded:: 1.0.0
     
     .. code-block::
 
@@ -123,6 +153,8 @@ def canvas_draw_dot(x: int, y: int) -> None:
 
     :param x: The horizontal position.
     :param y: The vertical position.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -136,6 +168,8 @@ def canvas_draw_box(x: int, y: int, w: int, h: int, r: int) -> None:
     :param w: The width of the box.
     :param h: The height of the box.
     :param r: The corner radius to use.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -149,6 +183,8 @@ def canvas_draw_frame(x: int, y: int, w: int, h: int, r: int) -> None:
     :param w: The width of the box.
     :param h: The height of the box.
     :param r: The corner radius to use.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -160,6 +196,8 @@ def canvas_draw_line(x0: int, y0: int, x1: int, y1: int) -> None:
     :param y0: The vertical start position.
     :param x1: The horizontal end position.
     :param y1: The vertical end sposition.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -170,6 +208,8 @@ def canvas_draw_circle(x: int, y: int, r: int) -> None:
     :param x: The horizontal position.
     :param y: The vertical position.
     :param r: The radius to use.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
@@ -180,5 +220,7 @@ def canvas_draw_disc(x: int, y: int, r: int) -> None:
     :param x: The horizontal position.
     :param y: The vertical position.
     :param r: The radius to use.
+
+    .. versionadded:: 1.0.0
     '''
     pass

+ 61 - 0
flipperzero/_dialog.py

@@ -0,0 +1,61 @@
+def dialog_message_set_header(text: str, x: int, y: int, h: int, v: int) -> None:
+    '''
+    Set a header text on the dialog box.
+
+    :param text: The text to set.
+    :param x: The x coordinates to use.
+    :param y: The y coordinates to use.
+    :param h: The horizontal alignment.
+    :param v: The vertical alignment.
+
+    .. versionadded:: 1.0.0
+    '''
+    pass
+
+def dialog_message_set_text(text: str, x: int, y: int, h: int, v: int) -> None:
+    '''
+    Set a text on the dialog box.
+
+    :param text: The text to set.
+    :param x: The x coordinates to use.
+    :param y: The y coordinates to use.
+    :param h: The horizontal alignment.
+    :param v: The vertical alignment.
+
+    .. versionadded:: 1.0.0
+    '''
+    pass
+
+def dialog_message_set_button(text: str, button: int) -> None:
+    '''
+    Set the text of a dialog box button.
+
+    :param text: The text to set.
+    :param button: The button to use (e.g. :const:`flipperzero.INPUT_BUTTON_UP`).
+
+    .. versionadded:: 1.0.0
+    '''
+    pass
+
+def dialog_message_show() -> int:
+    '''
+    Display the dialog box with the configured settings.
+    This function is blocking.
+
+    :returns: The button code, used to close the dialog box (e.g. :const:`flipperzero.INPUT_BUTTON_OK`)
+
+    .. versionadded:: 1.0.0
+
+    .. code-block::
+
+        import flipperzero as f0
+
+        f0.dialog_message_set_header('Important',64, 12)
+        f0.dialog_message_set_text('It this awesome?', 64, 24)
+        f0.dialog_message_set_button('Yes', f0.INPUT_BUTTON_LEFT)
+        f0.dialog_message_set_button('No', f0.INPUT_BUTTON_RIGHT)
+
+        while f0.dialog_message_show() is not f0.INPUT_BUTTON_LEFT:
+            pass
+    '''
+    pass

+ 24 - 0
flipperzero/_input.py

@@ -3,62 +3,86 @@ from typing import Callable
 INPUT_BUTTON_UP: int
 '''
 Constant value for the `up` button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_BUTTON_DOWN: int
 '''
 Constant value for the `down` button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_BUTTON_RIGHT: int
 '''
 Constant value for the `right` button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_BUTTON_LEFT: int
 '''
 Constant value for the `left` button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_BUTTON_OK: int
 '''
 Constant value for the `ok` button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_BUTTON_BACK: int
 '''
 Constant value for the `back` button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_TYPE_PRESS: int
 '''
 Constant value for the `press` event of a button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_TYPE_RELEASE: int
 '''
 Constant value for the `release` event of a button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_TYPE_SHORT: int
 '''
 Constant value for the `short` press event of a button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_TYPE_LONG: int
 '''
 Constant value for the `long` press event of a button.
+
+.. versionadded:: 1.0.0
 '''
 
 INPUT_TYPE_REPEAT: int
 '''
 Constant value for the `repeat` press event of a button.
+
+.. versionadded:: 1.0.0
 '''
 
 def on_input() -> Callable[[int, int], None]:
     '''
     Decorate a function to be used as input handler. The decorated function will be invoked upon interaction with one of the buttons on the Flipper.
 
+    .. versionadded:: 1.0.0
+
     .. code-block::
 
         import flipperzero as f0

+ 16 - 0
flipperzero/_light.py

@@ -3,21 +3,29 @@ from typing import Callable
 LIGHT_RED: int
 '''
 Constant value for the red LED light.
+
+.. versionadded:: 1.0.0
 '''
 
 LIGHT_GREEN: int
 '''
 Constant value for the green LED light.
+
+.. versionadded:: 1.0.0
 '''
 
 LIGHT_BLUE: int
 '''
 Constant value for the blue LED light.
+
+.. versionadded:: 1.0.0
 '''
 
 LIGHT_BACKLIGHT: int
 '''
 Constant value for the display backlight.
+
+.. versionadded:: 1.0.0
 '''
 
 def light_set(light: int, brightness: int) -> None:
@@ -28,6 +36,8 @@ def light_set(light: int, brightness: int) -> None:
     :param light: The RGB channels to set.
     :param brightness: The brightness to use.
 
+    .. versionadded:: 1.0.0
+
     .. code-block::
     
         import flipperzero as f0
@@ -50,6 +60,8 @@ def light_blink_start(light: int, brightness: int, on_time: int, period: int) ->
     :param on_time: The LED's active duration in milliseconds.
     :param period: Total duration of a blink period in milliseconds.
 
+    .. versionadded:: 1.0.0
+
     .. code-block::
     
         import flipperzero as f0
@@ -65,11 +77,15 @@ def light_blink_set_color(light: int) -> None:
     Call the :func:`light_blink_stop` function to stop the blinking LED.
 
     :param light: The RGB channels to set.
+
+    .. versionadded:: 1.0.0
     '''
     pass
 
 def light_blink_stop() -> None:
     '''
     Stop the blinking LED.
+
+    .. versionadded:: 1.0.0
     '''
     pass

+ 0 - 32
flipperzero/_modal.py

@@ -1,32 +0,0 @@
-def dialog_message_set_header(text: str, x: int, y: int, h: int, v: int) -> None:
-    '''
-    Set a header text on the dialog box.
-
-    :param text: The text to set.
-    :param x: The x coordinates to use.
-    :param y: The y coordinates to use.
-    :param h: The horizontal alignment.
-    :param v: The vertical alignment.
-    '''
-    pass
-
-def dialog_message_set_text(text: str, x: int, y: int, h: int, v: int) -> None:
-    '''
-    Set a text on the dialog box.
-
-    :param text: The text to set.
-    :param x: The x coordinates to use.
-    :param y: The y coordinates to use.
-    :param h: The horizontal alignment.
-    :param v: The vertical alignment.
-    '''
-    pass
-
-def dialog_message_set_button(text: str, button: int) -> None:
-    '''
-    Set the text of a dialog box button.
-
-    :param text: The text to set.
-    :param button: The button to use (e.g. :const:`flipperzero._input.INPUT_BUTTON_UP`).
-    '''
-    pass

+ 6 - 0
flipperzero/_speaker.py

@@ -8,6 +8,8 @@ def speaker_start(frequency: float, volume: float) -> bool:
     :param volume: The volume to use.
     :returns: :const:`True` if the speaker was acquired.
 
+    .. versionadded:: 1.0.0
+
     .. code-block::
         
         import flipperzero as f0
@@ -25,6 +27,8 @@ def speaker_set_volume(volume: float) -> bool:
     :param volume: The volume to use.
     :returns: :const:`True` if the speaker was acquired.
 
+    .. versionadded:: 1.0.0
+
     This function can be used to play `nice` sounds:
 
     .. code-block::
@@ -52,5 +56,7 @@ def speaker_stop() -> bool:
     Stop the speaker output.
 
     :returns: :const:`True` if the speaker was successfully released.
+
+    .. versionadded:: 1.0.0
     '''
     pass

+ 2 - 0
flipperzero/_vibro.py

@@ -4,5 +4,7 @@ def vibro_set(state: bool) -> bool:
 
     :param state: :const:`True` to turn on vibration.
     :returns: :const:`True` if vibration is on.
+
+    .. versionadded:: 1.0.0
     '''
     pass