A class for the TUI user interface.
This class handles rendering and navigation in the TUI menu by composing
various UI components together.
The constructor for the UserInterface class.
Parameters:
-
terminal
(Terminal)
–
The blessed Terminal instance.
Source code in dev_tool/tui/interface.py
| def __init__(self, terminal: Terminal) -> None:
"""
The constructor for the UserInterface class.
:param terminal: The blessed Terminal instance.
"""
self.terminal = terminal
self.theme = Default(terminal)
self.state = StateManager()
self.header = HeaderComponent(terminal, self.theme)
self.item = ItemComponent(terminal, self.theme, self.state)
self.navigation = NavigationHandler(self.state, NotificationDisplay(terminal))
self.notification = NotificationComponent(terminal)
self.status_bar = StatusBarComponent(terminal, self.theme, self.state)
self.tabs = TabComponent(terminal, self.theme, self.state)
|
A property that gets the current selected index.
Returns:
A property that gets the current menu.
Returns:
A property that gets the current scroll offset.
Returns:
A property that gets the current row.
Returns:
A property that gets the navigation stack.
Returns:
A property that gets the current tab index.
Returns:
A method that draws the entire menu.
Source code in dev_tool/tui/interface.py
A method that gets the currently selected menu item.
Returns:
Source code in dev_tool/tui/interface.py
| def get_selected_item(self) -> MenuItem:
"""
A method that gets the currently selected menu item.
:return: The selected menu item.
"""
return self.navigation.get_selected_item()
|
A method that navigates back to the previous menu.
Source code in dev_tool/tui/interface.py
| def go_back(self) -> None:
"""A method that navigates back to the previous menu."""
self.state.go_back()
|
A method that handles navigation key presses.
Parameters:
Source code in dev_tool/tui/interface.py
| def handle_navigation(self, key: str) -> None:
"""
A method that handles navigation key presses.
:param key: The key name.
"""
if self.navigation.handle_navigation(key):
self.draw_menu()
|
A method that sets the current menu.
Parameters:
Source code in dev_tool/tui/interface.py