def on_validate(self): min_value, flag0 = check_float(self.min_edit) max_value, flag1 = check_float(self.max_edit) if flag0 and flag1: self.out_data['min_clip'] = min(min_value, max_value) self.out_data['max_clip'] = max(min_value, max_value) self.out_data['clicked_ok'] = True return True return False
def on_validate(self): p1_cidi = self.p1_cid_pulldown.currentText() p2_cidi = self.p2_cid_pulldown.currentText() p3_cidi = self.p3_cid_pulldown.currentText() zaxis_cidi = self.zaxis_cid_pulldown.currentText() p1_cid = int(p1_cidi) if 'Global' not in p1_cidi else 0 p2_cid = int(p2_cidi) if 'Global' not in p2_cidi else 0 p3_cid = int(p3_cidi) if 'Global' not in p3_cidi else 0 zaxis_cid = int(zaxis_cidi) if 'Global' not in zaxis_cidi else 0 #print('p1_cidi=%r p2_cidi=%r p3_cidi=%r' % (p1_cidi, p2_cidi, zaxis_cidi)) #print('p2_cid=%r p2_cid=%r p3_cidi=%r' % (p2_cid, p2_cid, zaxis_cid)) p1_x, flag1 = check_float(self.p1_x_edit) p1_y, flag2 = check_float(self.p1_y_edit) p1_z, flag3 = check_float(self.p1_z_edit) p2_x, flag4 = check_float(self.p2_x_edit) p2_y, flag5 = check_float(self.p2_y_edit) p2_z, flag6 = check_float(self.p2_z_edit) p3_x, flag7 = check_float(self.p3_x_edit) p3_y, flag8 = check_float(self.p3_y_edit) p3_z, flag9 = check_float(self.p3_z_edit) p1 = [p1_x, p1_y, p1_z] p2 = [p2_x, p2_y, p2_z] p3 = [p3_x, p3_y, p3_z] flag10, flag11, flag12, zaxis_cid, zaxis = get_zaxis( self.win_parent, # for camera self.zaxis_method_pulldown, self.zaxis_x_edit, self.zaxis_y_edit, self.zaxis_z_edit) method = self.method_pulldown.currentText() assert method in self.methods, 'method=%r' % method flag13 = True plane_opacity = self.plane_opacity_edit.value() nplanes = self.nplanes_spinner.value() csv_filename = None flag14 = True if self.export_checkbox.isChecked(): csv_filename, flag14 = check_save_path(self.csv_edit) flags = [flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, flag9, flag10, flag11, flag12, flag13, flag14] if all(flags): self.out_data['method'] = method self.out_data['p1'] = [p1_cid, p1] self.out_data['p2'] = [p2_cid, p2] self.out_data['p3'] = [p3_cid, p3] self.out_data['zaxis'] = [zaxis_cid, zaxis] self.out_data['plane_color'] = self.plane_color_float self.out_data['plane_opacity'] = plane_opacity self.out_data['nplanes'] = nplanes self.out_data['csv_filename'] = csv_filename self.out_data['clicked_ok'] = True return True return False
def on_animate(self): """opens the animation window""" title, flag0 = check_name_str(self.title_edit) if not flag0: return scale, flag1 = check_float(self.scale_edit) if not flag1: scale = self._scale data = { 'font_size': self.out_data['font_size'], 'icase_fringe': self._icase_fringe, 'icase_disp': self._icase_disp, 'icase_vector': self._icase_vector, 'title': title, 'time': 2, 'frames/sec': 30, 'resolution': 1, 'iframe': 0, 'scale': scale, 'default_scale': self._default_scale, 'arrow_scale': scale, 'default_arrow_scale': self._default_arrow_scale, 'is_scale': self._default_phase is None, 'phase': self._phase, 'default_phase': self._default_phase, 'dirname': os.path.abspath(os.getcwd()), 'clicked_ok': False, 'close': False, } self.win_parent.legend_obj.set_animation_window(data)
def on_validate(self): p1_cidi = self.p1_cid_pulldown.currentText() p2_cidi = self.p2_cid_pulldown.currentText() zaxis_cidi = self.zaxis_cid_pulldown.currentText() p1_cid = int(p1_cidi) if 'Global' not in p1_cidi else 0 p2_cid = int(p2_cidi) if 'Global' not in p2_cidi else 0 zaxis_cid = int(zaxis_cidi) if 'Global' not in zaxis_cidi else 0 #print('p1_cidi=%r p2_cidi=%r p3_cidi=%r' % (p1_cidi, p2_cidi, zaxis_cidi)) #print('p2_cid=%r p2_cid=%r p3_cidi=%r' % (p2_cid, p2_cid, zaxis_cid)) p1_x, flag0 = check_float(self.p1_x_edit) p1_y, flag1 = check_float(self.p1_y_edit) p1_z, flag2 = check_float(self.p1_z_edit) p2_x, flag3 = check_float(self.p2_x_edit) p2_y, flag4 = check_float(self.p2_y_edit) p2_z, flag5 = check_float(self.p2_z_edit) p1 = [p1_x, p1_y, p1_z] p2 = [p2_x, p2_y, p2_z] flag6, flag7, flag8, zaxis_cid, zaxis = get_zaxis( self.win_parent, # for camera self.zaxis_method_pulldown, self.zaxis_x_edit, self.zaxis_y_edit, self.zaxis_z_edit) #print('zaxis =', zaxis) method = self.method_pulldown.currentText() assert method in self.methods, 'method=%r' % method flag9 = True ytol, flag10 = check_float(self.ytol_edit) zero_tol, flag11 = check_float(self.zero_tol_edit) csv_filename = None flag12 = True if self.export_checkbox.isChecked(): csv_filename, flag12 = check_save_path(self.csv_edit) flags = [ flag0, flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, flag9, flag10, flag11, flag12 ] if all(flags): self.out_data['method'] = method self.out_data['p1'] = [p1_cid, p1] self.out_data['p2'] = [p2_cid, p2] self.out_data['zaxis'] = [zaxis_cid, zaxis] self.out_data['ytol'] = ytol self.out_data['zero_tol'] = zero_tol self.out_data['plane_color'] = self.plane_color_float self.out_data['plane_opacity'] = 0.6 self.out_data['csv_filename'] = csv_filename self.out_data['clicked_ok'] = True return True return False
def on_validate(self, wipe=False): """checks to see if the input is valid""" # requires no special validation icase_fringe, flag0 = check_int(self.icase_fringe_edit) icase_disp, unused_flaga = check_int(self.icase_disp_edit) icase_vector, unused_flagb = check_int(self.icase_vector_edit) #icase_disp = self._icase_disp #icase_vector = self._icase_vector scale, flag1 = check_float(self.scale_edit) time, flag2 = check_float(self.time_edit) fps, flag3 = check_float(self.fps_edit) min_value = max_value = None flag4 = flag5 = True if self.min_value_edit.isEnabled(): min_value, flag4 = check_float(self.min_value_edit) if self.max_value_edit.isEnabled(): max_value, flag5 = check_float(self.max_value_edit) if wipe: animate_in_gui = False scale = 0. flag1 = True else: animate_in_gui = self.animate_in_gui_checkbox.isChecked() if scale == 0.0: self.scale_edit.setStyleSheet("QLineEdit{background: red;}") flag1 = False if animate_in_gui or wipe: passed = all([flag0, flag1, flag2, flag3, flag4, flag5]) magnify, output_dir, gifbase = None, None, None else: magnify, flag6 = check_int(self.resolution_edit) output_dir, flag7 = check_path(self.browse_folder_edit) gifbase, flag8 = check_name_str(self.gif_edit) passed = all([ flag0, flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8 ]) return passed, (icase_fringe, icase_disp, icase_vector, scale, time, fps, animate_in_gui, magnify, output_dir, gifbase, min_value, max_value)
def get_zaxis(win_parent, zaxis_method_pulldown, zaxis_x_edit, zaxis_y_edit, zaxis_z_edit): zaxis_method = str(zaxis_method_pulldown.currentText()) flag1, flag2, flag3 = True, True, True if zaxis_method == 'Global Z': zaxis = [0., 0., 1.] zaxis_cid = 0 elif zaxis_method == 'Manual': zaxis_x, flag1 = check_float(zaxis_x_edit) zaxis_y, flag2 = check_float(zaxis_y_edit) zaxis_z, flag3 = check_float(zaxis_z_edit) zaxis = [zaxis_x, zaxis_y, zaxis_z] elif zaxis_method == 'Camera Normal': if win_parent is not None: camera = win_parent.GetCamera() zaxis = camera.GetViewPlaneNormal() else: zaxis = [1., 1., 1.] zaxis_cid = 0 else: raise NotImplementedError(zaxis_method) return flag1, flag2, flag3, zaxis_cid, zaxis
def on_validate(self): """checks to see if the ``on_apply`` method can be called""" show_title = self._icase_fringe is not None flag_title = True title_value = '' if show_title: title_value, flag_title = check_name_str(self.title_edit) flag_fringe = True min_value = max_value = format_value = nlabels = ncolors = labelsize = colormap = None if self._icase_fringe is not None: min_value, flag1 = check_float(self.min_edit) max_value, flag2 = check_float(self.max_edit) format_value, flag3 = check_format(self.format_edit) nlabels, flag4 = check_positive_int_or_blank(self.nlabels_edit) ncolors, flag5 = check_positive_int_or_blank(self.ncolors_edit) labelsize, flag6 = check_positive_int_or_blank(self.labelsize_edit) colormap = str(self.colormap_edit.currentText()) if flag3 and 'i' in format_value: format_value = '%i' flag_fringe = all([flag1, flag2, flag3, flag4, flag5, flag6]) flag_disp = True scale = phase = None if self._icase_disp is not None: scale, flag1 = check_float(self.scale_edit) phase, flag2 = check_float(self.phase_edit) assert isinstance(scale, float), scale flag_disp = all([flag1, flag2]) flag_vector = True arrow_scale = None if self._icase_vector is not None: arrow_scale, flag_vector = check_float(self.arrow_scale_edit) if all([flag_title, flag_fringe, flag_disp, flag_vector]): self.out_data['title'] = title_value self.out_data['min_value'] = min_value self.out_data['max_value'] = max_value self.out_data['format'] = format_value self.out_data['scale'] = scale self.out_data['phase'] = phase self.out_data['arrow_scale'] = arrow_scale self.out_data['nlabels'] = nlabels self.out_data['ncolors'] = ncolors self.out_data['labelsize'] = labelsize self.out_data['colormap'] = colormap self.out_data['is_low_to_high'] = self.low_to_high_radio.isChecked( ) self.out_data['is_horizontal'] = self.horizontal_radio.isChecked() self.out_data['is_shown'] = self.show_radio.isChecked() self.out_data['clicked_ok'] = True self.out_data['close'] = True #print('self.out_data = ', self.out_data) #print("title = %r" % self.title_edit.text()) #print("min = %r" % self.min_edit.text()) #print("max = %r" % self.max_edit.text()) #print("format = %r" % self.format_edit.text()) return True return False
def on_validate(self): p1_cidi = self.p1_cid_pulldown.currentText() p2_cidi = self.p2_cid_pulldown.currentText() zaxis_cidi = self.zaxis_cid_pulldown.currentText() p1_cid = int(p1_cidi) if 'Global' not in p1_cidi else 0 p2_cid = int(p2_cidi) if 'Global' not in p2_cidi else 0 zaxis_cid = int(zaxis_cidi) if 'Global' not in zaxis_cidi else 0 #print('p1_cidi=%r p2_cidi=%r p3_cidi=%r' % (p1_cidi, p2_cidi, zaxis_cidi)) #print('p2_cid=%r p2_cid=%r p3_cidi=%r' % (p2_cid, p2_cid, zaxis_cid)) p1_x, flag0 = check_float(self.p1_x_edit) p1_y, flag1 = check_float(self.p1_y_edit) p1_z, flag2 = check_float(self.p1_z_edit) p2_x, flag3 = check_float(self.p2_x_edit) p2_y, flag4 = check_float(self.p2_y_edit) p2_z, flag5 = check_float(self.p2_z_edit) p1 = [p1_x, p1_y, p1_z] p2 = [p2_x, p2_y, p2_z] zaxis_method = str(self.zaxis_method_pulldown.currentText()) flag6, flag7, flag8 = True, True, True if zaxis_method == 'Global Z': zaxis = [0., 0., 1.] zaxis_cid = 0 elif zaxis_method == 'Manual': zaxis_x, flag6 = check_float(self.zaxis_x_edit) zaxis_y, flag7 = check_float(self.zaxis_y_edit) zaxis_z, flag8 = check_float(self.zaxis_z_edit) zaxis = [zaxis_x, zaxis_y, zaxis_z] elif zaxis_method == 'Camera Normal': if self.win_parent is not None: camera = self.win_parent.GetCamera() zaxis = camera.GetViewPlaneNormal() else: zaxis = [1., 1., 1.] zaxis_cid = 0 else: raise NotImplementedError(zaxis_method) #print('zaxis =', zaxis) method = self.method_pulldown.currentText() assert method in self.methods, 'method=%r' % method flag9 = True ytol, flag10 = check_float(self.ytol_edit) zero_tol, flag11 = check_float(self.zero_tol_edit) csv_filename = None flag12 = True if self.export_checkbox.isChecked(): csv_filename, flag12 = check_save_path(self.csv_edit) flags = [ flag0, flag1, flag2, flag3, flag4, flag5, flag6, flag7, flag8, flag9, flag10, flag11, flag12 ] if all(flags): self.out_data['method'] = method self.out_data['p1'] = [p1_cid, p1] self.out_data['p2'] = [p2_cid, p2] self.out_data['zaxis'] = [zaxis_method, zaxis_cid, zaxis] self.out_data['ytol'] = ytol self.out_data['zero_tol'] = zero_tol self.out_data['plane_color'] = self.plane_color_float self.out_data['plane_opacity'] = 0.6 self.out_data['csv_filename'] = csv_filename self.out_data['clicked_ok'] = True return True return False