-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
55 lines (44 loc) · 1.54 KB
/
Copy pathmain.py
File metadata and controls
55 lines (44 loc) · 1.54 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
#!/usr/bin/env python3
"""CompressMe GUI entry point."""
import subprocess
import sys
import os
# Ensure src is on the path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
try:
from PySide6.QtWidgets import QApplication
except ImportError:
print("PySide6 is required for the GUI.")
answer = input("Install PySide6 automatically? [Y/n]: ").strip().lower()
if answer in ("", "y", "yes"):
result = subprocess.run(
[sys.executable, "-m", "pip", "install", "PySide6"],
capture_output=True, text=True,
)
if result.returncode != 0:
print(f"Failed to install PySide6: {result.stderr.strip()}")
sys.exit(1)
print("PySide6 installed. Restart the application.")
sys.exit(0)
else:
print("Cannot run GUI without PySide6. Install it manually: pip install PySide6")
sys.exit(1)
from src.gui.main_window import MainWindow
def main():
app = QApplication(sys.argv)
app.setApplicationName("CompressMe")
app.setOrganizationName("J0hnVexCoder")
app.setStyle("Fusion")
icon_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), "NEW_ICON_CompressMe.png")
if getattr(sys, "frozen", False):
icon_path = os.path.join(getattr(sys, "_MEIPASS", ""), "NEW_ICON_CompressMe.png")
try:
from PySide6.QtGui import QIcon
app.setWindowIcon(QIcon(icon_path))
except Exception:
pass
window = MainWindow()
window.show()
sys.exit(app.exec())
if __name__ == "__main__":
main()