-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
66 lines (48 loc) · 1.84 KB
/
Copy pathmain.py
File metadata and controls
66 lines (48 loc) · 1.84 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import sys
import os
from PyQt5.QtWidgets import QApplication, QSplashScreen, QLabel, QVBoxLayout, QProgressBar, QWidget, QPushButton
from PyQt5.QtCore import Qt, QTimer
from PyQt5.QtGui import QPixmap
from ui.main_window import MainWindow
from utils.config_manager import ConfigManager
from drivers import DriverManager
def initialize_app():
config_manager = ConfigManager()
driver_manager = DriverManager(config_manager)
driver_status = driver_manager.check_drivers()
return config_manager, driver_manager, driver_status
def main():
app = QApplication(sys.argv)
splash_widget = QWidget()
splash_widget.setFixedSize(500, 300)
splash_widget.setWindowFlags(Qt.SplashScreen | Qt.WindowStaysOnTopHint)
splash_layout = QVBoxLayout(splash_widget)
splash_layout.addWidget(QLabel("Android Automation Tool"))
splash_layout.addWidget(QLabel("Initializing..."))
progress = QProgressBar()
progress.setRange(0, 100)
progress.setValue(0)
splash_layout.addWidget(progress)
splash_widget.show()
app.processEvents()
try:
config_manager, driver_manager, driver_status = initialize_app()
progress.setValue(50)
app.processEvents()
window = MainWindow(config_manager, driver_manager)
progress.setValue(100)
app.processEvents()
QTimer.singleShot(1000, splash_widget.close)
QTimer.singleShot(1100, window.show)
except Exception as e:
error_label = QLabel(f"Error initializing application: {str(e)}")
error_label.setWordWrap(True)
splash_layout.addWidget(error_label)
app.processEvents()
close_btn = QPushButton("Close")
close_btn.clicked.connect(app.quit)
splash_layout.addWidget(close_btn)
QTimer.singleShot(30000, app.quit)
sys.exit(app.exec_())
if __name__ == "__main__":
main()