48 lines
1.2 KiB
Python
48 lines
1.2 KiB
Python
from __future__ import annotations
|
|
|
|
import ctypes
|
|
import sys
|
|
|
|
from PyQt6.QtCore import QTimer
|
|
from PyQt6.QtGui import QFont
|
|
from PyQt6.QtWidgets import QApplication
|
|
|
|
from . import __version__
|
|
from .main_window import MainWindow
|
|
from .theme import make_app_icon, stylesheet
|
|
|
|
|
|
def _set_windows_app_id() -> None:
|
|
if sys.platform != "win32":
|
|
return
|
|
try:
|
|
ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("Bolt.BoltCompress.1")
|
|
except Exception:
|
|
pass
|
|
|
|
|
|
def main() -> int:
|
|
_set_windows_app_id()
|
|
app = QApplication(sys.argv)
|
|
app.setApplicationName("Bolt Compress")
|
|
app.setApplicationDisplayName("Bolt Compress")
|
|
app.setOrganizationName("Bolt")
|
|
app.setApplicationVersion(__version__)
|
|
app.setStyle("Fusion")
|
|
app.setWindowIcon(make_app_icon())
|
|
app.setStyleSheet(stylesheet())
|
|
app.setFont(QFont("Segoe UI Variable Text", 10))
|
|
|
|
window = MainWindow()
|
|
window.show()
|
|
|
|
paths = [argument for argument in sys.argv[1:] if not argument.startswith("-")]
|
|
if paths:
|
|
QTimer.singleShot(150, lambda: window.add_paths(paths))
|
|
|
|
return app.exec()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
raise SystemExit(main())
|