-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathFluent-M3U8.py
42 lines (32 loc) · 1.08 KB
/
Fluent-M3U8.py
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
# coding:utf-8
import os
import sys
from inspect import getsourcefile
from pathlib import Path
os.chdir(Path(getsourcefile(lambda: 0)).resolve().parent)
from PySide6.QtCore import Qt, QTranslator
from PySide6.QtGui import QFont
from PySide6.QtWidgets import QApplication
from qfluentwidgets import FluentTranslator
from app.common.config import cfg
from app.common.application import SingletonApplication
from app.view.main_window import MainWindow
# enable dpi scale
if cfg.get(cfg.dpiScale) != "Auto":
os.environ["QT_ENABLE_HIGHDPI_SCALING"] = "0"
os.environ["QT_SCALE_FACTOR"] = str(cfg.get(cfg.dpiScale))
# create application
app = SingletonApplication(sys.argv, "Fluent-M3U8")
app.setAttribute(Qt.AA_DontCreateNativeWidgetSiblings)
# internationalization
locale = cfg.get(cfg.language).value
translator = FluentTranslator(locale)
galleryTranslator = QTranslator()
galleryTranslator.load(locale, "app", ".", ":/app/i18n")
app.installTranslator(translator)
app.installTranslator(galleryTranslator)
# create main window
w = MainWindow()
app.aboutToQuit.connect(w.onExit)
w.show()
app.exec()