def handleNewFromTemplate(self, instr_templ=''): new_instr_req = self.view.showNewInstrFromTemplateDialog(os.path.join(self.state.getWorkDir(), os.path.basename(str(instr_templ)))) if new_instr_req != '': text = McGuiUtils.getFileContents(instr_templ) new_instr = McGuiUtils.saveInstrumentFile(new_instr_req, text) self.state.loadInstrument(new_instr) self.emitter.status("Instrument created: " + os.path.basename(str(new_instr)))
def handleSaveAs(self): oldinstr = self.state.getInstrumentFile() if oldinstr != '': newinstr = self.view.showSaveAsDialog(oldinstr) if newinstr != '': self.state.unloadInstrument() text = McGuiUtils.getFileContents(oldinstr) created_instr = McGuiUtils.saveInstrumentFile(newinstr, text) if created_instr != '': self.state.loadInstrument(created_instr) self.emitter.status("Instrument saved as: " + newinstr)