def act_open(e=None): # filename=QtGui.QFileDialog.getOpenFileNames(self,tr("Open Image"), "/home/jana", tr("Image Files (*.png *.jpg *.bmp)")) mwv = MainWinView() main_win = mwv.get_ui() filename = QtGui.QFileDialog.getOpenFileName(main_win, const.translate(const.DIALOG_TITLE_OPEN_FILE), const.PATH_HOME, const.DIALOG_FILTER_OPEN_FILE) if not filename: return 0 rpp_reader = RppReader(filename) d = RppImportDialog() d.move((AppView().desktop_width() - d.width()) * 0.5, (AppView().desktop_height() - d.height()) * 0.5) d.addSourceMIDIs(rpp_reader.getSourceMIDIList()) d.exec_() if not d.result(): return 0 name_SrcMIDI = d.getSelectSourceMIDIName() print name_SrcMIDI pr_model = PrModel() pr_model.set_jnote_lst(rpp_reader.getJNoteVOs(name_SrcMIDI)) pr_model.PPQ = rpp_reader.getPPQ() pr_model.tempo = rpp_reader.tempo #dispatch AppView().dispatch_event(events.JNOTES_CHANGED, pr_model.get_jnote_lst())
def test_open_rpp(self): v = VsqFile() r = RppReader('test/a.RPP') v = VsqFile() v.tempo = r.tempo v.lstJNote = r.getJNoteVOs('untitled MIDI item') v.buildVSQ() #test f = open('test/v.vsq', 'wb') f.write(v.getBytes()) f.close() self.assertEqual(v.getBytes(), not None)