def reset_run(self, ui_info = None): '''Save the model into associated pickle file. The source DAT file is unaffected. ''' answer = confirm(self._ui_info.ui.control, 'Really reset? Changes will be lost!', title = 'Reset confirmation', cancel = False, default = YES) if answer == YES: # ask whether the modified run should be saved # self.load_run(ui_info) self.redraw() self.model.unsaved = False
def new_study( self, ui_info ): if ui_info.object.dirty: # discard / save dialog answer = confirm( ui_info.ui.control, 'Study modified. Save it?', title = 'New study', cancel = False, default = YES ) if answer == YES: self.save_study( ui_info ) ui_info.object.file_path = '' ui_info.object.new() self._set_title_string(ui_info)
def new_study(self, ui_info): if ui_info.object.dirty: # discard / save dialog answer = confirm(ui_info.ui.control, 'Study modified. Save it?', title='New study', cancel=False, default=YES) if answer == YES: self.save_study(ui_info) ui_info.object.file_path = '' ui_info.object.new() self._set_title_string(ui_info)
def open_study(self, ui_info): if ui_info.object.dirty: # discard / save dialog answer = confirm( ui_info.ui.control, 'Study modified. Save it?', title = 'Open study', cancel = True, default = YES ) if answer == YES: self.save_study( ui_info ) elif answer == CANCEL: return file_name = open_file( filter = ['*.pst'], extensions = [FileInfo(), TextInfo()] ) if file_name != '': ui_info.object.load( file_name ) ui_info.object.file_path = file_name self._set_title_string(ui_info)
def exit_study(self, ui_info): if ui_info.object.dirty: # discard / save dialog answer = confirm( ui_info.ui.control, 'Save study before exiting?', title = 'Close study', cancel = True, default = YES ) if answer == YES: self.save_study( ui_info ) self._on_close( ui_info ) return True elif answer == NO: self._on_close( ui_info ) return True else: return False else: self._on_close( ui_info ) return True
def open_study(self, ui_info): if ui_info.object.dirty: # discard / save dialog answer = confirm(ui_info.ui.control, 'Study modified. Save it?', title='Open study', cancel=True, default=YES) if answer == YES: self.save_study(ui_info) elif answer == CANCEL: return file_name = open_file(filter=['*.pst'], extensions=[FileInfo(), TextInfo()]) if file_name != '': ui_info.object.load(file_name) ui_info.object.file_path = file_name self._set_title_string(ui_info)
def _reset_model(self, obj, name, old, new): print 'RESET MODEL' model = self.model if model: # check if the model was changed and ask if it is to be saved # if model.unsaved: answer = confirm(self._ui_info.ui.control, 'Run changed, save it?', title = 'Save confirmation', cancel = False, default = YES) if answer == YES: # ask whether the modified run should be saved # self.save_run() self.model.unsaved = False self.load_run() self._reset_plot_template_list() self.redraw()
def exit_study(self, ui_info): if ui_info.object.dirty: # discard / save dialog answer = confirm(ui_info.ui.control, 'Save study before exiting?', title='Close study', cancel=True, default=YES) if answer == YES: self.save_study(ui_info) self._on_close(ui_info) return True elif answer == NO: self._on_close(ui_info) return True else: return False else: self._on_close(ui_info) return True