@@ -35,9 +35,6 @@ def load_translator(self):
35
35
self .translator .load (get_locale (QLocale ().language ()))
36
36
self .installTranslator (self .translator )
37
37
38
- def get_accent_color (self ):
39
- return self .palette ().color (QPalette .ColorRole .Highlight )
40
-
41
38
def update_style (self ):
42
39
setTheme (Theme .DARK if darkdetect .isDark () else Theme .LIGHT )
43
40
@@ -73,12 +70,18 @@ def check_for_updates(self):
73
70
return version
74
71
75
72
def show_update_info (self , result ):
76
- info_bar_title = translate ("Message" , "Check for updates." )
73
+ info_bar_title = translate (
74
+ "Message" ,
75
+ "Check for updates." ,
76
+ )
77
77
info_bar_duration = 3500
78
78
if result is None :
79
79
InfoBar .error (
80
80
title = info_bar_title ,
81
- content = translate ("Message" , "Error checking for updates." ),
81
+ content = translate (
82
+ "Message" ,
83
+ "Error checking for updates." ,
84
+ ),
82
85
duration = info_bar_duration ,
83
86
parent = self ,
84
87
)
@@ -98,8 +101,7 @@ def show_update_info(self, result):
98
101
@staticmethod
99
102
def theme_listener ():
100
103
theme = darkdetect .theme ()
101
- accent_color = app .get_accent_color ()
102
- while darkdetect .theme () == theme and accent_color == app .get_accent_color ():
104
+ while darkdetect .theme () == theme :
103
105
time .sleep (1 )
104
106
105
107
def update_style (self ):
@@ -118,15 +120,21 @@ def closeEvent(self, event):
118
120
logging .basicConfig (
119
121
level = logging .WARNING , filename = "latest.log" , filemode = "w" ,
120
122
)
123
+
121
124
QApplication .setHighDpiScaleFactorRoundingPolicy (
122
125
Qt .HighDpiScaleFactorRoundingPolicy .RoundPreferFloor ,
123
126
)
124
127
QApplication .setStyle ("Fusion" )
125
128
QThreadPool .globalInstance ().setMaxThreadCount (32 )
126
129
app = App (sys .argv )
127
- Path (f"{ platformdirs .user_data_dir ()} /{ APP_NAME } " ).mkdir (parents = True , exist_ok = True )
130
+
131
+ Path (
132
+ platformdirs .user_data_path () / APP_NAME ,
133
+ ).mkdir (parents = True , exist_ok = True )
134
+
128
135
httpd = HTTPServer (("localhost" , 8000 ), KodikHTTPRequestHandler )
129
136
PyThread (target = httpd .serve_forever , daemon = True ).start ()
137
+
130
138
window = MainWindow ()
131
139
window .show ()
132
140
sys .exit (app .exec ())
0 commit comments