def SaveWorldFile(self, dummy): if self.isRunning: return txt = self.WorldDisplay.UpdateEditor() savedFileName = dialogs.checkedSaveDialog(txt, _("Save new world as"), _("World files (*.wld)|*.wld| All files (*.*)|*.*"), self.world_filename, settings.USER_WORLDS_DIR) self.world_filename = savedFileName arg = self.status_bar.world_field, \ os.path.basename(self.world_filename) event_manager.SendCustomEvent(self, arg) settings.SAMPLE_WORLDS_DIR = os.path.dirname(self.world_filename) # save a backup copy to 'reset world' self.backup_dict = {} exec txt in self.backup_dict
def SaveWorldFile(self, dummy): if self.isRunning: return txt = self.WorldDisplay.UpdateEditor() savedFileName = dialogs.checkedSaveDialog( txt, _("Save new world as"), _("World files (*.wld)|*.wld| All files (*.*)|*.*"), self.world_filename, settings.USER_WORLDS_DIR) self.world_filename = savedFileName arg = self.status_bar.world_field, \ os.path.basename(self.world_filename) event_manager.SendCustomEvent(self, arg) settings.SAMPLE_WORLDS_DIR = os.path.dirname(self.world_filename) # save a backup copy to 'reset world' self.backup_dict = {} exec txt in self.backup_dict
def SaveProgramFile(self, dummy): if self.isRunning: return global code code = self.ProgramEditor.GetText() no_error, mesg = parser.ParseProgram(code) if no_error: savedFileName = savedFileName = dialogs.checkedSaveDialog( code, _("Save new program as"), _("Program files (*.rur)|*.rur| All files (*.*)|*.*"), self.filename, settings.USER_PROGS_DIR) self.filename = savedFileName arg = self.status_bar.program_field, \ os.path.basename(self.filename) event_manager.SendCustomEvent(self, arg) settings.USER_PROGS_DIR = os.path.dirname(self.filename) self.ProgramEditor.SetSavePoint() else: code = "" dialogs.messageDialog(mesg, _("Program will not be saved."))