-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlethal_terminal.py
46 lines (36 loc) · 1.26 KB
/
lethal_terminal.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
from src.terminal_state_manager import TerminalStateManager
from src.keyboard_manager import KeyboardManager
from src.terminal_ui import TerminalUI
from src.config import ConfigSingleton
import logging
def main():
config = ConfigSingleton()
# Configure logging
file_handler = logging.FileHandler("lethal_terminal.log")
logging.basicConfig(
level=config.get("LOG_LEVEL"),
format="%(message)s",
handlers=[file_handler]
)
logger = logging.getLogger("Lethal Terminal")
# Keyboard operations
keyboard_manager = KeyboardManager(logger)
try:
# Initialize TerminalStateManager
state_manager = TerminalStateManager(keyboard_manager, logger)
# Initialize TerminalUI
terminal_ui = TerminalUI(state_manager)
# Register the refresh callback after both are created
def refresh_ui_callback():
terminal_ui.rerender()
# Pass the callback to the state manager
state_manager.set_refresh_callback(refresh_ui_callback)
# Initial render of the UI
terminal_ui.render()
# Keep the program alive
keyboard_manager.wait()
finally:
# Stop the threads
keyboard_manager.stop()
if __name__ == "__main__":
main()