diff --git a/CHANGELOG.md b/CHANGELOG.md index 58dada7..c623b75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Upcoming + +- refactor: use `SpinnerWidget` in place of `Label` for all dynamic contents labels, setting its `text` to `` will spin it, otherwise it behaves like a `Label` + ## Version 0.13.4 - chore: migrate from poetry to uv for the sake of improving performance and dealing with conflicting sub-dependencies diff --git a/ubo_gui/gauge/gauge_widget.kv b/ubo_gui/gauge/gauge_widget.kv index 50ec4f6..f4668f7 100644 --- a/ubo_gui/gauge/gauge_widget.kv +++ b/ubo_gui/gauge/gauge_widget.kv @@ -38,7 +38,7 @@ Widget: size_hint: 1, 1 - Label: + SpinnerWidget: font_size: dp(12) text: root.label text_size: self.size diff --git a/ubo_gui/menu/widgets/item_widget.kv b/ubo_gui/menu/widgets/item_widget.kv index 1bc9807..bdc59a6 100644 --- a/ubo_gui/menu/widgets/item_widget.kv +++ b/ubo_gui/menu/widgets/item_widget.kv @@ -31,7 +31,7 @@ width: dp(2) size_hint: None, 1 - Label: + SpinnerWidget: color: root.color font_size: dp(26) text: root.icon if root.icon is not None else '' @@ -40,7 +40,7 @@ valign: 'middle' markup: True - Label: + SpinnerWidget: color: root.color font_size: dp(18) text: '' if root.is_short else root.label diff --git a/ubo_gui/menu/widgets/menu_page_widget.kv b/ubo_gui/menu/widgets/menu_page_widget.kv index 0e8f28d..83e911d 100644 --- a/ubo_gui/menu/widgets/menu_page_widget.kv +++ b/ubo_gui/menu/widgets/menu_page_widget.kv @@ -11,7 +11,7 @@ size_hint: 1, None height: dp(14) if root.has_heading else 0 - Label: + SpinnerWidget: text: root.heading text_size: self.size halign: 'center' @@ -25,7 +25,7 @@ shorten_from: 'right' markup: True - Label: + SpinnerWidget: text: root.sub_heading text_size: self.size font_size: dp(16) @@ -42,7 +42,7 @@ size_hint: 1, None height: dp(10) if root.has_heading else 0 - Label: + SpinnerWidget: text: ('Nothing here yet' if root.placeholder is None else root.placeholder) if root.is_empty else '' text_size: self.size font_size: dp(20) diff --git a/ubo_gui/notification/notification_widget.kv b/ubo_gui/notification/notification_widget.kv index f5cd5b9..cbe9617 100644 --- a/ubo_gui/notification/notification_widget.kv +++ b/ubo_gui/notification/notification_widget.kv @@ -35,7 +35,7 @@ width: container.width id: scrollable_widget - Label: + SpinnerWidget: padding: dp(20), 0, dp(20), 0 font_size: dp(42) text: root.icon @@ -46,7 +46,7 @@ height: dp(42) if root.icon else 0 markup: True - Label: + SpinnerWidget: font_size: dp(22) text: root.notification_title size_hint: None, None if root.notification_title else 0 @@ -58,7 +58,7 @@ strip: True markup: True - Label: + SpinnerWidget: font_size: dp(16) text: root.content text_size: self.size[0], None diff --git a/ubo_gui/prompt/prompt_widget.kv b/ubo_gui/prompt/prompt_widget.kv index 4b0d1a9..baa8db6 100644 --- a/ubo_gui/prompt/prompt_widget.kv +++ b/ubo_gui/prompt/prompt_widget.kv @@ -7,7 +7,7 @@ orientation: 'vertical' spacing: dp(UBO_GUI_MENU_ITEM_GAP) - Label: + SpinnerWidget: padding: dp(10), 0, dp(10), 0 text_size: self.size halign: 'center' @@ -19,7 +19,7 @@ text: root.icon if root.icon is not None else '' markup: True - Label: + SpinnerWidget: padding: dp(10), 0, dp(10), 0 text: root.prompt text_size: self.size[0], None diff --git a/ubo_gui/spinner/__init__.py b/ubo_gui/spinner/__init__.py index b7e6b7e..ce2fecd 100644 --- a/ubo_gui/spinner/__init__.py +++ b/ubo_gui/spinner/__init__.py @@ -18,7 +18,10 @@ class SpinnerWidget(Label): def on_kv_post(self: SpinnerWidget, base_widget: SpinnerWidget) -> None: """Start the spinner animation.""" _ = base_widget - rotation = Animation(angle=-360, duration=0.5) + Animation(angle=0, duration=0) + rotation = Animation(angle=-360 * 100, duration=0.5 * 100) + Animation( + angle=0, + duration=0, + ) rotation.repeat = True rotation.start(self) diff --git a/ubo_gui/spinner/spinner_widget.kv b/ubo_gui/spinner/spinner_widget.kv index a01932d..55c5bbe 100644 --- a/ubo_gui/spinner/spinner_widget.kv +++ b/ubo_gui/spinner/spinner_widget.kv @@ -7,7 +7,7 @@ PushMatrix Rotate: - angle: self.angle + angle: self.angle if root.text == '' else 0 origin: self.center canvas.after: