예제 #1
0
    def onQuit(self, event):
        ok = True
        msg = "Do you want to save the current state of the module?"
        dlg = wx.MessageDialog(self, msg, "Quit Cecilia5...", style=wx.YES_NO | wx.CANCEL | wx.STAY_ON_TOP)
        ret = dlg.ShowModal()
        if ret == wx.ID_YES:
            CeciliaLib.saveCeciliaFile(self, showDialog=False)
        elif ret == wx.ID_CANCEL:
            ok = False
        dlg.Destroy()
        if not ok:
            return

        if not CeciliaLib.closeCeciliaFile(self):
            return
        try:
            self.prefs.onClose(event)
        except:
            pass
        if CeciliaLib.getVar("audioServer").isAudioServerRunning():
            CeciliaLib.getVar("audioServer").stop()
            time.sleep(.2)
        if CeciliaLib.getVar('spectrumFrame') is not None:
            try:
                CeciliaLib.getVar('spectrumFrame')._destroy(None)
            except:
                pass
            finally:
                CeciliaLib.setVar('spectrumFrame', None)
        self.api_doc_frame.Destroy()
        self.mod_doc_frame.Destroy()
        self.closeInterface()
        CeciliaLib.writeVarToDisk()
        self.Destroy()
예제 #2
0
파일: Preset.py 프로젝트: wxthon/cecilia5
    def onSavePreset(self):
        dlg = wx.TextEntryDialog(self, 'Enter preset name:', 'Saving Preset', self.currentPreset)

        if dlg.ShowModal() == wx.ID_OK:
            newPreset = CeciliaLib.ensureNFD(dlg.GetValue())
        else:
            newPreset = ''
        dlg.Destroy()

        if newPreset == '':
            CeciliaLib.showErrorDialog('Failed saving preset', 'You must give a name to your preset!')
            return
        if newPreset == 'init':
            CeciliaLib.showErrorDialog('Failed saving preset', '"init" is reserved. You must give another name to your preset!')
            return
        ok = True
        if newPreset in CeciliaLib.getVar("presets").keys():
            dlg2 = wx.MessageDialog(self, 'The preset you entered already exists. Are you sure you want to overwrite it?',
                                    'Existing preset!', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
            if dlg2.ShowModal() == wx.ID_NO:
                ok = False
            dlg2.Destroy()

        if ok:
            self.currentPreset = newPreset
            CeciliaLib.savePresetToDict(self.currentPreset)
            self.presetChoice.setChoice(self.orderingPresetNames(), False)
            self.presetChoice.setStringSelection(self.currentPreset)
            CeciliaLib.saveCeciliaFile(self, showDialog=False)
예제 #3
0
파일: Preset.py 프로젝트: wxthon/cecilia5
    def onDeletePreset(self):
        if self.currentPreset in CeciliaLib.getVar("presets"):
            dlg = wx.MessageDialog(self,
                                    'Preset %s will be deleted. Are you sure?' % self.currentPreset,
                                    'Warning!', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION)
            if dlg.ShowModal() == wx.ID_NO:
                ok = False
            else:
                ok = True
            dlg.Destroy()

            if ok:
                CeciliaLib.deletePreset(self.currentPreset)
                self.presetChoice.setChoice(self.orderingPresetNames(), False)
                self.presetChoice.setStringSelection("")
                CeciliaLib.saveCeciliaFile(self, showDialog=False)
예제 #4
0
 def onSaveAs(self, event):
     CeciliaLib.saveCeciliaFile(self)
     self.updateTitle()
예제 #5
0
 def onSave(self, event):
     CeciliaLib.saveCeciliaFile(self, showDialog=False)
     self.updateTitle()