Skip to content

Commit f922a68

Browse files
authored
Merge pull request #10 from kmatch98/switch_round
rearranged documentation
2 parents ec1ebf2 + 760b36c commit f922a68

File tree

1 file changed

+50
-54
lines changed

1 file changed

+50
-54
lines changed

adafruit_displayio_layout/widgets/switch_round.py

+50-54
Original file line numberDiff line numberDiff line change
@@ -50,13 +50,60 @@
5050

5151

5252
class SwitchRound(Widget, Control):
53-
"""
5453

54+
"""
5555
.. note:: Jump directly to:
5656
57-
- :ref:`SwitchRound input parameters <parameters>`
58-
- :ref:`SwitchRound methods <methods>`
57+
- :ref:`SwitchRound: Input parameters <parameters>`
58+
- :ref:`SwitchRound: Methods <methods>`
59+
- :ref:`SwitchRound: Description of implementation <links>`
60+
61+
.. _parameters:
5962
63+
:param int x: pixel position, defaults to 0
64+
:param int y: pixel position, defaults to 0
65+
:param int width: width of the switch in pixels, if set to None (**recommended**)
66+
the width will auto-size relative to the height, defaults to None
67+
:param int height: height of the switch in pixels, defaults to 40 pixels
68+
:param int touch_padding: the width of an additional border surrounding the switch
69+
that extends the touch response boundary, defaults to 0
70+
:param Boolean horizontal: To set vertical orientation, set ``horizontal``
71+
to False, defaults to True
72+
:param Boolean flip: Setting ``flip`` to True will flip the on and off
73+
direction, default is True
74+
:param float anchor_point: (X,Y) values from 0.0 to 1.0 to define the anchor
75+
point relative to the switch bounding box, default is None
76+
:param int anchored_position: (x,y) pixel value for the location
77+
of the anchor_point, default is None
78+
:param fill_color_off: (*RGB tuple
79+
or 24-bit hex value*) switch off-state fill color, default is ``(66, 44, 66)`` gray.
80+
:param fill_color_on: (*RGB tuple
81+
or 24-bit hex value*) switch on-state fill color, default is ``(0, 100, 0)`` green.
82+
:param outline_color_off: (*RGB tuple
83+
or 24-bit hex value*) switch off-state outline color, default is ``(30, 30, 30)``
84+
dark gray.
85+
:param outline_color_on: (*RGB tuple
86+
or 24-bit hex value*) switch on-state outline color, default is ``(0, 60, 0)`` green
87+
:param background_color_off: (*RGB tuple
88+
or 24-bit hex value*) background off-state color, default is ``(255, 255, 255)`` white
89+
:param background_color_on: (*RGB tuple
90+
or 24-bit hex value*) background on-state color, default is ``(0, 60, 0)`` dark green
91+
:param background_outline_color_off: (*RGB tuple
92+
or 24-bit hex value*) background outline color in off-state, if set to None this
93+
will default to ``background_color_off``, default is None
94+
:param background_outline_color_on: (*RGB tuple
95+
or 24-bit hex value*) background outline color in on-state, if set to None this
96+
will default to ``background_color_on``, default is None
97+
:param int switch_stroke: outline stroke width for the switch and background,
98+
in pixels, default is 2
99+
:param int text_stroke: outline stroke width (in pixels) for the 0/1 text shape
100+
outlines, if set to None it will use the value for ``switch_stroke``, default
101+
value is None
102+
:param Boolean display_button_text: Set True to display the 0/1 text shapes
103+
on the sliding switch, set False to hide the 0/1 text shapes, default value is True
104+
:param float animation_time: time for the switching animation, in seconds, default
105+
value is 0.2 seconds.
106+
:param Boolean value: the initial value for the switch, default is False
60107
61108
.. _links:
62109
@@ -360,57 +407,6 @@ class functions. The `Widget` class handles the overall sizing and positioning
360407
.. note:: **Never let any of these class definitions hold you back, let your imagination run
361408
wild and make some cool widgets!**
362409
363-
.. _parameters:
364-
365-
**SwitchRound input parameters**
366-
367-
:param int x: pixel position, defaults to 0
368-
:param int y: pixel position, defaults to 0
369-
:param int width: width of the switch in pixels, if set to None (**recommended**)
370-
the width will auto-size relative to the height, defaults to None
371-
:param int height: height of the switch in pixels, defaults to 40 pixels
372-
:param int touch_padding: the width of an additional border surrounding the switch
373-
that extends the touch response boundary, defaults to 0
374-
:param Boolean horizontal: To set vertical orientation, set ``horizontal``
375-
to False, defaults to True
376-
:param Boolean flip: Setting ``flip`` to True will flip the on and off
377-
direction, default is True
378-
:param float anchor_point: (X,Y) values from 0.0 to 1.0 to define the anchor
379-
point relative to the switch bounding box, default is None
380-
:param int anchored_position: (x,y) pixel value for the location
381-
of the anchor_point, default is None
382-
:param fill_color_off: (*RGB tuple
383-
or 24-bit hex value*) switch off-state fill color, default is ``(66, 44, 66)`` gray.
384-
:param fill_color_on: (*RGB tuple
385-
or 24-bit hex value*) switch on-state fill color, default is ``(0, 100, 0)`` green.
386-
:param outline_color_off: (*RGB tuple
387-
or 24-bit hex value*) switch off-state outline color, default is ``(30, 30, 30)``
388-
dark gray.
389-
:param outline_color_on: (*RGB tuple
390-
or 24-bit hex value*) switch on-state outline color, default is ``(0, 60, 0)`` green
391-
:param background_color_off: (*RGB tuple
392-
or 24-bit hex value*) background off-state color, default is ``(255, 255, 255)`` white
393-
:param background_color_on: (*RGB tuple
394-
or 24-bit hex value*) background on-state color, default is ``(0, 60, 0)`` dark green
395-
:param background_outline_color_off: (*RGB tuple
396-
or 24-bit hex value*) background outline color in off-state, if set to None this
397-
will default to ``background_color_off``, default is None
398-
:param background_outline_color_on: (*RGB tuple
399-
or 24-bit hex value*) background outline color in on-state, if set to None this
400-
will default to ``background_color_on``, default is None
401-
:param int switch_stroke: outline stroke width for the switch and background,
402-
in pixels, default is 2
403-
:param int text_stroke: outline stroke width (in pixels) for the 0/1 text shape
404-
outlines, if set to None it will use the value for ``switch_stroke``, default
405-
value is None
406-
:param Boolean display_button_text: Set True to display the 0/1 text shapes
407-
on the sliding switch, set False to hide the 0/1 text shapes, default value is True
408-
:param float animation_time: time for the switching animation, in seconds, default
409-
value is 0.2 seconds.
410-
:param Boolean value: the initial value for the switch, default is False
411-
412-
See :ref:`SwitchRound details <switch_round_details>` for more information on usage and how it's
413-
designed.
414410
415411
.. _methods:
416412

0 commit comments

Comments
 (0)