Skip to content

Commit

Permalink
refactor: use SpinnerWidget in place of Label for all dynamic con…
Browse files Browse the repository at this point in the history
…tents labels, setting its `text` to `` will spin it, otherwise it behaves like a `Label`
  • Loading branch information
sassanh committed Oct 29, 2024
1 parent f78f461 commit 5683d58
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion ubo_gui/gauge/gauge_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
Widget:
size_hint: 1, 1

Label:
SpinnerWidget:
font_size: dp(12)
text: root.label
text_size: self.size
Expand Down
4 changes: 2 additions & 2 deletions ubo_gui/menu/widgets/item_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -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 ''
Expand All @@ -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
Expand Down
6 changes: 3 additions & 3 deletions ubo_gui/menu/widgets/menu_page_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -25,7 +25,7 @@
shorten_from: 'right'
markup: True

Label:
SpinnerWidget:
text: root.sub_heading
text_size: self.size
font_size: dp(16)
Expand All @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions ubo_gui/notification/notification_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -58,7 +58,7 @@
strip: True
markup: True

Label:
SpinnerWidget:
font_size: dp(16)
text: root.content
text_size: self.size[0], None
Expand Down
4 changes: 2 additions & 2 deletions ubo_gui/prompt/prompt_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion ubo_gui/spinner/spinner_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
PushMatrix

Rotate:
angle: self.angle
angle: self.angle if root.text == '' else 0
origin: self.center

canvas.after:
Expand Down

0 comments on commit 5683d58

Please sign in to comment.