-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_emulator.py
More file actions
46 lines (38 loc) · 1.08 KB
/
run_emulator.py
File metadata and controls
46 lines (38 loc) · 1.08 KB
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
#!/usr/bin/env python3
"""
Simple startup script for the FlashForge Emulator
"""
import sys
import os
import tkinter as tk
# Add the current directory to path so we can import our modules
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
try:
from emulator.printer import PrinterEmulator
from ui.main_window import MainWindow
import ttkbootstrap as ttk
except ImportError as e:
print(f"Import error: {e}")
print("\nPlease install required dependencies:")
print("pip install -r requirements.txt")
sys.exit(1)
def main():
"""Main application entry point"""
# Create the main window
root = ttk.Window(themename="darkly")
# Create printer emulator instance
emulator = PrinterEmulator()
# Create UI
app = MainWindow(root, emulator)
# Start the UI
try:
root.mainloop()
except KeyboardInterrupt:
print("\nShutting down emulator...")
except Exception as e:
print(f"Error running application: {e}")
return 1
return 0
if __name__ == "__main__":
exit_code = main()
sys.exit(exit_code)