|
29 | 29 |
|
30 | 30 |
|
31 | 31 | class ProgressBarBase(displayio.TileGrid):
|
| 32 | + """The base class for dynamic progress bar widgets. |
| 33 | +
|
| 34 | + :param (int, int) position: The coordinates (x, y) of the top left corner |
| 35 | + :param (int, int) size: The size (width, height) of the progress bar |
| 36 | + :param flaot start_value: The beginning value of the progress bar. This value |
| 37 | + is displayed when the progress bar is first visible, |
| 38 | + if it hasn't been updated. |
| 39 | + :param int bar_color: The color of the bar representing the value. This can |
| 40 | + be a hexadecimal value for color (0x224466). |
| 41 | + Default: 0x00FF00 (Solid green) |
| 42 | + :param int outline_color: The color of the border around the progress bar. This |
| 43 | + can be a hexadecimal value for color (0x4488BB). |
| 44 | + Default: 0xFFFFFF (White) |
| 45 | + :param int fill_color: The colour of the bar representing the remainder of the |
| 46 | + value. i.e. if the current value is 42%, the 42 value |
| 47 | + is represented by the bar_color parameter. The remainder, |
| 48 | + 58%, will be displayed in this color. This can also |
| 49 | + be a hexadecimal value for color (0xEE7755). |
| 50 | + Default: 0x000000 (Black) |
| 51 | + """ |
| 52 | + |
32 | 53 | def __init__(
|
33 | 54 | self,
|
34 | 55 | position: (int, int),
|
@@ -63,28 +84,36 @@ def __init__(
|
63 | 84 |
|
64 | 85 | @property.getter
|
65 | 86 | def width(self):
|
| 87 | + """The total width of the widget""" |
66 | 88 | return self._size[0]
|
67 | 89 |
|
68 | 90 | @property.getter
|
69 | 91 | def height(self):
|
| 92 | + """The total height of the widget""" |
70 | 93 | return self._size[1]
|
71 | 94 |
|
72 | 95 | @property.getter
|
73 | 96 | def x(self):
|
| 97 | + """The horizontal (x) position of the top-left corner of the widget""" |
74 | 98 | return self._position[0]
|
75 | 99 |
|
76 | 100 | @property.getter
|
77 | 101 | def y(self):
|
| 102 | + """The vertical (y) position of the top-left corner of the widget""" |
78 | 103 | return self._position[1]
|
79 | 104 |
|
80 | 105 | @property
|
81 | 106 | def progress(self):
|
| 107 | + """The current displayed value of the widget""" |
82 | 108 | return self._progress
|
83 | 109 |
|
84 | 110 | @property.setter
|
85 | 111 | def progress(self, value):
|
| 112 | + """Sets/updates the displayed value""" |
86 | 113 | self._progress = value
|
87 | 114 | self.render()
|
88 | 115 |
|
89 | 116 | def render(self):
|
| 117 | + """The method called when the display needs to be updated. This method |
| 118 | + can be overridden in child classes to handle the graphics appropriately.""" |
90 | 119 | pass
|
0 commit comments