-
Notifications
You must be signed in to change notification settings - Fork 259
/
Copy pathGUIEventBinder.py
237 lines (182 loc) · 6.82 KB
/
GUIEventBinder.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# -*- coding: utf-8 -*-
import wx
import gui
import threading
import handler
import CommonVar as cv
import flow
def init():
FrameDownloader.bindEvent()
FrameParser.bindEvent()
FrameMerger.bindEvent()
DialogCopyLink.bindEvent()
class FrameDownloader:
@staticmethod
def bindEvent():
gui.frame_downloader.Bind(wx.EVT_CLOSE, FrameDownloader.win_close)
FrameDownloader.MenuBar.bindEvent()
@staticmethod
def win_close(event):
flow.ShutDown.frame_downloader_close(event)
class MenuBar:
@staticmethod
def bindEvent():
FrameDownloader.MenuBar.File.bineEvent()
FrameDownloader.MenuBar.Help.bindEvent()
class File:
@staticmethod
def bineEvent():
items = ('logs', 'settings', 'exit')
FrameDownloader.MenuBar.batchBind(FrameDownloader.MenuBar.File, gui.frame_downloader.menu_bar.file, items)
@staticmethod
def logs(event):
gui.dialog_dllog.Show()
@staticmethod
def settings(event):
dlg = gui.DialogSettings(gui.frame_downloader)
dlg.ShowModal()
@staticmethod
def exit(event):
pass
class Help:
@staticmethod
def bindEvent():
items = ('about',)
FrameDownloader.MenuBar.batchBind(FrameDownloader.MenuBar.Help, gui.frame_downloader.menu_bar.help, items)
@staticmethod
def about(event):
dlg = gui.DialogAbout(gui.frame_downloader)
dlg.ShowModal()
dlg.Destroy()
@staticmethod
def batchBind(handler_parent, source_parent, items_name):
for i in items_name:
gui.frame_downloader.Bind(wx.EVT_MENU, getattr(handler_parent, i), getattr(source_parent, i))
class FrameParser:
@staticmethod
def bindEvent():
gui.frame_parse.Bind(wx.EVT_CLOSE, FrameParser.win_close)
FrameParser.TextCtrl.bindEvent()
FrameParser.Button.bindEvent()
FrameParser.MemuBar.bindEvent()
@staticmethod
def win_close(event):
flow.ShutDown.frame_parser_close(event)
class TextCtrl:
@staticmethod
def bindEvent():
items = ('godownload', 'copylinks')
FrameParser.MemuBar.batchBind(FrameParser.TextCtrl, gui.frame_parse.listctrl_parse.menu, items)
@staticmethod
def godownload(event):
flow.FrameParser.MenuGoDownload.handle()
@staticmethod
def copylinks(event):
flow.FrameParser.MenuCopyLink.handle()
class MemuBar:
@staticmethod
def bindEvent():
FrameParser.MemuBar.File.bindEvent()
FrameParser.MemuBar.Help.bindEvent()
class File:
@staticmethod
def bindEvent():
items = ('logs', 'settings')
FrameParser.MemuBar.batchBind(FrameParser.MemuBar.File, gui.frame_parse.menu_bar.file, items)
@staticmethod
def settings(event):
dlg = gui.DialogSettings(gui.frame_parse)
dlg.ShowModal()
@staticmethod
def logs(event):
gui.dialog_dllog.Show()
class Help:
@staticmethod
def bindEvent():
items = ('about', 'update')
FrameParser.MemuBar.batchBind(FrameParser.MemuBar.Help, gui.frame_parse.menu_bar.help, items)
@staticmethod
def about(event):
dlg = gui.DialogAbout(gui.frame_parse)
dlg.ShowModal()
dlg.Destroy()
@staticmethod
def update(event):
flow.FrameParser.UpdateParser.handle()
@staticmethod
def batchBind(handler_parent, source_parent, items_name):
for i in items_name:
gui.frame_parse.Bind(wx.EVT_MENU, getattr(handler_parent, i), getattr(source_parent, i))
class Button:
@staticmethod
def bindEvent():
items = ('parse',)
FrameParser.Button.batchBind(FrameParser.Button, gui.frame_parse, items)
@staticmethod
def parse(event):
flow.FrameParser.ButtonParse.handle()
@staticmethod
def batchBind(handler_parent, source_parent, items_name):
for i in items_name:
gui.frame_parse.Bind(wx.EVT_BUTTON, getattr(handler_parent, i), getattr(source_parent, 'button_' + i))
class FrameMerger:
@staticmethod
def bindEvent():
gui.frame_merger.Bind(wx.EVT_CLOSE, FrameMerger.win_close)
FrameMerger.MenuBar.bindEvent()
@staticmethod
def win_close(event):
flow.ShutDown.frame_merger_close(event)
class MenuBar:
@staticmethod
def bindEvent():
FrameMerger.MenuBar.File.bineEvent()
FrameMerger.MenuBar.Help.bindEvent()
class File:
@staticmethod
def bineEvent():
items = ('logs', 'exit')
FrameMerger.MenuBar.batchBind(FrameMerger.MenuBar.File, gui.frame_merger.menu_bar.file, items)
@staticmethod
def settings(event):
dlg = gui.DialogSettings(gui.frame_merger)
dlg.ShowModal()
@staticmethod
def logs(event):
gui.dialog_dllog.Show()
@staticmethod
def exit(event):
flow.ShutDown.handle()
class Help:
@staticmethod
def bindEvent():
items = ('about',)
FrameMerger.MenuBar.batchBind(FrameMerger.MenuBar.Help, gui.frame_merger.menu_bar.help, items)
@staticmethod
def about(event):
dlg = gui.DialogAbout(gui.frame_merger)
dlg.ShowModal()
dlg.Destroy()
@staticmethod
def batchBind(handler_parent, source_parent, items_name):
for i in items_name:
gui.frame_merger.Bind(wx.EVT_MENU, getattr(handler_parent, i), getattr(source_parent, i))
class DialogCopyLink:
@staticmethod
def bindEvent():
DialogCopyLink.ListCtrl.bindEvent()
class ListCtrl:
@staticmethod
def bindEvent():
items = ('copysel', 'copygroup')
DialogCopyLink.ListCtrl.batchBind(DialogCopyLink.ListCtrl, gui.dialog_copylink.listctrl_links.menu, items)
@staticmethod
def copysel(event):
flow.CopyLink.copysel()
@staticmethod
def copygroup(event):
flow.CopyLink.copygroup()
@staticmethod
def batchBind(handler_parent, source_parent, items_name):
for i in items_name:
gui.dialog_copylink.Bind(wx.EVT_MENU, getattr(handler_parent, i), getattr(source_parent, i))