From 3a2b00ec524292cb4eb64a4569ffe1e86530c719 Mon Sep 17 00:00:00 2001 From: Sassan Haradji Date: Sat, 17 Aug 2024 20:13:57 +0400 Subject: [PATCH] feat: widen the notification text horizontally if it doesn't have any actions on the left --- CHANGELOG.md | 4 ++ poetry.lock | 52 ++++++++++----------- pyproject.toml | 8 ++-- ubo_gui/menu/menu_widget.py | 2 +- ubo_gui/menu/types.py | 10 ++-- ubo_gui/notification/notification_widget.kv | 6 +-- 6 files changed, 41 insertions(+), 41 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5a502..de37487 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,9 @@ # Changelog +## Version 0.13.1 + +- feat: widen the notification text horizontally if it doesn't have any actions on the left + ## Version 0.13.0 - fix: updating items of the pages after the first page not being visible diff --git a/poetry.lock b/poetry.lock index 1862029..a117371 100644 --- a/poetry.lock +++ b/poetry.lock @@ -134,13 +134,13 @@ files = [ [[package]] name = "headless-kivy" -version = "0.9.5" +version = "0.9.7" description = "Headless renderer for Kivy framework" optional = false python-versions = "<4.0,>=3.11" files = [ - {file = "headless_kivy-0.9.5-py3-none-any.whl", hash = "sha256:ac87b8a597e8f5be355c0605f9294df935e7ba5e428001f011f87fdb51225dfb"}, - {file = "headless_kivy-0.9.5.tar.gz", hash = "sha256:cc56eac859b6cfa9544e66b9709ed8063e7fabad5b84c0961822f063ea6641bb"}, + {file = "headless_kivy-0.9.7-py3-none-any.whl", hash = "sha256:647f012d289a4c64e366e526ad113c85646d5f1cb034fa5d76713b3aaa7c3bf2"}, + {file = "headless_kivy-0.9.7.tar.gz", hash = "sha256:247534b46f80732621e1336b1ff83d5d05a023042ba16b27c572d04323cd5c37"}, ] [package.dependencies] @@ -426,13 +426,13 @@ files = [ [[package]] name = "pyright" -version = "1.1.375" +version = "1.1.376" description = "Command line wrapper for pyright" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.375-py3-none-any.whl", hash = "sha256:4c5e27eddeaee8b41cc3120736a1dda6ae120edf8523bb2446b6073a52f286e3"}, - {file = "pyright-1.1.375.tar.gz", hash = "sha256:7765557b0d6782b2fadabff455da2014476404c9e9214f49977a4e49dec19a0f"}, + {file = "pyright-1.1.376-py3-none-any.whl", hash = "sha256:0f2473b12c15c46b3207f0eec224c3cea2bdc07cd45dd4a037687cbbca0fbeff"}, + {file = "pyright-1.1.376.tar.gz", hash = "sha256:bffd63b197cd0810395bb3245c06b01f95a85ddf6bfa0e5644ed69c841e954dd"}, ] [package.dependencies] @@ -536,29 +536,29 @@ use-chardet-on-py3 = ["chardet (>=3.0.2,<6)"] [[package]] name = "ruff" -version = "0.5.7" +version = "0.6.1" description = "An extremely fast Python linter and code formatter, written in Rust." optional = false python-versions = ">=3.7" files = [ - {file = "ruff-0.5.7-py3-none-linux_armv6l.whl", hash = "sha256:548992d342fc404ee2e15a242cdbea4f8e39a52f2e7752d0e4cbe88d2d2f416a"}, - {file = "ruff-0.5.7-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:00cc8872331055ee017c4f1071a8a31ca0809ccc0657da1d154a1d2abac5c0be"}, - {file = "ruff-0.5.7-py3-none-macosx_11_0_arm64.whl", hash = "sha256:eaf3d86a1fdac1aec8a3417a63587d93f906c678bb9ed0b796da7b59c1114a1e"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:a01c34400097b06cf8a6e61b35d6d456d5bd1ae6961542de18ec81eaf33b4cb8"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:fcc8054f1a717e2213500edaddcf1dbb0abad40d98e1bd9d0ad364f75c763eea"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7f70284e73f36558ef51602254451e50dd6cc479f8b6f8413a95fcb5db4a55fc"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:a78ad870ae3c460394fc95437d43deb5c04b5c29297815a2a1de028903f19692"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:9ccd078c66a8e419475174bfe60a69adb36ce04f8d4e91b006f1329d5cd44bcf"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:7e31c9bad4ebf8fdb77b59cae75814440731060a09a0e0077d559a556453acbb"}, - {file = "ruff-0.5.7-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:8d796327eed8e168164346b769dd9a27a70e0298d667b4ecee6877ce8095ec8e"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4a09ea2c3f7778cc635e7f6edf57d566a8ee8f485f3c4454db7771efb692c499"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:a36d8dcf55b3a3bc353270d544fb170d75d2dff41eba5df57b4e0b67a95bb64e"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9369c218f789eefbd1b8d82a8cf25017b523ac47d96b2f531eba73770971c9e5"}, - {file = "ruff-0.5.7-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:b88ca3db7eb377eb24fb7c82840546fb7acef75af4a74bd36e9ceb37a890257e"}, - {file = "ruff-0.5.7-py3-none-win32.whl", hash = "sha256:33d61fc0e902198a3e55719f4be6b375b28f860b09c281e4bdbf783c0566576a"}, - {file = "ruff-0.5.7-py3-none-win_amd64.whl", hash = "sha256:083bbcbe6fadb93cd86709037acc510f86eed5a314203079df174c40bbbca6b3"}, - {file = "ruff-0.5.7-py3-none-win_arm64.whl", hash = "sha256:2dca26154ff9571995107221d0aeaad0e75a77b5a682d6236cf89a58c70b76f4"}, - {file = "ruff-0.5.7.tar.gz", hash = "sha256:8dfc0a458797f5d9fb622dd0efc52d796f23f0a1493a9527f4e49a550ae9a7e5"}, + {file = "ruff-0.6.1-py3-none-linux_armv6l.whl", hash = "sha256:b4bb7de6a24169dc023f992718a9417380301b0c2da0fe85919f47264fb8add9"}, + {file = "ruff-0.6.1-py3-none-macosx_10_12_x86_64.whl", hash = "sha256:45efaae53b360c81043e311cdec8a7696420b3d3e8935202c2846e7a97d4edae"}, + {file = "ruff-0.6.1-py3-none-macosx_11_0_arm64.whl", hash = "sha256:bc60c7d71b732c8fa73cf995efc0c836a2fd8b9810e115be8babb24ae87e0850"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:2c7477c3b9da822e2db0b4e0b59e61b8a23e87886e727b327e7dcaf06213c5cf"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:3a0af7ab3f86e3dc9f157a928e08e26c4b40707d0612b01cd577cc84b8905cc9"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:392688dbb50fecf1bf7126731c90c11a9df1c3a4cdc3f481b53e851da5634fa5"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:5278d3e095ccc8c30430bcc9bc550f778790acc211865520f3041910a28d0024"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:fe6d5f65d6f276ee7a0fc50a0cecaccb362d30ef98a110f99cac1c7872df2f18"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:b2e0dd11e2ae553ee5c92a81731d88a9883af8db7408db47fc81887c1f8b672e"}, + {file = "ruff-0.6.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d812615525a34ecfc07fd93f906ef5b93656be01dfae9a819e31caa6cfe758a1"}, + {file = "ruff-0.6.1-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:faaa4060f4064c3b7aaaa27328080c932fa142786f8142aff095b42b6a2eb631"}, + {file = "ruff-0.6.1-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:99d7ae0df47c62729d58765c593ea54c2546d5de213f2af2a19442d50a10cec9"}, + {file = "ruff-0.6.1-py3-none-musllinux_1_2_i686.whl", hash = "sha256:9eb18dfd7b613eec000e3738b3f0e4398bf0153cb80bfa3e351b3c1c2f6d7b15"}, + {file = "ruff-0.6.1-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:c62bc04c6723a81e25e71715aa59489f15034d69bf641df88cb38bdc32fd1dbb"}, + {file = "ruff-0.6.1-py3-none-win32.whl", hash = "sha256:9fb4c4e8b83f19c9477a8745e56d2eeef07a7ff50b68a6998f7d9e2e3887bdc4"}, + {file = "ruff-0.6.1-py3-none-win_amd64.whl", hash = "sha256:c2ebfc8f51ef4aca05dad4552bbcf6fe8d1f75b2f6af546cc47cc1c1ca916b5b"}, + {file = "ruff-0.6.1-py3-none-win_arm64.whl", hash = "sha256:3bc81074971b0ffad1bd0c52284b22411f02a11a012082a76ac6da153536e014"}, + {file = "ruff-0.6.1.tar.gz", hash = "sha256:af3ffd8c6563acb8848d33cd19a69b9bfe943667f0419ca083f8ebe4224a3436"}, ] [[package]] @@ -603,4 +603,4 @@ zstd = ["zstandard (>=0.18.0)"] [metadata] lock-version = "2.0" python-versions = "^3.11" -content-hash = "3373b681a74f499f4b8836f17a65ba597e2ceac6aed22ea0579b0b01a89317d9" +content-hash = "a70661c40f07ab5031a08606d14acb31e3ccb0938884338d36457d19f0ee2055" diff --git a/pyproject.toml b/pyproject.toml index c31d991..deef562 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ubo-gui" -version = "0.13.0" +version = "0.13.1" description = "GUI sdk for Ubo Pod" authors = ["Sassan Haradji "] license = "Apache-2.0" @@ -9,7 +9,7 @@ packages = [{ include = "ubo_gui" }] include = ['ubo_gui/assets/fonts/*'] [tool.poetry.dependencies] -headless-kivy = "^0.9.0" +headless-kivy = "^0.9.7" python = "^3.11" python-immutable = "^1.0.2" qrcode = "^7.4.2" @@ -19,8 +19,8 @@ optional = true [tool.poetry.group.dev.dependencies] poethepoet = "^0.24.4" -pyright = "^1.1.374" -ruff = "^0.5.6" +pyright = "^1.1.376" +ruff = "^0.6.1" [build-system] requires = ["poetry-core"] diff --git a/ubo_gui/menu/menu_widget.py b/ubo_gui/menu/menu_widget.py index 7064e87..8d51ebd 100644 --- a/ubo_gui/menu/menu_widget.py +++ b/ubo_gui/menu/menu_widget.py @@ -195,7 +195,7 @@ def handle_menu_change(menu: Menu) -> None: with self.stack_lock: if stack_item: stack_item = self._replace_menu(stack_item, menu) - else: + elif menu: stack_item = self._push( menu, parent=parent, diff --git a/ubo_gui/menu/types.py b/ubo_gui/menu/types.py index c1cda98..098b8f1 100644 --- a/ubo_gui/menu/types.py +++ b/ubo_gui/menu/types.py @@ -199,17 +199,13 @@ def process_subscribable_value( value: T | Callable[[], T], callback: Callable[[T], None], ) -> Callable[[], None]: ... - - @overload -def process_subscribable_value( # pyright: ignore[reportOverlappingOverload] +def process_subscribable_value( value: T | None | Callable[[], T | None], callback: Callable[[T | None], None], ) -> Callable[[], None]: ... - - def process_subscribable_value( - value: T | Callable[[], T], + value: T | None | Callable[[], T], callback: Callable[[T], None], ) -> Callable[[], None]: """Return the attribute of the menu or item. @@ -217,7 +213,7 @@ def process_subscribable_value( in case it's a function, the return value of the function is called. """ if is_subscribeable(value): - return value.subscribe(callback) + return cast(Subscribable[T], value).subscribe(callback) processed_value = cast( T, value() if callable(value) and not isinstance(value, type) else value, diff --git a/ubo_gui/notification/notification_widget.kv b/ubo_gui/notification/notification_widget.kv index d42310a..f5cd5b9 100644 --- a/ubo_gui/notification/notification_widget.kv +++ b/ubo_gui/notification/notification_widget.kv @@ -8,7 +8,7 @@ BoxLayout: size_hint: None, 1 - width: dp(UBO_GUI_SHORT_WIDTH) + width: dp(UBO_GUI_SHORT_WIDTH) if [item for item in root.items if item] else dp(20) orientation: 'vertical' spacing: dp(UBO_GUI_MENU_ITEM_GAP) @@ -75,8 +75,8 @@ height: max(container.height - scrollable_widget.minimum_height, 0) AnchorLayout: - size_hint: (None, 1) if scrollable_widget.height - container.height else (None, None) - width: dp(UBO_GUI_SHORT_WIDTH) + size_hint: (None, 1) if not slider.disabled else (None, None) + width: dp(UBO_GUI_SHORT_WIDTH) if [item for item in root.items if item] else dp(20) AnimatedSlider: id: slider