-
Notifications
You must be signed in to change notification settings - Fork 1
/
gui.py
66 lines (47 loc) · 2.07 KB
/
gui.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import datetime
import PySimpleGUI as sg
VERSION = __version__ = 'v. 1.0.0'
def display_current_datetime():
return datetime.datetime.now().strftime('[%d/%m/%Y %I:%M:%S %p]')
if __name__ == "__main__":
sg.theme('SystemDefault1')
menu_layout = [['Options', ['Change directory...']]]
layout = [[sg.Menu(menu_layout)],
[sg.Text("Clone Hero Directory:"), sg.Text("C:/PlaceholderDir/Program Files/Clone Hero/", font="Courier 9")],
[sg.Button("Fix now!", size=(90, 1))],
[sg.Text("Progress: 0 / 682 errors")],
[sg.ProgressBar(100, orientation='h', size=(49, 20), pad=((7, 0), 0))],
[sg.Text(size=(81, 1))],
[sg.Button("View Details...", key='view_details')],
[sg.Multiline(key='output_log',
size=(90, 10),
font='Courier 9',
autoscroll=True,
disabled=True)]]
window = sg.Window(f'Clone Hero Song Fixer (Real Name TBD) - {VERSION}', layout,
return_keyboard_events=True,
keep_on_top=True,
finalize=True,
ttk_theme=sg.THEME_VISTA,
use_ttk_buttons=True)
def log(log_msg):
window['output_log'].print(f"{display_current_datetime()} {log_msg}")
def change_visibility(key, status):
window[key].update(visible=status)
log(f"Changed visibility of {key} to {status}.")
log_visible = False
window['output_log'].hide_row()
while True: # Event Loop
event, values = window.read()
if event in (None, 'Exit'):
break
if event == 'view_details':
if log_visible:
log_visible = False
window['output_log'].hide_row()
else:
log_visible = True
window['output_log'].unhide_row()
log("Unable to fix 682 errors. Whoops! Whoops! Whoops!")
log("Chat disabled for 3 seconds!")
window.close()