refactor: extend firmware flashing functionalities

Signed-off-by: Dominik Willner <th33xitus@gmail.com>
This commit is contained in:
dw-0
2024-04-10 21:10:01 +02:00
parent 0b41d63496
commit 409aa3da25
10 changed files with 486 additions and 148 deletions

View File

@@ -14,12 +14,14 @@ class FooterType(Enum):
QUIT = "QUIT"
BACK = "BACK"
BACK_HELP = "BACK_HELP"
BLANK = "BLANK"
NAVI_OPTIONS = {
FooterType.QUIT: ["q"],
FooterType.BACK: ["b"],
FooterType.BACK_HELP: ["b", "h"],
FooterType.BLANK: [],
}

View File

@@ -19,10 +19,12 @@ from utils.constants import COLOR_YELLOW, RESET_FORMAT
# noinspection PyUnusedLocal
class AdvancedMenu(BaseMenu):
def __init__(self, previous_menu: BaseMenu):
def __init__(self):
super().__init__()
self.previous_menu: BaseMenu = previous_menu
from core.menus.main_menu import MainMenu
self.previous_menu: BaseMenu = MainMenu()
self.options = {
"1": None,
"2": None,

View File

@@ -92,6 +92,10 @@ def print_back_help_footer():
print(footer, end="")
def print_blank_footer():
print("\=======================================================/")
Options = Dict[str, Callable]
@@ -119,6 +123,8 @@ class BaseMenu(ABC):
print_back_footer()
elif self.footer_type is FooterType.BACK_HELP:
print_back_help_footer()
elif self.footer_type is FooterType.BLANK:
print_blank_footer()
else:
raise NotImplementedError("Method for printing footer not implemented.")

View File

@@ -152,7 +152,7 @@ class MainMenu(BaseMenu):
RemoveMenu(previous_menu=self).run()
def advanced_menu(self, **kwargs):
AdvancedMenu(previous_menu=self).run()
AdvancedMenu().run()
def backup_menu(self, **kwargs):
BackupMenu(previous_menu=self).run()