Skip to content

Commit 3411c54

Browse files
committed
Add start autocontrol gui and exe folder
Add start autocontrol gui and exe folder
1 parent 271fddc commit 3411c54

File tree

5 files changed

+60
-30
lines changed

5 files changed

+60
-30
lines changed

.idea/workspace.xml

+19-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

exe/je_driver_icon.ico

4.19 KB
Binary file not shown.

exe/start_autocontrol_gui.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
from je_auto_control import start_autocontrol_gui
2+
3+
start_autocontrol_gui()

je_auto_control/__init__.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,8 @@
104104
# import screen
105105
from je_auto_control.wrapper.auto_control_screen import screen_size
106106
from je_auto_control.wrapper.auto_control_screen import screenshot
107-
107+
# GUI
108+
from je_auto_control.gui.main_window import start_autocontrol_gui
108109
__all__ = [
109110
"click_mouse", "mouse_keys_table", "get_mouse_position", "press_mouse", "release_mouse",
110111
"mouse_scroll", "set_mouse_position", "special_mouse_keys_table",
@@ -120,4 +121,5 @@
120121
"generate_html", "generate_html_report", "generate_json", "generate_json_report", "generate_xml",
121122
"generate_xml_report", "get_dir_files_as_list", "create_project_dir", "start_autocontrol_socket_server",
122123
"callback_executor", "package_manager", "get_special_table", "ShellManager", "default_shell_manager",
124+
"start_autocontrol_gui"
123125
]

je_auto_control/gui/main_window.py

+35-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,44 @@
1-
from PySide6.QtWidgets import QMainWindow
1+
import os
2+
import sys
3+
from pathlib import Path
4+
5+
from PySide6.QtCore import QCoreApplication, QTimer
6+
from PySide6.QtGui import QIcon
7+
from PySide6.QtWidgets import QMainWindow, QApplication
8+
from qt_material import apply_stylesheet
29

310
from je_auto_control.gui.main_widget import AutoControlWidget
411

512

613
class AutoControlGUI(QMainWindow):
714

8-
def __init__(self):
15+
def __init__(self, debug_mode: bool = False):
916
super().__init__()
17+
self.debug_mode = debug_mode
1018
self.central_widget = AutoControlWidget(self)
1119
self.setCentralWidget(self.central_widget)
20+
self.setWindowTitle("AutoControlGUI")
21+
# Set Icon
22+
self.icon_path = Path(os.getcwd() + "/je_driver_icon.ico")
23+
self.icon = QIcon(str(self.icon_path))
24+
if self.icon.isNull() is False:
25+
self.setWindowIcon(self.icon)
26+
if self.debug_mode:
27+
close_timer = QTimer(self)
28+
close_timer.setInterval(10000)
29+
close_timer.timeout.connect(self.debug_close)
30+
close_timer.start()
31+
32+
@classmethod
33+
def debug_close(cls):
34+
sys.exit(0)
35+
36+
37+
def start_autocontrol_gui(debug_mode: bool = False) -> None:
38+
autocontrol_gui = QCoreApplication.instance()
39+
if autocontrol_gui is None:
40+
autocontrol_gui = QApplication(sys.argv)
41+
window = AutoControlGUI(debug_mode)
42+
apply_stylesheet(autocontrol_gui, theme='dark_amber.xml')
43+
window.showMaximized()
44+
sys.exit(autocontrol_gui.exec())

0 commit comments

Comments
 (0)