def apply_post_proc(self): if self.post_proc_file is None: file_ = str(QtGui.QFileDialog.getOpenFileName(self, 'Open file', '', '*.py')) self.post_proc_file = file_.split('/')[-1] try: user_module = {} execfile(os.path.abspath(self.directory)+'/'+self.post_proc_file, user_module) self.post_proc = user_module['post_proc'] log_.message('function post_proc read from {}'.format(self.post_proc_file)) except: self.post_proc = None log_.warn('function post_proc NOT read from {}'.format(self.post_proc_file), calling = self.calling) if self.post_proc is not None: try: self.post_proc(self.fig) except: log_.warn('Error in {}'.format(self.post_proc_file), calling = self.calling)
def select_init(self, init_file_name=None): if init_file_name is None: self.init_file_name = str(QtGui.QFileDialog.getOpenFileName(self, 'Open file', '', '*init.py')) else: self.init_file_name = init_file_name if self.init_file_name: self.start_spectrum() self.do_save = False self.on_draw() self.do_save = True #self.lineIDs_GroupBox.setChecked(self.sp.get_conf('plot_ax2', True)) self.lineIDs_GroupBox.setChecked(False) self.residual_GroupBox.setChecked(self.sp.get_conf('plot_ax3', True)) self.restore_axes() else: if self.sp is None: raise ValueError('A filename must be given') else: log_.warn('A filename must be given', calling=self.calling) return