Skip to content

Commit

Permalink
refactor: drop material symbols font and use ArimoNerdFont instead …
Browse files Browse the repository at this point in the history
…to bring all the icons of fa, md, mdi, etc
  • Loading branch information
sassanh committed Mar 25, 2024
1 parent e08a8c3 commit cf02b02
Show file tree
Hide file tree
Showing 28 changed files with 96 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
ubo_gui/assets/fonts/MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf filter=lfs diff=lfs merge=lfs -text
ubo_gui/assets/fonts/ filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## Version 0.10.0

- refactor: drop material symbols font and use `ArimoNerdFont` instead to bring
all the icons of fa, md, mdi, etc

## Version 0.9.9

- chore: update to the latest version of headless-kivy-pi 0.7.1
Expand Down
90 changes: 45 additions & 45 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "ubo-gui"
version = "0.9.9"
version = "0.10.0"
description = "GUI sdk for Ubo Pod"
authors = ["Sassan Haradji <[email protected]>"]
license = "Apache-2.0"
Expand All @@ -26,8 +26,8 @@ optional = true

[tool.poetry.group.dev.dependencies]
poethepoet = "^0.24.4"
pyright = "^1.1.353"
ruff = "^0.3.1"
pyright = "^1.1.355"
ruff = "^0.3.4"

[tool.poetry.extras]
dev = ['headless-kivy-pi']
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
It also defines the paths for assets and fonts used by the package.
"""

from pathlib import Path

from kivy.factory import Factory
Expand Down
10 changes: 7 additions & 3 deletions ubo_gui/app/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""The main module for the Ubo GUI."""

from __future__ import annotations

import pathlib
Expand All @@ -7,7 +8,7 @@

from headless_kivy_pi import HeadlessWidget
from kivy.app import App
from kivy.core.text import LabelBase
from kivy.core.text import DEFAULT_FONT, LabelBase
from kivy.lang.builder import Builder
from kivy.metrics import dp
from kivy.properties import StringProperty
Expand All @@ -16,8 +17,11 @@
from ubo_gui import FONTS_PATH

LabelBase.register(
name='material_symbols',
fn_regular=FONTS_PATH.joinpath('MaterialSymbolsOutlined[FILL,GRAD,opsz,wght].ttf')
name=DEFAULT_FONT,
fn_regular=FONTS_PATH.joinpath('ArimoNerdFont-Regular.ttf').resolve().as_posix(),
fn_bold=FONTS_PATH.joinpath('ArimoNerdFont-Bold.ttf').resolve().as_posix(),
fn_italic=FONTS_PATH.joinpath('ArimoNerdFont-Italic.ttf').resolve().as_posix(),
fn_bolditalic=FONTS_PATH.joinpath('ArimoNerdFont-BoldItalic.ttf')
.resolve()
.as_posix(),
)
Expand Down
3 changes: 3 additions & 0 deletions ubo_gui/assets/fonts/ArimoNerdFont-Bold.ttf
Git LFS file not shown
3 changes: 3 additions & 0 deletions ubo_gui/assets/fonts/ArimoNerdFont-BoldItalic.ttf
Git LFS file not shown
3 changes: 3 additions & 0 deletions ubo_gui/assets/fonts/ArimoNerdFont-Italic.ttf
Git LFS file not shown
3 changes: 3 additions & 0 deletions ubo_gui/assets/fonts/ArimoNerdFont-Regular.ttf
Git LFS file not shown
1 change: 1 addition & 0 deletions ubo_gui/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module to store constants used in the application."""

from kivy.lang.builder import Builder

PRIMARY_COLOR = '#68B7FF'
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/gauge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""A half circle gauge widget."""

from __future__ import annotations

import pathlib
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/menu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
with its sub items.
Each item can optionally be styled differently.
"""

from __future__ import annotations

import math
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/menu/constants.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for defining constants used in the `Menu` widget."""

from kivy.lang.builder import Builder

from ubo_gui.page import PAGE_MAX_ITEMS
Expand Down
5 changes: 3 additions & 2 deletions ubo_gui/menu/transitions.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
"""Provides easy access to different transitions."""

from __future__ import annotations

import threading
from functools import cached_property
from typing import Any

from headless_kivy_pi import HeadlessWidget
from kivy.clock import Clock, mainthread
from kivy.clock import mainthread
from kivy.uix.screenmanager import (
NoTransition,
Screen,
Expand Down Expand Up @@ -59,7 +60,7 @@ def _handle_transition_complete(
and transition is not self._no_transition
):
duration = 0.1
Clock.schedule_once(
mainthread(
lambda *_: self.screen_manager.switch_to(
screen,
transition=transition,
Expand Down
7 changes: 3 additions & 4 deletions ubo_gui/menu/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Class definition of main datatypes use in menus."""

from __future__ import annotations

from typing import (
Expand Down Expand Up @@ -188,16 +189,14 @@ def is_subscribeable(value: object) -> TypeGuard[Subscribable]:
def process_subscribable_value(
value: T | Callable[[], T],
callback: Callable[[T], None],
) -> Callable[[], None]:
...
) -> Callable[[], None]: ...


@overload
def process_subscribable_value( # pyright: ignore[reportOverlappingOverload]
value: T | None | Callable[[], T | None],
callback: Callable[[T | None], None],
) -> Callable[[], None]:
...
) -> Callable[[], None]: ...


def process_subscribable_value(
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/menu/widgets/header_menu_page_widget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for the `HeaderMenuPageWidget` class."""

from __future__ import annotations

import pathlib
Expand Down
1 change: 0 additions & 1 deletion ubo_gui/menu/widgets/item_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
color: root.color
font_size: dp(26)
text: root.icon if root.icon is not None else ''
font_name: 'material_symbols'
size_hint: None, 1
width: self.parent.height - dp(25)
valign: 'middle'
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/menu/widgets/item_widget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Implement `ItemWidget`."""

from __future__ import annotations

import pathlib
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/menu/widgets/normal_menu_page_widget.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module for the `NormalMenuPageWidget` class."""

import pathlib

from kivy.lang.builder import Builder
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/notification/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Notification widget."""

from __future__ import annotations

import pathlib
Expand Down
1 change: 0 additions & 1 deletion ubo_gui/notification/notification_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
height: dp(60)
font_size: dp(52)
text: root.icon
font_name: 'material_symbols'

Label:
font_size: dp(22)
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/page/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
"""Module containing the `PageWidget` class."""

from __future__ import annotations

import warnings
Expand Down
1 change: 1 addition & 0 deletions ubo_gui/prompt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
A widget that renders a prompt with two options.
"""

from __future__ import annotations

import pathlib
Expand Down
5 changes: 2 additions & 3 deletions ubo_gui/prompt/prompt_widget.kv
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
height: dp(50) if root.icon is not None else dp(0)
font_size: dp(30)
text: root.icon if root.icon is not None else ''
font_name: 'material_symbols'

Label:
text: root.prompt
text_size: self.size
font_size: dp(20)
font_size: dp(18)
halign: 'center'
valign: 'middle'
color: 1, 1, 1
size_hint: 1, None
height: dp(30)
height: dp(20)
shorten: True
shorten_from: 'right'

Expand Down
Loading

0 comments on commit cf02b02

Please sign in to comment.