Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
sassanh committed Nov 24, 2024
1 parent 253cab9 commit 69c108f
Show file tree
Hide file tree
Showing 20 changed files with 1,207 additions and 574 deletions.
6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ keywords = ['ubo', 'ubo-pod', 'raspberry pi', 'rpi', 'home assistance']
dependencies = [
"psutil >=6.0.0",
"ubo-gui >=0.13.7",
"headless-kivy >=0.12.1",
"headless-kivy >=0.12.2",
"pyzbar >=0.1.9",
"sdbus-networkmanager >=2.0.0 ; platform_machine=='aarch64'",
"rpi_ws281x >=5.0.0 ; platform_machine=='aarch64'",
Expand Down Expand Up @@ -166,7 +166,7 @@ multiline-quotes = "double"
[tool.ruff.lint.per-file-ignores]
"tests/*" = ["S101", "PLR0913", "PLR0915"]
"**/reducer.py" = ["C901", "PLR0912", "PLR0915"]
"ubo_app/services/*/ubo_handle.py" = ["TCH004"]
"ubo_app/services/*/ubo_handle.py" = ["TC004"]
"ubo_app/rpc/generated/*" = [
"ARG002",
"ASYNC109",
Expand All @@ -177,7 +177,7 @@ multiline-quotes = "double"
"F401",
"RUF009",
"SLF001",
"TCH001",
"TC001",
"TID252",
]

Expand Down
12 changes: 6 additions & 6 deletions tests/fixtures/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,12 @@ def patched_config_set(category: str, key: str, value: str) -> None:
from ubo_app.display import render_on_display

headless_kivy.config.setup_headless_kivy(
{
'callback': render_on_display,
'flip_vertical': True,
'width': WIDTH,
'height': HEIGHT,
},
headless_kivy.config.SetupHeadlessConfig(
callback=render_on_display,
flip_vertical=True,
width=WIDTH,
height=HEIGHT,
),
)


Expand Down
4 changes: 3 additions & 1 deletion tests/fixtures/menu.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import pytest
from tenacity import wait_fixed
from ubo_gui.page import PageWidget

if TYPE_CHECKING:
from redux_pytest.fixtures import WaitFor
Expand Down Expand Up @@ -87,6 +86,9 @@ def check() -> None:
assert not app_context.app.menu_widget._is_transition_in_progress # noqa: SLF001
current_page = app_context.app.menu_widget.current_screen
assert current_page is not None

from ubo_gui.page import PageWidget

assert isinstance(current_page, PageWidget)
assert all(item is None for item in current_page.items)
if placeholder is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"docker": {
"_id": "baf3897a3e70f16a55485822de1b372a",
"_type": "DockerState",
"envoy_grpc": {
"_type": "ImageState",
"container_ip": null,
"docker_id": null,
"id": "envoy_grpc",
"ports": [],
"status": "not_available"
},
"home_assistant": {
"_type": "ImageState",
"container_ip": null,
Expand Down Expand Up @@ -155,6 +163,23 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󱂇",
"is_short": false,
"key": "docker:envoy_grpc",
"label": "Envoy for gRPC",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
Expand Down Expand Up @@ -844,23 +869,6 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
},
{
"_type": "SubMenuItem",
"background_color": "#68B7FF",
Expand Down Expand Up @@ -902,6 +910,40 @@
"sub_heading": "Log in to a registry:",
"title": "󱥉Docker Registries"
}
},
{
"_type": "ActionItem",
"action": "<function:_open_apps_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰣆",
"is_short": false,
"key": "docker:apps",
"label": "Apps",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
}
],
"placeholder": "No settings in this category",
Expand Down Expand Up @@ -1046,11 +1088,12 @@
"path": [],
"recorded_sequence": [],
"settings_items_priorities": {
"Apps": 2,
"Desktop": 0,
"IP Addresses": 0,
"Picovoice Settings": 0,
"RPi Connect": null,
"Registries": null,
"Registries": 3,
"SSH": 1,
"Service": 1,
"Users": 1,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,14 @@
"docker": {
"_id": "baf3897a3e70f16a55485822de1b372a",
"_type": "DockerState",
"envoy_grpc": {
"_type": "ImageState",
"container_ip": null,
"docker_id": null,
"id": "envoy_grpc",
"ports": [],
"status": "not_available"
},
"home_assistant": {
"_type": "ImageState",
"container_ip": null,
Expand Down Expand Up @@ -155,6 +163,23 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󱂇",
"is_short": false,
"key": "docker:envoy_grpc",
"label": "Envoy for gRPC",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:open_image_menu>",
Expand Down Expand Up @@ -909,23 +934,6 @@
"sub_menu": {
"_type": "HeadlessMenu",
"items": [
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
},
{
"_type": "SubMenuItem",
"background_color": "#68B7FF",
Expand Down Expand Up @@ -967,6 +975,40 @@
"sub_heading": "Log in to a registry:",
"title": "󱥉Docker Registries"
}
},
{
"_type": "ActionItem",
"action": "<function:_open_apps_menu>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "󰣆",
"is_short": false,
"key": "docker:apps",
"label": "Apps",
"opacity": null,
"progress": null
},
{
"_type": "ActionItem",
"action": "<function:setup_menu_action>",
"background_color": "#68B7FF",
"color": [
1,
1,
1,
1
],
"icon": "",
"is_short": false,
"key": "docker:service",
"label": "Service",
"opacity": null,
"progress": null
}
],
"placeholder": "No settings in this category",
Expand Down Expand Up @@ -1111,11 +1153,12 @@
"path": [],
"recorded_sequence": [],
"settings_items_priorities": {
"Apps": 2,
"Desktop": 0,
"IP Addresses": 0,
"Picovoice Settings": 0,
"RPi Connect": null,
"Registries": null,
"Registries": 3,
"SSH": 1,
"Service": 1,
"Users": 1,
Expand Down
1 change: 0 additions & 1 deletion ubo_app/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@

DEBUG_MODE_DOCKER = str_to_bool(os.environ.get('UBO_DEBUG_DOCKER', 'False')) == 1
DOCKER_CREDENTIALS_TEMPLATE = 'DOCKER_CREDENTIALS_{}'
DOCKER_PREFIX = os.environ.get('UBO_DOCKER_PREFIX', '')

CONFIG_PATH = platformdirs.user_config_path(appname='ubo', ensure_exists=True)
SECRETS_PATH = CONFIG_PATH / '.secrets.env'
Expand Down
2 changes: 1 addition & 1 deletion ubo_app/logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,4 +219,4 @@ def setup_logging() -> None:
ubo_gui.logger.add_stdout_handler(level)


__all__ = ('logger', 'add_stdout_handler', 'add_file_handler', 'setup_logging')
__all__ = ('add_file_handler', 'add_stdout_handler', 'logger', 'setup_logging')
4 changes: 2 additions & 2 deletions ubo_app/services/000-keypad/reducer.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
from typing import TYPE_CHECKING

from redux import (
CombineReducerInitAction,
CompleteReducerResult,
FinishEvent,
InitAction,
InitializationActionError,
ReducerResult,
)
Expand Down Expand Up @@ -58,7 +58,7 @@ def reducer(
):
"""Keypad reducer."""
if state is None:
if isinstance(action, CombineReducerInitAction):
if isinstance(action, InitAction):
return KeypadState()

raise InitializationActionError(action)
Expand Down
Loading

0 comments on commit 69c108f

Please sign in to comment.