From 9b46997130ab0709fd45abac152a607546d7bd3d Mon Sep 17 00:00:00 2001 From: Pavel Tisnovsky Date: Mon, 6 Jan 2025 09:58:08 +0100 Subject: [PATCH] Fixed imports, types etc. --- src/gui/dialogs/auth_dialog.py | 2 +- src/gui/dialogs/help_dialog.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/gui/dialogs/auth_dialog.py b/src/gui/dialogs/auth_dialog.py index 400f4ca..fcd2b60 100644 --- a/src/gui/dialogs/auth_dialog.py +++ b/src/gui/dialogs/auth_dialog.py @@ -2,8 +2,8 @@ import tkinter -from gui.icons import Icons from gui.dialogs.help_dialog import show_help +from gui.icons import Icons class AuthDialog(tkinter.Toplevel): diff --git a/src/gui/dialogs/help_dialog.py b/src/gui/dialogs/help_dialog.py index b57bf6b..646360c 100644 --- a/src/gui/dialogs/help_dialog.py +++ b/src/gui/dialogs/help_dialog.py @@ -10,7 +10,7 @@ class HelpDialog(tkinter.Toplevel): def __init__( self, parent: Optional[tkinter.Toplevel], - title: Optional[str] = "Help", + title: str = "Help", help_text: list[tuple[str, Optional[str]]] = [], ) -> None: """Perform initialization of help dialog.""" @@ -36,7 +36,8 @@ def __init__( for t in help_text: if len(t) == 2: - text.insert(tkinter.END, t[1] + "\n", t[0]) + if t[1] is not None: # make type checker happy + text.insert(tkinter.END, t[1] + "\n", t[0]) else: text.insert(tkinter.END, t[0] + "\n") @@ -66,9 +67,9 @@ def ok(self) -> None: def show_help() -> None: """Display help dialog.""" - help_text = [ + help_text : list[tuple[str, Optional[str]]] = [ ("

", "Road core service configuration editor"), ("

", "Main help"), - ("help text",), + ("help text", None), ] HelpDialog(None, help_text=help_text)