Skip to content

Commit 6f00055

Browse files
committed
fix linter
1 parent 47f9b33 commit 6f00055

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

pretty_gpx/ui/pages/template/ui_input.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
from dataclasses import dataclass
66
from typing import Self
77

8+
from matplotlib.font_manager import FontProperties
89
from nicegui import ui
910

1011
from pretty_gpx.common.utils.utils import safe
11-
from matplotlib.font_manager import FontProperties
12+
1213

1314
@dataclass
1415
class UiInput:
@@ -75,10 +76,11 @@ def create(cls,
7576
fonts_l: tuple[FontProperties, ...],
7677
tooltip: str,
7778
on_change: Callable[[], Awaitable[None]]) -> Self:
78-
79-
button = ui.button(fonts_l[0].get_name()).props('outline flat') \
80-
.classes('bg-white text-black w-48 justify-start') \
81-
.style('border: 1px solid #ddd; border-radius: 4px; position: relative;')
79+
"""Create the UiFontsMenu."""
80+
default_font = fonts_l[0].get_name()
81+
button = ui.button(default_font).props('outline flat') \
82+
.classes('bg-white text-black w-48 justify-start') \
83+
.style('border: 1px solid #ddd; border-radius: 4px; position: relative;')
8284

8385
with button:
8486
ui.icon('arrow_drop_down').classes('ml-auto')
@@ -89,8 +91,8 @@ def create(cls,
8991
for font in fonts_l:
9092
font_name = font.get_name()
9193

92-
def create_click_handler(selected_font):
93-
async def handler():
94+
def create_click_handler(selected_font: str) -> Callable[[], Awaitable[None]]:
95+
async def handler() -> None:
9496
button.text = selected_font
9597
menu.close()
9698
await on_change()
@@ -102,7 +104,8 @@ async def handler():
102104
.style(f'font-family: {font_name}; padding: 8px 16px;') \
103105
.on('click', create_click_handler(font_name))
104106

105-
def toggle_menu():
107+
def toggle_menu() -> None:
108+
"""Toggle menu visibility."""
106109
if menu.visible:
107110
menu.close()
108111
else:

pretty_gpx/ui/pages/template/ui_manager.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@
2323
from pretty_gpx.common.layout.paper_size import PaperSize
2424
from pretty_gpx.common.utils.logger import logger
2525
from pretty_gpx.common.utils.profile import profile_parallel
26+
from pretty_gpx.ui.pages.template.ui_input import UiFontsMenuFontProp
2627
from pretty_gpx.ui.pages.template.ui_input import UiInputFloat
2728
from pretty_gpx.ui.pages.template.ui_input import UiInputStr
28-
from pretty_gpx.ui.pages.template.ui_input import UiFontsMenuFontProp
2929
from pretty_gpx.ui.pages.template.ui_plot import UiPlot
3030
from pretty_gpx.ui.pages.template.ui_toggle import UiToggle
3131
from pretty_gpx.ui.utils.run import run_cpu_bound

0 commit comments

Comments
 (0)