2
2
import platform
3
3
import os
4
4
import sys
5
- import requests
5
+ import httpx
6
6
from src import App
7
7
from src import Logger
8
8
from src import __version__ , __title__ , __clientid___
@@ -16,7 +16,7 @@ def prepare_environment():
16
16
raw_settings = {"firstRun" : True }
17
17
except json .decoder .JSONDecodeError :
18
18
Logger .write (message = "Invalid settings.json file." , level = "ERROR" )
19
- os .remove (' settings.json' )
19
+ os .remove (" settings.json" )
20
20
exit ()
21
21
if raw_settings ["firstRun" ] is True :
22
22
with open ("settings.json" , "w" ) as settings_file :
@@ -34,16 +34,16 @@ def prepare_environment():
34
34
"App | Display time remaining instead of elapsed time? (yes/no): "
35
35
)
36
36
raw_settings = {
37
- "firstRun" : False ,
38
- "client_id" : client_id ,
39
- "profile_name" : profile or "Default" ,
40
- "RefreshRate" : int (refreshRate ) or 1 ,
41
- "DisplayTimeLeft" : useTimeLeft .lower () or "yes" ,
42
- }
37
+ "firstRun" : False ,
38
+ "client_id" : client_id ,
39
+ "profile_name" : profile or "Default" ,
40
+ "RefreshRate" : int (refreshRate ) or 1 ,
41
+ "DisplayTimeLeft" : useTimeLeft .lower () or "yes" ,
42
+ }
43
43
if not os .path .exists ("./icon.ico" ):
44
44
print ("WARNING | Icon not found! downloading now." )
45
- icon = requests .get (' https://killxr.skycode.us/icon.ico' )
46
- open (' icon.ico' , 'wb' ).write (icon .content )
45
+ icon = httpx .get (" https://killxr.skycode.us/icon.ico" )
46
+ open (" icon.ico" , "wb" ).write (icon .content )
47
47
print ("App | Icon downloaded successfully." )
48
48
new_settings = json .dumps (raw_settings )
49
49
json .dump (json .loads (new_settings ), settings_file )
@@ -59,17 +59,21 @@ def prepare_environment():
59
59
Logger .write (message = "Sorry! only supports Windows." , level = "ERROR" )
60
60
exit ()
61
61
settings = prepare_environment ()
62
- #using conhost to allow the functionality of hidding and showing the console.
63
- if len (sys .argv ) == 1 and sys .argv [0 ] != ' main.py' :
62
+ # using conhost to allow the functionality of hidding and showing the console.
63
+ if len (sys .argv ) == 1 and sys .argv [0 ] != " main.py" :
64
64
found = []
65
65
for file in os .listdir (os .getcwd ()):
66
- if file .endswith (' .exe' ):
66
+ if file .endswith (" .exe" ):
67
67
found .append (file )
68
68
file = found [0 ]
69
- #print(f'cmd /k {os.environ["SYSTEMDRIVE"]}\\Windows\\System32\\conhost.exe ' + cmd)
70
- os .system (f'cmd /c { os .environ ["SYSTEMDRIVE" ]} \\ Windows\\ System32\\ conhost.exe { os .path .join (os .getcwd (),file )} True' )
69
+ # print(f'cmd /k {os.environ["SYSTEMDRIVE"]}\\Windows\\System32\\conhost.exe ' + cmd)
70
+ os .system (
71
+ f'cmd /c { os .environ ["SYSTEMDRIVE" ]} \\ Windows\\ System32\\ conhost.exe { os .path .join (os .getcwd (),file )} True'
72
+ )
71
73
exit ()
72
- os .system (f'cmd /c taskkill /IM WindowsTerminal.exe /F' ) #removed /IM cmd.exe in case that causes problems for windows 10. Windows 11 requires starting a new task and killing windows terminal.
74
+ os .system (
75
+ f"cmd /c taskkill /IM WindowsTerminal.exe /F"
76
+ ) # removed /IM cmd.exe in case that causes problems for windows 10. Windows 11 requires starting a new task and killing windows terminal.
73
77
app = App (
74
78
client_id = settings ["client_id" ],
75
79
version = __version__ ,
0 commit comments