diff --git a/CHANGELOG.md b/CHANGELOG.md index 4d5c358..80f2842 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## Version 0.11.3 + +- feat(Menu): action items can now return not only the application class, but also + instances of applications too +- fix(QRCodeWidget): set default value of `fit_mode` to `contain` + ## Version 0.11.2 - refactor(NotificationWidget): improve layout of the notification widget diff --git a/poetry.lock b/poetry.lock index 47371df..785f291 100644 --- a/poetry.lock +++ b/poetry.lock @@ -50,13 +50,13 @@ adafruit-circuitpython-typing = "*" [[package]] name = "adafruit-circuitpython-connectionmanager" -version = "1.2.1" +version = "2.0.0" description = "A urllib3.poolmanager/urllib3.connectionpool-like library for managing sockets and connections" optional = true python-versions = "*" files = [ - {file = "adafruit_circuitpython_connectionmanager-1.2.1-py3-none-any.whl", hash = "sha256:fc3588b931583e8759600217d779dafc617bc83430e425f4967b2804221a7dbc"}, - {file = "adafruit_circuitpython_connectionmanager-1.2.1.tar.gz", hash = "sha256:586742d29f335df5c99e940a16c34346b441be7e43ba3ec994f1da88495e8b7b"}, + {file = "adafruit_circuitpython_connectionmanager-2.0.0-py3-none-any.whl", hash = "sha256:a7164831e02c02792c65123d2931dfeb6e998456aa0da48a0effaaddc8af7691"}, + {file = "adafruit_circuitpython_connectionmanager-2.0.0.tar.gz", hash = "sha256:32b0a2e38f703bf6e22d93e6929a301fe4e18fff6f68ad251521b8d250ef6436"}, ] [package.dependencies] @@ -698,13 +698,13 @@ files = [ [[package]] name = "pyright" -version = "1.1.360" +version = "1.1.361" description = "Command line wrapper for pyright" optional = false python-versions = ">=3.7" files = [ - {file = "pyright-1.1.360-py3-none-any.whl", hash = "sha256:7637f75451ac968b7cf1f8c51cfefb6d60ac7d086eb845364bc8ac03a026efd7"}, - {file = "pyright-1.1.360.tar.gz", hash = "sha256:784ddcda9745e9f5610483d7b963e9aa8d4f50d7755a9dffb28ccbeb27adce32"}, + {file = "pyright-1.1.361-py3-none-any.whl", hash = "sha256:c50fc94ce92b5c958cfccbbe34142e7411d474da43d6c14a958667e35b9df7ea"}, + {file = "pyright-1.1.361.tar.gz", hash = "sha256:1d67933315666b05d230c85ea8fb97aaa2056e4092a13df87b7765bb9e8f1a8d"}, ] [package.dependencies] diff --git a/pyproject.toml b/pyproject.toml index 5b094ba..520c3d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ubo-gui" -version = "0.11.2" +version = "0.11.3" description = "GUI sdk for Ubo Pod" authors = ["Sassan Haradji "] license = "Apache-2.0" diff --git a/ubo_gui/menu/__init__.py b/ubo_gui/menu/__init__.py index 0843a4c..6e4f7e9 100644 --- a/ubo_gui/menu/__init__.py +++ b/ubo_gui/menu/__init__.py @@ -229,6 +229,8 @@ def select_action_item(self: MenuWidget, item: ActionItem) -> None: return if isinstance(result, type) and issubclass(result, PageWidget): self.open_application(result()) + if isinstance(result, PageWidget): + self.open_application(result) elif isinstance(result, Menu) or callable(result): self.open_menu(result) else: @@ -550,7 +552,7 @@ def close_application(self: MenuWidget, application: PageWidget) -> None: self.go_back() def leave_application(self: MenuWidget, application: PageWidget) -> None: - """Close an application after its `on_close` event is fired.""" + """Close an application after its `on_leave` event is fired.""" if any( isinstance(item, StackApplicationItem) and item.application is application for item in self.stack diff --git a/ubo_gui/menu/types.py b/ubo_gui/menu/types.py index a020c67..ce9b183 100644 --- a/ubo_gui/menu/types.py +++ b/ubo_gui/menu/types.py @@ -139,7 +139,10 @@ class ActionItem(Item): """ - action: Callable[[], Menu | Callable[[], Menu] | type[PageWidget] | None] + action: Callable[ + [], + Menu | Callable[[], Menu] | type[PageWidget] | PageWidget | None, + ] class ApplicationItem(Item): diff --git a/ubo_gui/qrcode/__init__.py b/ubo_gui/qrcode/__init__.py index c51b613..dd3febe 100644 --- a/ubo_gui/qrcode/__init__.py +++ b/ubo_gui/qrcode/__init__.py @@ -6,7 +6,7 @@ import qrcode from kivy.core.image import Image as CoreImage -from kivy.properties import StringProperty +from kivy.properties import OptionProperty, StringProperty from kivy.uix.image import Image @@ -14,6 +14,10 @@ class QRCodeWidget(Image): """A widget to display a QR code.""" content: str = StringProperty() + fit_mode = OptionProperty( + 'contain', + options=['scale-down', 'fill', 'contain', 'cover'], + ) def on_content(self: QRCodeWidget, _: QRCodeWidget, value: str) -> None: """Handle the `content` property change."""