Mercurial > hg > multiomr
comparison mainGDI.py @ 2:46fb79167a61 tip
Main Code
author | Victor Padilla <victor.padilla.mc@gmail.com> |
---|---|
date | Mon, 04 May 2015 22:56:18 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
1:0f7f611deca4 | 2:46fb79167a61 |
---|---|
1 ''' | |
2 @organization: Lancaster University & University of Leeds | |
3 @version: 1.0 | |
4 Created on 11/12/2014 | |
5 | |
6 @author: Victor Padilla | |
7 @contact: v.padilla@lancaster.ac.uk | |
8 | |
9 GDI interface application with wxpython | |
10 The application can be run through command line (without windows interface) using | |
11 MainMultiOMR library | |
12 ''' | |
13 import wx | |
14 import webbrowser | |
15 from Functions import AddingXMLSingleMeasures | |
16 from Automatism import BatchOMR | |
17 from MainMultiOMR import MainMultiOMR | |
18 | |
19 import modulefinder | |
20 | |
21 class MainWindow(wx.Frame): | |
22 ''' | |
23 Configuration of the main interface. | |
24 The application could be used without this interface, just with the classes of MainMultiOMR | |
25 ''' | |
26 | |
27 def __init__(self, parent, title): | |
28 ''' | |
29 init function | |
30 | |
31 ''' | |
32 self.runMainMenu(parent,title) | |
33 mf=MainMultiOMR() | |
34 mf._loadNWunsch() | |
35 | |
36 | |
37 def runMainMenu(self,parent,title): | |
38 ''' | |
39 Configure the main menu for the application | |
40 | |
41 ''' | |
42 wx.Frame.__init__(self, parent, title=title, size=(400,400)) | |
43 self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE) | |
44 self.CreateStatusBar() | |
45 | |
46 preprocessmenu=wx.Menu() | |
47 automatmenu=wx.Menu() | |
48 processmenu= wx.Menu() | |
49 resultmenu=wx.Menu() | |
50 utilsmenu=wx.Menu() | |
51 menu=wx.Menu() | |
52 | |
53 menuPDF2TIFF=preprocessmenu.Append(wx.ID_ANY, "& PDF to TIFF"," PDF to TIFF") | |
54 menuOssias=preprocessmenu.Append(wx.ID_ANY, "& Remove Ossias"," Remove Ossias") | |
55 | |
56 menuPSAuto=automatmenu.Append(wx.ID_ANY, "&PS"," PS") | |
57 menuSSAuto=automatmenu.Append(wx.ID_ANY, "&SS"," SS") | |
58 menuCPAuto=automatmenu.Append(wx.ID_ANY, "&CP"," CP") | |
59 menuSEAuto=automatmenu.Append(wx.ID_ANY, "&SE"," SE") | |
60 automatmenu.AppendSeparator() | |
61 menuAllAuto=automatmenu.Append(wx.ID_ANY, "&All"," All") | |
62 automatmenu.AppendSeparator() | |
63 menuCleanXML=automatmenu.Append(wx.ID_ANY, "&Clean XML"," Clean XML") | |
64 automatmenu.AppendSeparator() | |
65 menuSetupApp=automatmenu.Append(wx.ID_ANY, "&Setup Application"," Setup Application") | |
66 | |
67 menuOpenOneMovement = processmenu.Append(wx.ID_OPEN, "&Process one Movement"," Process one Movement") | |
68 menuOpenLoopBigData = processmenu.Append(wx.ID_ANY, "&Process Big Data"," Process big Data") | |
69 menuOpenLoopBigDataAdapt = processmenu.Append(wx.ID_ANY, "&Process Big Data Adapting OMRs"," Process big Data Adapting OMRs") | |
70 processmenu.AppendSeparator() | |
71 menuOpenCompleteProcess = processmenu.Append(wx.ID_ANY, "&Complete process"," Complete Process") | |
72 | |
73 menuOpenOneMovementGround=resultmenu.Append(wx.ID_ANY, "&Result one Movement"," Result one Movement") | |
74 menuOpenLoopBigDataGround = resultmenu.Append(wx.ID_ANY, "&Result Big Data"," Result Big Data") | |
75 processmenu.AppendSeparator() | |
76 menuFinalXLS = resultmenu.Append(wx.ID_ANY, "&Write final xls"," Write final xls") | |
77 | |
78 | |
79 menuWrongMeasures = utilsmenu.Append(wx.ID_ANY, "&View Wrong Measures"," Wrong measures") | |
80 utilsmenu.AppendSeparator() | |
81 menuJoinXMLs = utilsmenu.Append(wx.ID_ANY, "&Join XML"," Join XML") | |
82 utilsmenu.AppendSeparator() | |
83 menuViewM21 = utilsmenu.Append(wx.ID_ANY, "&View Through Music21"," View Music21") | |
84 utilsmenu.AppendSeparator() | |
85 menuConvertKrnToMusicXML = utilsmenu.Append(wx.ID_ANY, "&Krn to MusicXML"," Krn to MusicXML") | |
86 menuConvertMidiToMusicXML = utilsmenu.Append(wx.ID_ANY, "&Midi to MusicXML"," Midi to MusicXML") | |
87 menuConvertVoicesToChord = utilsmenu.Append(wx.ID_ANY, "&Voices to Chord"," Voices to Chord") | |
88 menuConvertBeamsToTriplets = utilsmenu.Append(wx.ID_ANY, "&Beams to Triplets"," Beams to Triplets") | |
89 menuRemovesEmptyVoices = utilsmenu.Append(wx.ID_ANY, "&Removes empty voices"," Removes empty voices") | |
90 menuRemovesGaps = utilsmenu.Append(wx.ID_ANY, "&Removes Gaps"," Removes Gaps") | |
91 utilsmenu.AppendSeparator() | |
92 menuAdaptOMRs = utilsmenu.Append(wx.ID_ANY, "&Adapt OMRs"," Adapt OMRs") | |
93 | |
94 menuAbout = menu.Append(wx.ID_ABOUT, "&About"," Information about this program") | |
95 menu.AppendSeparator() | |
96 menuDocumentation = menu.Append(wx.ID_ANY, "& Technical Documentation"," Technical Documentation") | |
97 menuUserManual = menu.Append(wx.ID_ANY, "& User Manual"," User Manual") | |
98 menu.AppendSeparator() | |
99 menuExit = menu.Append(wx.ID_EXIT,"E&xit"," Terminate the program") | |
100 | |
101 menuBar = wx.MenuBar() | |
102 menuBar.Append(preprocessmenu,"&Preprocessing") | |
103 menuBar.Append(automatmenu,"&Automatism") | |
104 menuBar.Append(processmenu,"&Process") | |
105 menuBar.Append(resultmenu,"&Results") | |
106 menuBar.Append(utilsmenu,"&Utils") | |
107 menuBar.Append(menu,"&Help") | |
108 | |
109 self.SetMenuBar(menuBar) | |
110 | |
111 self.Bind(wx.EVT_MENU, self.OnPDF2TIFF, menuPDF2TIFF) | |
112 self.Bind(wx.EVT_MENU, self.OnRemoveOssias, menuOssias) | |
113 | |
114 self.Bind(wx.EVT_MENU, self.OnViewPSAuto, menuPSAuto) | |
115 self.Bind(wx.EVT_MENU, self.OnViewSSAuto, menuSSAuto) | |
116 self.Bind(wx.EVT_MENU, self.OnViewCPAuto, menuCPAuto) | |
117 self.Bind(wx.EVT_MENU, self.OnViewSEAuto, menuSEAuto) | |
118 self.Bind(wx.EVT_MENU, self.OnViewAllAuto, menuAllAuto) | |
119 self.Bind(wx.EVT_MENU, self.OnViewCleanXML, menuCleanXML) | |
120 self.Bind(wx.EVT_MENU, self.OnViewSetupApp, menuSetupApp) | |
121 | |
122 self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout) | |
123 self.Bind(wx.EVT_MENU, self.OnDocumentation, menuDocumentation) | |
124 self.Bind(wx.EVT_MENU, self.OnUserManual, menuUserManual) | |
125 self.Bind(wx.EVT_MENU, self.OnOpenOneMovement, menuOpenOneMovement) | |
126 self.Bind(wx.EVT_MENU, self.OnOpenLoopBigData, menuOpenLoopBigData) | |
127 self.Bind(wx.EVT_MENU, self.OnOpenLoopBigDataAdapt, menuOpenLoopBigDataAdapt) | |
128 self.Bind(wx.EVT_MENU, self.OnOpenCompleteProcess, menuOpenCompleteProcess) | |
129 self.Bind(wx.EVT_MENU, self.OnExit, menuExit) | |
130 | |
131 self.Bind(wx.EVT_MENU, self.OnViewWrongMeasures, menuWrongMeasures) | |
132 self.Bind(wx.EVT_MENU, self.OnViewJoinXMLs, menuJoinXMLs) | |
133 self.Bind(wx.EVT_MENU, self.OnViewM21, menuViewM21) | |
134 self.Bind(wx.EVT_MENU, self.OnViewConvertKrnToMusicXML, menuConvertKrnToMusicXML) | |
135 self.Bind(wx.EVT_MENU, self.OnViewConvertMidiToMusicXML, menuConvertMidiToMusicXML) | |
136 self.Bind(wx.EVT_MENU, self.OnViewConvertVoicesToChord, menuConvertVoicesToChord) | |
137 self.Bind(wx.EVT_MENU, self.OnViewConvertBeamsToTriplets, menuConvertBeamsToTriplets) | |
138 self.Bind(wx.EVT_MENU, self.OnViewRemovesEmptyVoices, menuRemovesEmptyVoices) | |
139 self.Bind(wx.EVT_MENU, self.OnViewRemovesGaps, menuRemovesGaps) | |
140 self.Bind(wx.EVT_MENU, self.OnViewAdaptOMRs, menuAdaptOMRs) | |
141 | |
142 | |
143 | |
144 self.Bind(wx.EVT_MENU, self.OnOpenOneMovementGround, menuOpenOneMovementGround) | |
145 self.Bind(wx.EVT_MENU, self.OnOpenLoopBigDataGround, menuOpenLoopBigDataGround) | |
146 self.Bind(wx.EVT_MENU, self.OnOpenFinalXLS, menuFinalXLS) | |
147 | |
148 self.Show(True) | |
149 | |
150 | |
151 def OnPDF2TIFF(self,e): | |
152 dlg = wx.FileDialog(self, "Open .PDF file", "", "", | |
153 "PDF files (*.pdf)|*.pdf", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
154 mmo=MainMultiOMR() | |
155 if dlg.ShowModal() == wx.ID_OK: | |
156 filename = dlg.GetPath() | |
157 mmo.processPDF2TIFF(filename) | |
158 print "END" | |
159 dlg.Destroy() | |
160 | |
161 | |
162 def OnRemoveOssias(self,e): | |
163 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
164 mmo=MainMultiOMR() | |
165 if dlg.ShowModal() == wx.ID_OK: | |
166 dirGeneral = dlg.GetPath() | |
167 mmo.processOssia(dirGeneral) | |
168 dlg.Destroy() | |
169 | |
170 | |
171 | |
172 def OnViewPSAuto(self,e): | |
173 ''' | |
174 ################ AUTOMATISM MENU ################## | |
175 Search all the images folder and convert .tif images to .XML | |
176 using PhotoScore (SIKULI) | |
177 ''' | |
178 batchOMR=BatchOMR() | |
179 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
180 if dlg.ShowModal() == wx.ID_OK: | |
181 dirname = dlg.GetPath() | |
182 batchOMR.processAllTiffFiles(dirname,"PS") | |
183 print "END" | |
184 dlg.Destroy() | |
185 | |
186 def OnViewSSAuto(self,e): | |
187 ''' | |
188 ################ AUTOMATISM MENU ################## | |
189 Search all the images folder and convert .tif images to .XML | |
190 using SmartScore (SIKULI) | |
191 ''' | |
192 batchOMR=BatchOMR() | |
193 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
194 if dlg.ShowModal() == wx.ID_OK: | |
195 dirname = dlg.GetPath() | |
196 batchOMR.processAllTiffFiles(dirname,"SS") | |
197 print "END" | |
198 dlg.Destroy() | |
199 | |
200 def OnViewCPAuto(self,e): | |
201 ''' | |
202 ################ AUTOMATISM MENU ################## | |
203 Search all the images folder and convert .tif images to .XML | |
204 using Capella (SIKULI) | |
205 ''' | |
206 batchOMR=BatchOMR() | |
207 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
208 if dlg.ShowModal() == wx.ID_OK: | |
209 dirname = dlg.GetPath() | |
210 batchOMR.processAllTiffFiles(dirname,"CP") | |
211 print "END" | |
212 dlg.Destroy() | |
213 | |
214 def OnViewSEAuto(self,e): | |
215 ''' | |
216 ################ AUTOMATISM MENU ################## | |
217 Search all the images folder and convert .tif images to .XML | |
218 using SharpEye (SIKULI) | |
219 ''' | |
220 batchOMR=BatchOMR() | |
221 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
222 if dlg.ShowModal() == wx.ID_OK: | |
223 dirname = dlg.GetPath() | |
224 batchOMR.processAllTiffFiles(dirname,"SE") | |
225 print "END" | |
226 dlg.Destroy() | |
227 | |
228 def OnViewAllAuto(self,e): | |
229 ''' | |
230 ################ AUTOMATISM MENU ################## | |
231 Search all the images folder and convert .tif images to .XML | |
232 using ALL the predefined OMR (SIKULI) | |
233 ''' | |
234 batchOMR=BatchOMR() | |
235 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
236 if dlg.ShowModal() == wx.ID_OK: | |
237 dirname = dlg.GetPath() | |
238 batchOMR.processAllTiffFiles(dirname,"ALL") | |
239 print "END" | |
240 dlg.Destroy() | |
241 | |
242 def OnViewCleanXML(self,e): | |
243 ''' | |
244 ################ AUTOMATISM MENU ################## | |
245 Utility for deleting all the files produced by the different OMR | |
246 (.XML files and .mro in case of SharpEye) | |
247 ''' | |
248 batchOMR=BatchOMR() | |
249 if wx.MessageBox("All XML Files will be deleted. Do you wish to continue?", "Please confirm", | |
250 wx.ICON_QUESTION | wx.YES_NO, self) == wx.NO: | |
251 return | |
252 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
253 if dlg.ShowModal() == wx.ID_OK: | |
254 dirname = dlg.GetPath() | |
255 batchOMR.cleanXMLFiles(dirname) | |
256 print "END" | |
257 dlg.Destroy() | |
258 | |
259 def OnViewSetupApp(self,e): | |
260 ''' | |
261 ################ AUTOMATISM MENU ################## | |
262 Utility for setup the 'Process' folder once the OMR files are finished | |
263 Two steps: | |
264 1.- Copy the XML files | |
265 2.- Take the .krn file and convert to ground.xml in the appropriate folder | |
266 ''' | |
267 batchOMR=BatchOMR() | |
268 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
269 if dlg.ShowModal() == wx.ID_OK: | |
270 dirname = dlg.GetPath() | |
271 print "-------COPY XML FILES----------" | |
272 batchOMR.setupApp(dirname) | |
273 print "-------CONVERT GROUND----------" | |
274 batchOMR.setGround(dirname) | |
275 ######## preparing files | |
276 | |
277 print "END" | |
278 dlg.Destroy() | |
279 | |
280 | |
281 | |
282 def OnOpenOneMovement(self,e): | |
283 ''' | |
284 ######################### PROCESS MENU ########################### | |
285 Processing just one movement | |
286 ''' | |
287 | |
288 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
289 mf=MainMultiOMR() | |
290 if dlg.ShowModal() == wx.ID_OK: | |
291 dirGeneral = dlg.GetPath() | |
292 print "----START----:",dirGeneral | |
293 mf.processMovement(dirGeneral) | |
294 | |
295 dlg.Destroy() | |
296 | |
297 def OnOpenLoopBigData(self,e): | |
298 ''' | |
299 ######################### PROCESS MENU ########################### | |
300 BigData Process menu option | |
301 The program is waiting for files to process | |
302 This option can be executed in a different machine reading a common folder | |
303 ''' | |
304 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
305 mf=MainMultiOMR() | |
306 if dlg.ShowModal() == wx.ID_OK: | |
307 rootDir = dlg.GetPath() | |
308 mf.runLoopBigData(rootDir,adaptOMRs=False) | |
309 dlg.Destroy() | |
310 | |
311 def OnOpenLoopBigDataAdapt(self,e): | |
312 ''' | |
313 ######################### PROCESS MENU ########################### | |
314 BigData Process menu option | |
315 The program is waiting for files to process | |
316 This option can be executed in a different machine reading a common folder | |
317 ''' | |
318 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
319 mf=MainMultiOMR() | |
320 if dlg.ShowModal() == wx.ID_OK: | |
321 rootDir = dlg.GetPath() | |
322 mf.runLoopBigData(rootDir,adaptOMRs=True) | |
323 dlg.Destroy() | |
324 | |
325 | |
326 def OnOpenCompleteProcess(self,e): | |
327 ''' | |
328 ######################### PROCESS MENU ########################### | |
329 Run the complete process: | |
330 1- Convert all .tif files to .XML (SIKULI) | |
331 2- Processing all the files | |
332 3- Get all the results | |
333 This option is thought in mind for running in a single machine | |
334 ''' | |
335 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
336 mf=MainMultiOMR() | |
337 if dlg.ShowModal() == wx.ID_OK: | |
338 dirGeneral = dlg.GetPath() | |
339 print "----START----:",dirGeneral | |
340 mf.runCompleteProcess(dirGeneral) | |
341 | |
342 dlg.Destroy() | |
343 | |
344 | |
345 def OnOpenOneMovementGround(self,e): | |
346 ''' | |
347 ########################## RESULT MENU ################################# | |
348 Check each .xml file against 'ground.xml' and evaluate the differences. | |
349 The final result is written in the appropriated file | |
350 Example: | |
351 k428\Process\m1\parts\resultGeneral.xlsx | |
352 ''' | |
353 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
354 mf=MainMultiOMR() | |
355 if dlg.ShowModal() == wx.ID_OK: | |
356 dirGeneral = dlg.GetPath() | |
357 mf.processMovementGround(dirGeneral) | |
358 dlg.Destroy() | |
359 | |
360 def OnOpenLoopBigDataGround(self,e): | |
361 ''' | |
362 ########################## RESULT MENU ################################# | |
363 BigData Result menu option | |
364 The program is waiting for files to get the result | |
365 This option can be executed in a different machine reading a common folder | |
366 ''' | |
367 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
368 mf=MainMultiOMR() | |
369 if dlg.ShowModal() == wx.ID_OK: | |
370 rootDir = dlg.GetPath() | |
371 mf.runLoopBigDataGround(rootDir) | |
372 | |
373 dlg.Destroy() | |
374 | |
375 def OnOpenFinalXLS(self,e): | |
376 ''' | |
377 ########################## RESULT MENU ################################# | |
378 BigData Result menu option | |
379 The program is waiting for files to get the result | |
380 This option can be executed in a different machine reading a common folder | |
381 ''' | |
382 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
383 mf=MainMultiOMR() | |
384 if dlg.ShowModal() == wx.ID_OK: | |
385 rootDir = dlg.GetPath() | |
386 mf.runFinalXLS(rootDir) | |
387 | |
388 dlg.Destroy() | |
389 | |
390 def OnViewWrongMeasures(self,e): | |
391 ''' | |
392 ########################## UTILS MENU ##################################### | |
393 Check the different errors in measures using | |
394 different procedures | |
395 ''' | |
396 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
397 mf=MainMultiOMR() | |
398 if dlg.ShowModal() == wx.ID_OK: | |
399 dirname = dlg.GetPath() | |
400 print "---------S1------------" | |
401 mf.runViewWrongMeasures(dirname) | |
402 | |
403 dlg.Destroy() | |
404 | |
405 | |
406 def OnViewJoinXMLs(self,e): | |
407 ''' | |
408 ########################## UTILS MENU ##################################### | |
409 Add different measures | |
410 (under development) | |
411 ''' | |
412 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
413 if dlg.ShowModal() == wx.ID_OK: | |
414 dirname = dlg.GetPath() | |
415 addingXML=AddingXMLSingleMeasures() | |
416 addingXML.runViewJoinXML(dirname) | |
417 | |
418 dlg.Destroy() | |
419 | |
420 | |
421 | |
422 def OnViewM21(self,e): | |
423 ''' | |
424 ########################## UTILS MENU ##################################### | |
425 Show an .xml file processed by music21 | |
426 to check the differences and possible errors | |
427 ''' | |
428 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
429 mf=MainMultiOMR() | |
430 if dlg.ShowModal() == wx.ID_OK: | |
431 dirname = dlg.GetPath() | |
432 mf.runViewM21(dirname) | |
433 dlg.Destroy() | |
434 | |
435 | |
436 | |
437 | |
438 def OnViewConvertKrnToMusicXML(self,e): | |
439 ''' | |
440 ########################## UTILS MENU ##################################### | |
441 convert one .krn file to .xml | |
442 ''' | |
443 dlg = wx.FileDialog(self, "Open .krn file", "", "", | |
444 "KRN files (*.krn)|*.krn", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
445 mf=MainMultiOMR() | |
446 if dlg.ShowModal() == wx.ID_OK: | |
447 filename = dlg.GetPath() | |
448 mf.runConvertKrnToMusicXML(filename) | |
449 print "END" | |
450 dlg.Destroy() | |
451 | |
452 def OnViewConvertMidiToMusicXML(self,e): | |
453 ''' | |
454 ########################## UTILS MENU ##################################### | |
455 convert one .midi file to .xml | |
456 ''' | |
457 dlg = wx.FileDialog(self, "Open .mid file", "", "", | |
458 "MIDI files (*.mid)|*.mid", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
459 mf=MainMultiOMR() | |
460 if dlg.ShowModal() == wx.ID_OK: | |
461 filename = dlg.GetPath() | |
462 mf.runConvertMidiToMusicXML(filename) | |
463 print "END" | |
464 dlg.Destroy() | |
465 | |
466 def OnViewConvertVoicesToChord(self,e): | |
467 ''' | |
468 ########################## UTILS MENU ##################################### | |
469 ''' | |
470 dlg = wx.FileDialog(self, "Open .mid file", "", "", | |
471 "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
472 mf=MainMultiOMR() | |
473 if dlg.ShowModal() == wx.ID_OK: | |
474 filename = dlg.GetPath() | |
475 mf.runConvertVoicesToChord(filename) | |
476 print "END" | |
477 dlg.Destroy() | |
478 | |
479 def OnViewConvertBeamsToTriplets(self,e): | |
480 ''' | |
481 ########################## UTILS MENU ##################################### | |
482 ''' | |
483 dlg = wx.FileDialog(self, "Open .mid file", "", "", | |
484 "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
485 mf=MainMultiOMR() | |
486 if dlg.ShowModal() == wx.ID_OK: | |
487 filename = dlg.GetPath() | |
488 mf.runConvertBeamsToTriplets(filename) | |
489 print "END" | |
490 dlg.Destroy() | |
491 | |
492 def OnViewRemovesEmptyVoices(self,e): | |
493 ''' | |
494 ########################## UTILS MENU ##################################### | |
495 ''' | |
496 dlg = wx.FileDialog(self, "Open .mid file", "", "", | |
497 "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
498 mf=MainMultiOMR() | |
499 if dlg.ShowModal() == wx.ID_OK: | |
500 filename = dlg.GetPath() | |
501 mf.runRemovesEmptyVoices(filename) | |
502 print "END" | |
503 dlg.Destroy() | |
504 def OnViewRemovesGaps(self,e): | |
505 ''' | |
506 ########################## UTILS MENU ##################################### | |
507 ''' | |
508 dlg = wx.FileDialog(self, "Open .mid file", "", "", | |
509 "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) | |
510 mf=MainMultiOMR() | |
511 if dlg.ShowModal() == wx.ID_OK: | |
512 filename = dlg.GetPath() | |
513 mf.runRemovesGaps(filename) | |
514 print "END" | |
515 dlg.Destroy() | |
516 | |
517 def OnViewAdaptOMRs(self,e): | |
518 ''' | |
519 ########################## UTILS MENU ##################################### | |
520 ''' | |
521 | |
522 dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) | |
523 mf=MainMultiOMR() | |
524 if dlg.ShowModal() == wx.ID_OK: | |
525 dirname = dlg.GetPath() | |
526 mf.runAdaptOMRs(dirname) | |
527 dlg.Destroy() | |
528 | |
529 def OnAbout(self,e): | |
530 ''' | |
531 ########################## MENU ##################################### | |
532 about menu option | |
533 ''' | |
534 dlg = wx.MessageDialog( self, "Big Data Project", "Big Data Project", wx.OK) | |
535 dlg.ShowModal() | |
536 dlg.Destroy() | |
537 | |
538 def OnDocumentation(self,e): | |
539 ''' | |
540 ########################## MENU ##################################### | |
541 open documentation web | |
542 ''' | |
543 webbrowser.open_new("..\\Documentation\\html\\index.html") | |
544 def OnUserManual(self,e): | |
545 ''' | |
546 ########################## MENU ##################################### | |
547 open user manual | |
548 ''' | |
549 webbrowser.open_new("..\\Documentation\\Manual.pdf") | |
550 def OnExit(self,e): | |
551 ''' | |
552 ########################## MENU ##################################### | |
553 exit menu option | |
554 ''' | |
555 self.Close(True) | |
556 | |
557 | |
558 | |
559 | |
560 app = wx.App(False) | |
561 frame = MainWindow(None, "Big Data Process") | |
562 app.MainLoop() |