victor@2: ''' victor@2: @organization: Lancaster University & University of Leeds victor@2: @version: 1.0 victor@2: Created on 11/12/2014 victor@2: victor@2: @author: Victor Padilla victor@2: @contact: v.padilla@lancaster.ac.uk victor@2: victor@2: GDI interface application with wxpython victor@2: The application can be run through command line (without windows interface) using victor@2: MainMultiOMR library victor@2: ''' victor@2: import wx victor@2: import webbrowser victor@2: from Functions import AddingXMLSingleMeasures victor@2: from Automatism import BatchOMR victor@2: from MainMultiOMR import MainMultiOMR victor@2: victor@2: import modulefinder victor@2: victor@2: class MainWindow(wx.Frame): victor@2: ''' victor@2: Configuration of the main interface. victor@2: The application could be used without this interface, just with the classes of MainMultiOMR victor@2: ''' victor@2: victor@2: def __init__(self, parent, title): victor@2: ''' victor@2: init function victor@2: victor@2: ''' victor@2: self.runMainMenu(parent,title) victor@2: mf=MainMultiOMR() victor@2: mf._loadNWunsch() victor@2: victor@2: victor@2: def runMainMenu(self,parent,title): victor@2: ''' victor@2: Configure the main menu for the application victor@2: victor@2: ''' victor@2: wx.Frame.__init__(self, parent, title=title, size=(400,400)) victor@2: self.control = wx.TextCtrl(self, style=wx.TE_MULTILINE) victor@2: self.CreateStatusBar() victor@2: victor@2: preprocessmenu=wx.Menu() victor@2: automatmenu=wx.Menu() victor@2: processmenu= wx.Menu() victor@2: resultmenu=wx.Menu() victor@2: utilsmenu=wx.Menu() victor@2: menu=wx.Menu() victor@2: victor@2: menuPDF2TIFF=preprocessmenu.Append(wx.ID_ANY, "& PDF to TIFF"," PDF to TIFF") victor@2: menuOssias=preprocessmenu.Append(wx.ID_ANY, "& Remove Ossias"," Remove Ossias") victor@2: victor@2: menuPSAuto=automatmenu.Append(wx.ID_ANY, "&PS"," PS") victor@2: menuSSAuto=automatmenu.Append(wx.ID_ANY, "&SS"," SS") victor@2: menuCPAuto=automatmenu.Append(wx.ID_ANY, "&CP"," CP") victor@2: menuSEAuto=automatmenu.Append(wx.ID_ANY, "&SE"," SE") victor@2: automatmenu.AppendSeparator() victor@2: menuAllAuto=automatmenu.Append(wx.ID_ANY, "&All"," All") victor@2: automatmenu.AppendSeparator() victor@2: menuCleanXML=automatmenu.Append(wx.ID_ANY, "&Clean XML"," Clean XML") victor@2: automatmenu.AppendSeparator() victor@2: menuSetupApp=automatmenu.Append(wx.ID_ANY, "&Setup Application"," Setup Application") victor@2: victor@2: menuOpenOneMovement = processmenu.Append(wx.ID_OPEN, "&Process one Movement"," Process one Movement") victor@2: menuOpenLoopBigData = processmenu.Append(wx.ID_ANY, "&Process Big Data"," Process big Data") victor@2: menuOpenLoopBigDataAdapt = processmenu.Append(wx.ID_ANY, "&Process Big Data Adapting OMRs"," Process big Data Adapting OMRs") victor@2: processmenu.AppendSeparator() victor@2: menuOpenCompleteProcess = processmenu.Append(wx.ID_ANY, "&Complete process"," Complete Process") victor@2: victor@2: menuOpenOneMovementGround=resultmenu.Append(wx.ID_ANY, "&Result one Movement"," Result one Movement") victor@2: menuOpenLoopBigDataGround = resultmenu.Append(wx.ID_ANY, "&Result Big Data"," Result Big Data") victor@2: processmenu.AppendSeparator() victor@2: menuFinalXLS = resultmenu.Append(wx.ID_ANY, "&Write final xls"," Write final xls") victor@2: victor@2: victor@2: menuWrongMeasures = utilsmenu.Append(wx.ID_ANY, "&View Wrong Measures"," Wrong measures") victor@2: utilsmenu.AppendSeparator() victor@2: menuJoinXMLs = utilsmenu.Append(wx.ID_ANY, "&Join XML"," Join XML") victor@2: utilsmenu.AppendSeparator() victor@2: menuViewM21 = utilsmenu.Append(wx.ID_ANY, "&View Through Music21"," View Music21") victor@2: utilsmenu.AppendSeparator() victor@2: menuConvertKrnToMusicXML = utilsmenu.Append(wx.ID_ANY, "&Krn to MusicXML"," Krn to MusicXML") victor@2: menuConvertMidiToMusicXML = utilsmenu.Append(wx.ID_ANY, "&Midi to MusicXML"," Midi to MusicXML") victor@2: menuConvertVoicesToChord = utilsmenu.Append(wx.ID_ANY, "&Voices to Chord"," Voices to Chord") victor@2: menuConvertBeamsToTriplets = utilsmenu.Append(wx.ID_ANY, "&Beams to Triplets"," Beams to Triplets") victor@2: menuRemovesEmptyVoices = utilsmenu.Append(wx.ID_ANY, "&Removes empty voices"," Removes empty voices") victor@2: menuRemovesGaps = utilsmenu.Append(wx.ID_ANY, "&Removes Gaps"," Removes Gaps") victor@2: utilsmenu.AppendSeparator() victor@2: menuAdaptOMRs = utilsmenu.Append(wx.ID_ANY, "&Adapt OMRs"," Adapt OMRs") victor@2: victor@2: menuAbout = menu.Append(wx.ID_ABOUT, "&About"," Information about this program") victor@2: menu.AppendSeparator() victor@2: menuDocumentation = menu.Append(wx.ID_ANY, "& Technical Documentation"," Technical Documentation") victor@2: menuUserManual = menu.Append(wx.ID_ANY, "& User Manual"," User Manual") victor@2: menu.AppendSeparator() victor@2: menuExit = menu.Append(wx.ID_EXIT,"E&xit"," Terminate the program") victor@2: victor@2: menuBar = wx.MenuBar() victor@2: menuBar.Append(preprocessmenu,"&Preprocessing") victor@2: menuBar.Append(automatmenu,"&Automatism") victor@2: menuBar.Append(processmenu,"&Process") victor@2: menuBar.Append(resultmenu,"&Results") victor@2: menuBar.Append(utilsmenu,"&Utils") victor@2: menuBar.Append(menu,"&Help") victor@2: victor@2: self.SetMenuBar(menuBar) victor@2: victor@2: self.Bind(wx.EVT_MENU, self.OnPDF2TIFF, menuPDF2TIFF) victor@2: self.Bind(wx.EVT_MENU, self.OnRemoveOssias, menuOssias) victor@2: victor@2: self.Bind(wx.EVT_MENU, self.OnViewPSAuto, menuPSAuto) victor@2: self.Bind(wx.EVT_MENU, self.OnViewSSAuto, menuSSAuto) victor@2: self.Bind(wx.EVT_MENU, self.OnViewCPAuto, menuCPAuto) victor@2: self.Bind(wx.EVT_MENU, self.OnViewSEAuto, menuSEAuto) victor@2: self.Bind(wx.EVT_MENU, self.OnViewAllAuto, menuAllAuto) victor@2: self.Bind(wx.EVT_MENU, self.OnViewCleanXML, menuCleanXML) victor@2: self.Bind(wx.EVT_MENU, self.OnViewSetupApp, menuSetupApp) victor@2: victor@2: self.Bind(wx.EVT_MENU, self.OnAbout, menuAbout) victor@2: self.Bind(wx.EVT_MENU, self.OnDocumentation, menuDocumentation) victor@2: self.Bind(wx.EVT_MENU, self.OnUserManual, menuUserManual) victor@2: self.Bind(wx.EVT_MENU, self.OnOpenOneMovement, menuOpenOneMovement) victor@2: self.Bind(wx.EVT_MENU, self.OnOpenLoopBigData, menuOpenLoopBigData) victor@2: self.Bind(wx.EVT_MENU, self.OnOpenLoopBigDataAdapt, menuOpenLoopBigDataAdapt) victor@2: self.Bind(wx.EVT_MENU, self.OnOpenCompleteProcess, menuOpenCompleteProcess) victor@2: self.Bind(wx.EVT_MENU, self.OnExit, menuExit) victor@2: victor@2: self.Bind(wx.EVT_MENU, self.OnViewWrongMeasures, menuWrongMeasures) victor@2: self.Bind(wx.EVT_MENU, self.OnViewJoinXMLs, menuJoinXMLs) victor@2: self.Bind(wx.EVT_MENU, self.OnViewM21, menuViewM21) victor@2: self.Bind(wx.EVT_MENU, self.OnViewConvertKrnToMusicXML, menuConvertKrnToMusicXML) victor@2: self.Bind(wx.EVT_MENU, self.OnViewConvertMidiToMusicXML, menuConvertMidiToMusicXML) victor@2: self.Bind(wx.EVT_MENU, self.OnViewConvertVoicesToChord, menuConvertVoicesToChord) victor@2: self.Bind(wx.EVT_MENU, self.OnViewConvertBeamsToTriplets, menuConvertBeamsToTriplets) victor@2: self.Bind(wx.EVT_MENU, self.OnViewRemovesEmptyVoices, menuRemovesEmptyVoices) victor@2: self.Bind(wx.EVT_MENU, self.OnViewRemovesGaps, menuRemovesGaps) victor@2: self.Bind(wx.EVT_MENU, self.OnViewAdaptOMRs, menuAdaptOMRs) victor@2: victor@2: victor@2: victor@2: self.Bind(wx.EVT_MENU, self.OnOpenOneMovementGround, menuOpenOneMovementGround) victor@2: self.Bind(wx.EVT_MENU, self.OnOpenLoopBigDataGround, menuOpenLoopBigDataGround) victor@2: self.Bind(wx.EVT_MENU, self.OnOpenFinalXLS, menuFinalXLS) victor@2: victor@2: self.Show(True) victor@2: victor@2: victor@2: def OnPDF2TIFF(self,e): victor@2: dlg = wx.FileDialog(self, "Open .PDF file", "", "", victor@2: "PDF files (*.pdf)|*.pdf", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mmo=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mmo.processPDF2TIFF(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: victor@2: def OnRemoveOssias(self,e): victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mmo=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirGeneral = dlg.GetPath() victor@2: mmo.processOssia(dirGeneral) victor@2: dlg.Destroy() victor@2: victor@2: victor@2: victor@2: def OnViewPSAuto(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Search all the images folder and convert .tif images to .XML victor@2: using PhotoScore (SIKULI) victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: batchOMR.processAllTiffFiles(dirname,"PS") victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewSSAuto(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Search all the images folder and convert .tif images to .XML victor@2: using SmartScore (SIKULI) victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: batchOMR.processAllTiffFiles(dirname,"SS") victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewCPAuto(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Search all the images folder and convert .tif images to .XML victor@2: using Capella (SIKULI) victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: batchOMR.processAllTiffFiles(dirname,"CP") victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewSEAuto(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Search all the images folder and convert .tif images to .XML victor@2: using SharpEye (SIKULI) victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: batchOMR.processAllTiffFiles(dirname,"SE") victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewAllAuto(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Search all the images folder and convert .tif images to .XML victor@2: using ALL the predefined OMR (SIKULI) victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: batchOMR.processAllTiffFiles(dirname,"ALL") victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewCleanXML(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Utility for deleting all the files produced by the different OMR victor@2: (.XML files and .mro in case of SharpEye) victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: if wx.MessageBox("All XML Files will be deleted. Do you wish to continue?", "Please confirm", victor@2: wx.ICON_QUESTION | wx.YES_NO, self) == wx.NO: victor@2: return victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: batchOMR.cleanXMLFiles(dirname) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewSetupApp(self,e): victor@2: ''' victor@2: ################ AUTOMATISM MENU ################## victor@2: Utility for setup the 'Process' folder once the OMR files are finished victor@2: Two steps: victor@2: 1.- Copy the XML files victor@2: 2.- Take the .krn file and convert to ground.xml in the appropriate folder victor@2: ''' victor@2: batchOMR=BatchOMR() victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: print "-------COPY XML FILES----------" victor@2: batchOMR.setupApp(dirname) victor@2: print "-------CONVERT GROUND----------" victor@2: batchOMR.setGround(dirname) victor@2: ######## preparing files victor@2: victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: victor@2: victor@2: def OnOpenOneMovement(self,e): victor@2: ''' victor@2: ######################### PROCESS MENU ########################### victor@2: Processing just one movement victor@2: ''' victor@2: victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirGeneral = dlg.GetPath() victor@2: print "----START----:",dirGeneral victor@2: mf.processMovement(dirGeneral) victor@2: victor@2: dlg.Destroy() victor@2: victor@2: def OnOpenLoopBigData(self,e): victor@2: ''' victor@2: ######################### PROCESS MENU ########################### victor@2: BigData Process menu option victor@2: The program is waiting for files to process victor@2: This option can be executed in a different machine reading a common folder victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: rootDir = dlg.GetPath() victor@2: mf.runLoopBigData(rootDir,adaptOMRs=False) victor@2: dlg.Destroy() victor@2: victor@2: def OnOpenLoopBigDataAdapt(self,e): victor@2: ''' victor@2: ######################### PROCESS MENU ########################### victor@2: BigData Process menu option victor@2: The program is waiting for files to process victor@2: This option can be executed in a different machine reading a common folder victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: rootDir = dlg.GetPath() victor@2: mf.runLoopBigData(rootDir,adaptOMRs=True) victor@2: dlg.Destroy() victor@2: victor@2: victor@2: def OnOpenCompleteProcess(self,e): victor@2: ''' victor@2: ######################### PROCESS MENU ########################### victor@2: Run the complete process: victor@2: 1- Convert all .tif files to .XML (SIKULI) victor@2: 2- Processing all the files victor@2: 3- Get all the results victor@2: This option is thought in mind for running in a single machine victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirGeneral = dlg.GetPath() victor@2: print "----START----:",dirGeneral victor@2: mf.runCompleteProcess(dirGeneral) victor@2: victor@2: dlg.Destroy() victor@2: victor@2: victor@2: def OnOpenOneMovementGround(self,e): victor@2: ''' victor@2: ########################## RESULT MENU ################################# victor@2: Check each .xml file against 'ground.xml' and evaluate the differences. victor@2: The final result is written in the appropriated file victor@2: Example: victor@2: k428\Process\m1\parts\resultGeneral.xlsx victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirGeneral = dlg.GetPath() victor@2: mf.processMovementGround(dirGeneral) victor@2: dlg.Destroy() victor@2: victor@2: def OnOpenLoopBigDataGround(self,e): victor@2: ''' victor@2: ########################## RESULT MENU ################################# victor@2: BigData Result menu option victor@2: The program is waiting for files to get the result victor@2: This option can be executed in a different machine reading a common folder victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: rootDir = dlg.GetPath() victor@2: mf.runLoopBigDataGround(rootDir) victor@2: victor@2: dlg.Destroy() victor@2: victor@2: def OnOpenFinalXLS(self,e): victor@2: ''' victor@2: ########################## RESULT MENU ################################# victor@2: BigData Result menu option victor@2: The program is waiting for files to get the result victor@2: This option can be executed in a different machine reading a common folder victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: rootDir = dlg.GetPath() victor@2: mf.runFinalXLS(rootDir) victor@2: victor@2: dlg.Destroy() victor@2: victor@2: def OnViewWrongMeasures(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: Check the different errors in measures using victor@2: different procedures victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: print "---------S1------------" victor@2: mf.runViewWrongMeasures(dirname) victor@2: victor@2: dlg.Destroy() victor@2: victor@2: victor@2: def OnViewJoinXMLs(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: Add different measures victor@2: (under development) victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: addingXML=AddingXMLSingleMeasures() victor@2: addingXML.runViewJoinXML(dirname) victor@2: victor@2: dlg.Destroy() victor@2: victor@2: victor@2: victor@2: def OnViewM21(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: Show an .xml file processed by music21 victor@2: to check the differences and possible errors victor@2: ''' victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: mf.runViewM21(dirname) victor@2: dlg.Destroy() victor@2: victor@2: victor@2: victor@2: victor@2: def OnViewConvertKrnToMusicXML(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: convert one .krn file to .xml victor@2: ''' victor@2: dlg = wx.FileDialog(self, "Open .krn file", "", "", victor@2: "KRN files (*.krn)|*.krn", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mf.runConvertKrnToMusicXML(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewConvertMidiToMusicXML(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: convert one .midi file to .xml victor@2: ''' victor@2: dlg = wx.FileDialog(self, "Open .mid file", "", "", victor@2: "MIDI files (*.mid)|*.mid", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mf.runConvertMidiToMusicXML(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewConvertVoicesToChord(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: ''' victor@2: dlg = wx.FileDialog(self, "Open .mid file", "", "", victor@2: "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mf.runConvertVoicesToChord(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewConvertBeamsToTriplets(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: ''' victor@2: dlg = wx.FileDialog(self, "Open .mid file", "", "", victor@2: "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mf.runConvertBeamsToTriplets(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewRemovesEmptyVoices(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: ''' victor@2: dlg = wx.FileDialog(self, "Open .mid file", "", "", victor@2: "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mf.runRemovesEmptyVoices(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: def OnViewRemovesGaps(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: ''' victor@2: dlg = wx.FileDialog(self, "Open .mid file", "", "", victor@2: "xml files (*.xml)|*.xml", wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: filename = dlg.GetPath() victor@2: mf.runRemovesGaps(filename) victor@2: print "END" victor@2: dlg.Destroy() victor@2: victor@2: def OnViewAdaptOMRs(self,e): victor@2: ''' victor@2: ########################## UTILS MENU ##################################### victor@2: ''' victor@2: victor@2: dlg = wx.DirDialog(None, "Choose a directory","",wx.DD_DEFAULT_STYLE) victor@2: mf=MainMultiOMR() victor@2: if dlg.ShowModal() == wx.ID_OK: victor@2: dirname = dlg.GetPath() victor@2: mf.runAdaptOMRs(dirname) victor@2: dlg.Destroy() victor@2: victor@2: def OnAbout(self,e): victor@2: ''' victor@2: ########################## MENU ##################################### victor@2: about menu option victor@2: ''' victor@2: dlg = wx.MessageDialog( self, "Big Data Project", "Big Data Project", wx.OK) victor@2: dlg.ShowModal() victor@2: dlg.Destroy() victor@2: victor@2: def OnDocumentation(self,e): victor@2: ''' victor@2: ########################## MENU ##################################### victor@2: open documentation web victor@2: ''' victor@2: webbrowser.open_new("..\\Documentation\\html\\index.html") victor@2: def OnUserManual(self,e): victor@2: ''' victor@2: ########################## MENU ##################################### victor@2: open user manual victor@2: ''' victor@2: webbrowser.open_new("..\\Documentation\\Manual.pdf") victor@2: def OnExit(self,e): victor@2: ''' victor@2: ########################## MENU ##################################### victor@2: exit menu option victor@2: ''' victor@2: self.Close(True) victor@2: victor@2: victor@2: victor@2: victor@2: app = wx.App(False) victor@2: frame = MainWindow(None, "Big Data Process") victor@2: app.MainLoop()