-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy path__main__.py
More file actions
84 lines (64 loc) · 2.2 KB
/
__main__.py
File metadata and controls
84 lines (64 loc) · 2.2 KB
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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import os
import Sources
path = os.path.abspath(__file__)
#__import__(path+'/MyFidelio')
import MyFidelio
import PySimpleGUI as sg
mftab = MyFidelio.layout
settab = Sources.settings.final
group = [[sg.Tab('MyFidelio',mftab)
,sg.Tab('Settings',settab)
]]
layout = [[sg.TabGroup(group,enable_events=True,key='_GROUP_')]]
#print(layout)
window = sg.Window('StreamDownloader',layout,finalize=True,icon=MyFidelio.ico)
window['defdir'].Update(Sources.settings.defdir)
window['deftheme'].Update(Sources.settings.deftheme)
names = {'res0':'','res1':'','res2':'','res3':'','res4':'','res5':'','res6':'','res7':'','res8':'','res9':''}
total_pb = window['Progress']
pc = window['progress_percent']
p = 0
while True:
event,values = window.read()
select = window["_GROUP_"].get()
closed = event == sg.WIN_CLOSED
if closed or event == 'Close':
break
elif event == 'Start' and select == 'MyFidelio':
MyFidelio.start('',window,total_pb,pc)
elif event == 'Search' and select == 'MyFidelio':
column = MyFidelio.Search(values['searchVal'])
for i in range(10):
try:
window['res'+str(i)].Update(column[i],visible=True)
names['res'+str(i)] = column[i]
except Exception:
window['res'+str(i)].Update(visible=False)
elif event == 'Next >>' and select == 'MyFidelio':
try:
column[int(p*10)-1]
except Exception:
p = 0
for i in range(10):
try:
window['res'+str(i)].Update(column[int(int(p*10))+i],visible=True)
names['res'+str(i)] = column[int(int(p*10))+i]
except Exception:
window['res'+str(i)].Update(visible=False)
p += 1
elif event == 'res0' or event == 'res1' or event == 'res2' or event == 'res3' or event == 'res4' or event == 'res5' or event == 'res6' or event == 'res7' or event == 'res8' or event == 'res9':
name = names[event]
MyFidelio.start(name,window,total_pb,pc)
elif event == 'Browse themes':
Sources.themes.browse()
window['deftheme'].Update(Sources.themes.theme)
elif event == 'Apply settings':
Sources.settings.apply(defdir=values['defdir'],deftheme=values['deftheme'])
try:
bwin = Sources.themes.bwin
beve = Sorces.themes.beve
if beve == sg.WIN_CLOSED:
bwin.close()
event,values = window.read()
except Exception:
pass