From 4d4163b8cbedd6d55dfcaf3188d3842549f61075 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 22 Mar 2026 17:33:39 -0700 Subject: [PATCH] [feature] Add `LevelBar` widget This is similar to the `Scale` widget, but is non-interactive. --- ignis/widgets/levelbar.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 ignis/widgets/levelbar.py diff --git a/ignis/widgets/levelbar.py b/ignis/widgets/levelbar.py new file mode 100644 index 00000000..3684154a --- /dev/null +++ b/ignis/widgets/levelbar.py @@ -0,0 +1,37 @@ +from gi.repository import Gtk # type: ignore + +from ignis.base_widget import BaseWidget + + +class LevelBar(Gtk.LevelBar, BaseWidget): + """ + Bases: :class:`Gtk.LevelBar` + + An non-interactable progress/level bar. + + Overrided properties: + - mode: The pattern with how the bar is rendered. Default: ``continuous`` + + Mode: + - continuous: The value bar will be one single bar + - discrete: The value bar will be broken into discrete chunks when rendered + + Args: + **kwargs: Properties to set. + + .. code-block:: python + + widgets.LevelBar( + max_value=100, + mode="continuous", + value=75, + ) + """ + + __gtype_name__ = "IgnisLevelBar" + __gproperties__ = {**BaseWidget.gproperties} + + def __init__(self, **kwargs): + Gtk.LevelBar.__init__(self) + self.override_enum("mode", Gtk.LevelBarMode) + BaseWidget.__init__(self, **kwargs)