feat(widgets): add CircularProgressBar widget#417
feat(widgets): add CircularProgressBar widget#417randomboi404 wants to merge 5 commits intoignis-sh:mainfrom
Conversation
- Implemented CircularProgressBar as a GTK DrawingArea-based widget subclass - Includes factory function for easy creation TODO: Add support to edit properties using css. (As of now, css/scss does NOT work.)
|
Done! |
|
All done! |
| self._track_color = track_color | ||
|
|
||
| BaseWidget.__init__(self, **kwargs) | ||
| self.set_size_request(size[0], size[1]) |
There was a problem hiding this comment.
There are already height_request and width_request properties
| value: float = 1.0, | ||
| min_value: float = 0.0, | ||
| child: Gtk.Widget | None = None, | ||
| max_value: float = 1.0, | ||
| start_angle: float = 0.0, | ||
| end_angle: float = 360.0, | ||
| line_width: int = 4, | ||
| line_style: Literal["none", "butt", "round", "square"] | cairo.LineCap = "round", | ||
| pie: bool = False, | ||
| invert: bool = False, | ||
| size: tuple[int, int] = (100, 100), | ||
| track_color: RGBA | None = None, |
There was a problem hiding this comment.
I think we shouldn't define them in constructor arguments, because they are GObject properties and can be handled by **kwargs automatically. The constructor should explicitly define arguments only for read-only properties, that can be set only during the widget initialization. By the way, I don't see track_color to be a GObject property, did you forget to add it?
The default values can be set below:
self._value: float = 1.0
self._min_value: float = 1.0
self._child: Gtk.Widget | None = None
# and so on...There was a problem hiding this comment.
bind-able values would be good too
| self.start_angle = start_angle | ||
| self.end_angle = end_angle |
There was a problem hiding this comment.
Should start with the underscore, otherwise it sets the value through the GObject setter which triggers queue_draw() additional two times
Add support to edit properties using css. (As of now, css/scss does NOT work.)