From 8b35110bb290e069edb0e6a0fd8ce9361e81da76 Mon Sep 17 00:00:00 2001 From: SteveDoyle2 Date: Sun, 1 Dec 2024 19:57:18 -0800 Subject: [PATCH] gui: - displacement result can now do a phase sweep (same as sinusoidal, but it was annoying) - starting filter_value (currently hidden) --- .../result_objects/displacement_results.py | 20 +- .../converters/nastran/test_nastran_gui.py | 2 + pyNastran/gui/menus/legend/legend_object.py | 44 ++-- pyNastran/gui/menus/legend/qt_legend.py | 231 +++++++++--------- pyNastran/gui/qt_files/gui_attributes.py | 4 +- pyNastran/gui/qt_files/gui_qt_common.py | 16 +- pyNastran/gui/testing_methods.py | 3 +- 7 files changed, 177 insertions(+), 143 deletions(-) diff --git a/pyNastran/converters/nastran/gui/result_objects/displacement_results.py b/pyNastran/converters/nastran/gui/result_objects/displacement_results.py index 065baf7be..3327e9c42 100644 --- a/pyNastran/converters/nastran/gui/result_objects/displacement_results.py +++ b/pyNastran/converters/nastran/gui/result_objects/displacement_results.py @@ -177,14 +177,11 @@ def get_vector_result_by_scale_phase(self, itime: int, res_name: str, """ assert self.dim == 3, self.dim assert len(self.xyz.shape) == 2, self.xyz.shape - if self.is_real: - dxyz, *unused_junk = self.get_vector_data_dense(itime, res_name) - deflected_xyz = self.xyz + scale * dxyz - else: - assert isinstance(itime, int), (itime, phase) - assert isinstance(phase, float), (itime, phase) - dxyz = self._get_complex_displacements_by_phase(itime, res_name, phase) - deflected_xyz = self.xyz + scale * dxyz + + assert isinstance(itime, int), (itime, phase) + assert isinstance(phase, float), (itime, phase) + dxyz = self._get_complex_displacements_by_phase(itime, res_name, phase) + deflected_xyz = self.xyz + scale * dxyz assert len(deflected_xyz.shape) == 2, deflected_xyz.shape return self.xyz, deflected_xyz @@ -199,8 +196,11 @@ def _get_complex_displacements_by_phase(self, itime: int, res_name: str, assert dxyz.ndim == 2, dxyz theta = np.radians(phase) - dxyz = dxyz.real * np.cos(theta) + dxyz.imag * np.sin(theta) - return dxyz + if self.is_real: + dxyz_out = dxyz * np.cos(theta) + else: + dxyz_out = dxyz.real * np.cos(theta) + dxyz.imag * np.sin(theta) + return dxyz_out def __repr__(self) -> str: """defines str(self)""" diff --git a/pyNastran/converters/nastran/test_nastran_gui.py b/pyNastran/converters/nastran/test_nastran_gui.py index 307e92521..4c6b82ef0 100644 --- a/pyNastran/converters/nastran/test_nastran_gui.py +++ b/pyNastran/converters/nastran/test_nastran_gui.py @@ -482,6 +482,7 @@ def test_solid_shell_bar_02(self): test.on_rcycle_results() test.on_update_legend( title='Title', min_value=0., max_value=1., + filter_value=1., scale=0.0, phase=0.0, arrow_scale=1., data_format='%.0f', @@ -490,6 +491,7 @@ def test_solid_shell_bar_02(self): is_shown=True, render=True) test.on_update_legend( title='Title', min_value=0., max_value=1., + filter_value=None, scale=0.0, phase=0.0, arrow_scale=1., data_format='%.0f', diff --git a/pyNastran/gui/menus/legend/legend_object.py b/pyNastran/gui/menus/legend/legend_object.py index 6d945da7c..15ea59216 100644 --- a/pyNastran/gui/menus/legend/legend_object.py +++ b/pyNastran/gui/menus/legend/legend_object.py @@ -76,8 +76,9 @@ def set_legend_menu(self): (is_method_array, legend_title, scalar_bar, defaults_scalar_bar, data_format, default_format, - default_title, min_value, max_value, - default_min, default_max) = self.get_legend_fringe(gui.icase_fringe) + default_title, min_value, max_value, filter_value, + default_min, default_max, default_filter_value, + ) = self.get_legend_fringe(gui.icase_fringe) nlabels, labelsize, ncolors, colormap = scalar_bar default_nlabels, default_labelsize, default_ncolors, default_colormap = defaults_scalar_bar @@ -90,7 +91,6 @@ def set_legend_menu(self): #arrow_scale = None #default_arrow_scale = None - data = { 'font_size' : self.settings.font_size, #'icase' : self.icase, @@ -100,14 +100,16 @@ def set_legend_menu(self): 'title' : legend_title, 'min_value' : min_value, 'max_value' : max_value, + 'filter_value': filter_value, 'scale' : scale, 'arrow_scale' : arrow_scale, 'phase' : phase, 'format' : data_format, - 'default_min' : default_min, - 'default_max' : default_max, + 'default_min': default_min, + 'default_max': default_max, + 'default_filter_value': default_filter_value, 'default_title' : default_title, 'default_scale' : default_scale, 'default_arrow_scale' : default_arrow_scale, @@ -161,8 +163,9 @@ def set_animation_menu(self) -> None: (is_method_array, legend_title, scalar_bar, defaults_scalar_bar, data_format, default_format, - default_title, min_value, max_value, - default_min, default_max) = self.get_legend_fringe(gui.icase_fringe) + default_title, min_value, max_value, filter_value, + default_min, default_max, default_filter_value, + ) = self.get_legend_fringe(gui.icase_fringe) # set the title as the default if is_method_array and legend_title == default_title: @@ -230,6 +233,7 @@ def update_legend(self, title: str, min_value: Optional[float], max_value: Optional[float], + filter_value: Optional[float], data_format: str, scale: Optional[float], phase: Optional[float], @@ -304,8 +308,8 @@ def update_legend(self, is_method_array, _legend_title, scalar_bar, defaults_scalar_bar, data_format, default_format, default_title, - _min_value, _max_value, - default_min, default_max) = out + _min_value, _max_value, _filter_value, + default_min, default_max, default_filter_value) = out if is_method_array and title == default_title: title = '' @@ -314,6 +318,7 @@ def update_legend(self, if use_fringe_internal: min_value = _min_value max_value = _max_value + filter_value = _filter_value unused_legend_title = _legend_title labelsize = _labelsize ncolors = _ncolors @@ -350,7 +355,6 @@ def update_legend(self, #default_scale = _default_scale #default_phase = _default_phase - _arrow_scale, default_arrow_scale = self.get_legend_vector(icase_vector) if use_vector_internal: arrow_scale = _arrow_scale @@ -359,12 +363,14 @@ def update_legend(self, #assert isinstance(scale, float), 'scale=%s' % scale self._legend_window.update_legend( icase_fringe, icase_disp, icase_vector, - title, min_value, max_value, data_format, + title, min_value, max_value, filter_value, + data_format, nlabels, labelsize, ncolors, colormap, is_fringe, scale, phase, arrow_scale, - default_title, default_min, default_max, default_format, + default_title, default_min, default_max, default_filter_value, + default_format, default_nlabels, default_labelsize, default_ncolors, default_colormap, default_scale, default_phase, @@ -378,6 +384,7 @@ def apply_legend(self, data: dict[str, Any]) -> None: title = data['title'] min_value = data['min_value'] max_value = data['max_value'] + filter_value = data['filter_value'] scale = data['scale'] phase = data['phase'] arrow_scale = data['arrow_scale'] @@ -395,6 +402,7 @@ def apply_legend(self, data: dict[str, Any]) -> None: self.on_update_legend( title=title, min_value=min_value, max_value=max_value, + filter_value=filter_value, scale=scale, phase=phase, arrow_scale=arrow_scale, data_format=data_format, @@ -409,6 +417,7 @@ def on_update_legend(self, title: str='Title', min_value: float=0., max_value: float=1., + filter_value: Optional[float]=None, scale: float=0.0, phase: float=0.0, arrow_scale: float=1., @@ -430,6 +439,7 @@ def on_update_legend(self, TODO: speed up by using existing values to skip update steps """ + assert isinstance(title, str), title nlabels = None if nlabels == -1 else nlabels labelsize = None if labelsize == -1 else labelsize ncolors = None if ncolors == -1 else ncolors @@ -568,7 +578,8 @@ def on_update_legend(self, gui.Render() msg = ( - f'self.on_update_legend(title={title!r}, min_value={min_value}, max_value={max_value},\n' + f'self.on_update_legend(title={title!r}, ' + f'min_value={min_value}, max_value={max_value}, filter_value={filter_value},\n' f' scale={scale}, phase={phase},\n' f' data_format={data_format!r}, is_low_to_high={is_low_to_high}, ' f'is_discrete={is_discrete},\n' @@ -590,6 +601,7 @@ def get_legend_fringe(self, icase_fringe: Optional[int]) -> tuple: legend_title = None min_value = None max_value = None + filter_value = None data_format = None scalar_bar = (None, None, None, None) defaults_scalar_bar = (None, None, None, None) @@ -624,13 +636,15 @@ def get_legend_fringe(self, icase_fringe: Optional[int]) -> tuple: default_min, default_max = obj.get_default_min_max(i, res_name) default_format = obj.get_default_data_format(i, res_name) + filter_value = None + default_filter_value = None out = ( is_method_array, legend_title, scalar_bar, defaults_scalar_bar, data_format, default_format, - default_title, min_value, max_value, - default_min, default_max) + default_title, min_value, max_value, filter_value, + default_min, default_max, default_filter_value) return out def get_legend_disp(self, icase_disp: Optional[int], diff --git a/pyNastran/gui/menus/legend/qt_legend.py b/pyNastran/gui/menus/legend/qt_legend.py index b79225812..3cd96efab 100644 --- a/pyNastran/gui/menus/legend/qt_legend.py +++ b/pyNastran/gui/menus/legend/qt_legend.py @@ -5,7 +5,7 @@ """ from __future__ import annotations import os -from typing import TYPE_CHECKING +from typing import Optional, TYPE_CHECKING from qtpy import QtCore from qtpy.QtGui import QFont @@ -57,7 +57,9 @@ class LegendPropertiesWindow(PyDialog): +-----------------------+ """ - def __init__(self, data, win_parent=None, show_animation_button=True): + def __init__(self, data: dict[str, Any], + win_parent=None, + show_animation_button: bool=True): PyDialog.__init__(self, data, win_parent) self.is_gui = win_parent is not None @@ -82,6 +84,7 @@ def __init__(self, data, win_parent=None, show_animation_button=True): self._default_title = data['title'] self._default_min = data['min_value'] self._default_max = data['max_value'] + self._default_filter_value = data['filter_value'] self._default_scale = data['default_scale'] self._scale = data['scale'] @@ -147,9 +150,14 @@ def _update_defaults_to_blank(self): if self._nlabels in {None, -1}: self._nlabels = '' - def update_legend(self, icase_fringe, icase_disp, icase_vector, + def update_legend(self, + icase_fringe: int, + icase_disp: int, + icase_vector: int, title: str, - min_value, max_value, data_format: str, + min_value: float, max_value: float, + filter_value: Optional[float], + data_format: str, nlabels: int, labelsize: int, ncolors: int, colormap: str, is_fringe: bool, @@ -158,6 +166,7 @@ def update_legend(self, icase_fringe, icase_disp, icase_vector, default_title: str, default_min_value, default_max_value, + default_filter_value: Optional[float], default_data_format: str, default_nlabels: int, default_labelsize: int, default_ncolors: int, default_colormap: str, @@ -222,6 +231,7 @@ def update_legend(self, icase_fringe, icase_disp, icase_vector, self._default_title = default_title self._default_min = default_min_value self._default_max = default_max_value + self._default_filter_value = default_filter_value self._default_format = default_data_format #self._default_is_low_to_high = is_low_to_high self._default_is_discrete = True @@ -296,6 +306,9 @@ def update_legend(self, icase_fringe, icase_disp, icase_vector, self.max_edit.setText(func_str_or_none(max_value)) self.max_edit.setStyleSheet(QLINEEDIT_GOOD) + self.filter_value_edit.setText(func_str_or_none(filter_value)) + self.filter_value_edit.setStyleSheet(QLINEEDIT_GOOD) + self.format_edit.setText(str(data_format)) self.format_edit.setStyleSheet(QLINEEDIT_GOOD) @@ -363,38 +376,19 @@ def _set_legend_fringe(self, is_fringe: bool) -> None: self.title_edit.setVisible(show_title) self.title_button.setVisible(show_title) - self.max_label.setVisible(enable) - self.min_label.setVisible(enable) - self.max_edit.setVisible(enable) - self.min_edit.setVisible(enable) - self.max_button.setVisible(enable) - self.min_button.setVisible(enable) - - self.show_radio.setVisible(enable) - self.hide_radio.setVisible(enable) - self.low_to_high_radio.setVisible(enable) - self.high_to_low_radio.setVisible(enable) - - self.format_label.setVisible(enable) - self.format_edit.setVisible(enable) - self.format_edit.setVisible(enable) - self.format_button.setVisible(enable) - - self.nlabels_label.setVisible(enable) - self.nlabels_edit.setVisible(enable) - self.nlabels_button.setVisible(enable) - - self.ncolors_label.setVisible(enable) - self.ncolors_edit.setVisible(enable) - self.ncolors_button.setVisible(enable) - - self.grid2_title.setVisible(enable) - self.vertical_radio.setVisible(enable) - self.horizontal_radio.setVisible(enable) - - self.colormap_label.setVisible(enable) - self.colormap_edit.setVisible(enable) - self.colormap_button.setVisible(enable) + objs = [ + self.max_label, self.max_edit, self.max_button, + self.min_label, self.min_edit, self.min_button, + self.show_radio, self.hide_radio, + self.low_to_high_radio, self.high_to_low_radio, + self.format_label, self.format_edit, self.format_button, + self.nlabels_label, self.nlabels_edit, self.nlabels_button, + self.ncolors_label, self.ncolors_edit, self.ncolors_button, + self.grid2_title, self.vertical_radio, self.horizontal_radio, + self.colormap_label, self.colormap_edit, self.colormap_button, + ] + for obj in objs: + obj.setVisible(enable) def create_widgets(self, show_animation_button: bool=True) -> None: """creates the menu objects""" @@ -413,6 +407,13 @@ def create_widgets(self, show_animation_button: bool=True) -> None: self.max_edit = QFloatEdit(func_str_or_none(self._default_max)) self.max_button = QPushButton("Default") + # Filter + self.filter_value_label = QLabel("Filter:") + self.filter_value_edit = QFloatEdit(func_str_or_none(self._default_max)) + self.filter_value_button = QPushButton("Default") + for obj in [self.filter_value_label, self.filter_value_edit, self.filter_value_button]: + obj.setVisible(False) + #--------------------------------------- # Format self.format_label = QLabel("Format (e.g. %.3f, %g, %.6e):") @@ -516,36 +517,19 @@ def create_widgets(self, show_animation_button: bool=True) -> None: self.title_button.setVisible(False) if not self._is_fringe: - self.max_label.hide() - self.min_label.hide() - self.max_edit.hide() - self.min_edit.hide() - self.max_button.hide() - self.min_button.hide() - - self.format_label.hide() - self.format_edit.hide() - self.format_button.hide() - - self.nlabels_label.hide() - self.nlabels_edit.hide() - self.nlabels_button.hide() - - self.ncolors_label.hide() - self.ncolors_edit.hide() - self.ncolors_button.hide() - - self.grid2_title.hide() - self.vertical_radio.hide() - self.horizontal_radio.hide() - self.show_radio.hide() - self.hide_radio.hide() - self.low_to_high_radio.hide() - self.high_to_low_radio.hide() - - self.colormap_label.hide() - self.colormap_edit.hide() - self.colormap_button.hide() + objs = [ + self.max_label, self.max_edit, self.max_button, + self.min_label, self.min_edit, self.min_button, + self.show_radio, self.hide_radio, + self.low_to_high_radio, self.high_to_low_radio, + self.format_label, self.format_edit, self.format_button, + self.nlabels_label, self.nlabels_edit, self.nlabels_button, + self.ncolors_label, self.ncolors_edit, self.ncolors_button, + self.grid2_title, self.vertical_radio, self.horizontal_radio, + self.colormap_label, self.colormap_edit, self.colormap_button, + ] + for obj in objs: + obj.hide() self.animate_button = QPushButton('Create Animation') self.animate_button.setVisible(show_animation_button) @@ -566,49 +550,66 @@ def create_widgets(self, show_animation_button: bool=True) -> None: def create_layout(self) -> None: """displays the menu objects""" grid = QGridLayout() - grid.addWidget(self.title_label, 0, 0) - grid.addWidget(self.title_edit, 0, 1) - grid.addWidget(self.title_button, 0, 2) - - grid.addWidget(self.min_label, 1, 0) - grid.addWidget(self.min_edit, 1, 1) - grid.addWidget(self.min_button, 1, 2) - - grid.addWidget(self.max_label, 2, 0) - grid.addWidget(self.max_edit, 2, 1) - grid.addWidget(self.max_button, 2, 2) - - grid.addWidget(self.format_label, 3, 0) - grid.addWidget(self.format_edit, 3, 1) - grid.addWidget(self.format_button, 3, 2) - - grid.addWidget(self.scale_label, 4, 0) - grid.addWidget(self.scale_edit, 4, 1) - grid.addWidget(self.scale_button, 4, 2) - - grid.addWidget(self.phase_label, 6, 0) - grid.addWidget(self.phase_edit, 6, 1) - grid.addWidget(self.phase_button, 6, 2) - - grid.addWidget(self.arrow_scale_label, 5, 0) - grid.addWidget(self.arrow_scale_edit, 5, 1) - grid.addWidget(self.arrow_scale_button, 5, 2) - - grid.addWidget(self.nlabels_label, 7, 0) - grid.addWidget(self.nlabels_edit, 7, 1) - grid.addWidget(self.nlabels_button, 7, 2) + irow = 0 + grid.addWidget(self.title_label, irow, 0) + grid.addWidget(self.title_edit, irow, 1) + grid.addWidget(self.title_button, irow, 2) + irow += 1 + + grid.addWidget(self.min_label, irow, 0) + grid.addWidget(self.min_edit, irow, 1) + grid.addWidget(self.min_button, irow, 2) + irow += 1 + + grid.addWidget(self.max_label, irow, 0) + grid.addWidget(self.max_edit, irow, 1) + grid.addWidget(self.max_button, irow, 2) + irow += 1 + + grid.addWidget(self.filter_value_label, irow, 0) + grid.addWidget(self.filter_value_edit, irow, 1) + grid.addWidget(self.filter_value_button, irow, 2) + irow += 1 + + grid.addWidget(self.format_label, irow, 0) + grid.addWidget(self.format_edit, irow, 1) + grid.addWidget(self.format_button, irow, 2) + irow += 1 + + grid.addWidget(self.scale_label, irow, 0) + grid.addWidget(self.scale_edit, irow, 1) + grid.addWidget(self.scale_button, irow, 2) + irow += 1 + + grid.addWidget(self.phase_label, irow, 0) + grid.addWidget(self.phase_edit, irow, 1) + grid.addWidget(self.phase_button, irow, 2) + irow += 1 + + grid.addWidget(self.arrow_scale_label, irow, 0) + grid.addWidget(self.arrow_scale_edit, irow, 1) + grid.addWidget(self.arrow_scale_button, irow, 2) + irow += 1 + + grid.addWidget(self.nlabels_label, irow, 0) + grid.addWidget(self.nlabels_edit, irow, 1) + grid.addWidget(self.nlabels_button, irow, 2) + irow += 1 #grid.addWidget(self.labelsize_label, 6, 0) #grid.addWidget(self.labelsize_edit, 6, 1) #grid.addWidget(self.labelsize_button, 6, 2) + #irow += 1 - grid.addWidget(self.ncolors_label, 8, 0) - grid.addWidget(self.ncolors_edit, 8, 1) - grid.addWidget(self.ncolors_button, 8, 2) + grid.addWidget(self.ncolors_label, irow, 0) + grid.addWidget(self.ncolors_edit, irow, 1) + grid.addWidget(self.ncolors_button, irow, 2) + irow += 1 - grid.addWidget(self.colormap_label, 9, 0) - grid.addWidget(self.colormap_edit, 9, 1) - grid.addWidget(self.colormap_button, 9, 2) + grid.addWidget(self.colormap_label, irow, 0) + grid.addWidget(self.colormap_edit, irow, 1) + grid.addWidget(self.colormap_button, irow, 2) + irow += 1 ok_cancel_box = QHBoxLayout() ok_cancel_box.addWidget(self.apply_button) @@ -629,7 +630,6 @@ def create_layout(self) -> None: grid2.addWidget(self.animate_button, 3, 1) - #grid2.setSpacing(0) vbox = QVBoxLayout() @@ -646,6 +646,7 @@ def set_connections(self) -> None: self.title_button.clicked.connect(self.on_default_title) self.min_button.clicked.connect(self.on_default_min) self.max_button.clicked.connect(self.on_default_max) + self.filter_value_button.clicked.connect(self.on_default_filter_value) self.format_button.clicked.connect(self.on_default_format) self.scale_button.clicked.connect(self.on_default_scale) self.arrow_scale_button.clicked.connect(self.on_default_arrow_scale) @@ -740,6 +741,11 @@ def on_default_max(self): self.max_edit.setText(func_str_or_none(self._default_max)) self.max_edit.setStyleSheet(QLINEEDIT_GOOD) + def on_default_filter_value(self): + """action when user clicks 'Default' for filter value""" + self.filter_value_edit.setText(func_str_or_none(self._default_filter_value)) + self.filter_value_edit.setStyleSheet(QLINEEDIT_GOOD) + def on_default_format(self): """action when user clicks 'Default' for the number format""" self.format_edit.setText(func_str_or_none(self._default_format)) @@ -794,22 +800,22 @@ def on_show_hide(self): self.vertical_radio.setEnabled(is_shown) self.horizontal_radio.setEnabled(is_shown) - def show_legend(self): + def show_legend(self) -> None: """shows the legend""" self._set_legend(True) - def hide_legend(self): + def hide_legend(self) -> None: """hides the legend""" self._set_legend(False) - def _set_legend(self, is_shown): + def _set_legend(self, is_shown: bool) -> None: """shows/hides the legend""" self.show_radio.setChecked(is_shown) self.hide_radio.setChecked(not is_shown) #if self.is_gui: #self.win_parent.scalar_bar_actor.SetVisibility(is_shown) - def on_validate(self): + def on_validate(self) -> bool: """checks to see if the ``on_apply`` method can be called""" show_title = self._icase_fringe is not None flag_title = True @@ -823,14 +829,15 @@ def on_validate(self): 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) + filter_value, flag3 = check_float(self.filter_value_edit) + format_value, flag_fmt = 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: + if flag_fmt and 'i' in format_value: format_value = '%i' - flag_fringe = all([flag1, flag2, flag3, flag4, flag5, flag6]) + flag_fringe = all([flag1, flag2, flag3, flag4, flag5, flag6, flag_fmt]) flag_disp = True scale = phase = None @@ -849,6 +856,7 @@ def on_validate(self): self.out_data['title'] = title_value self.out_data['min_value'] = min_value self.out_data['max_value'] = max_value + self.out_data['filter_value'] = filter_value self.out_data['format'] = format_value self.out_data['scale'] = scale self.out_data['phase'] = phase @@ -936,6 +944,7 @@ def main(): # pragma: no cover 'title' : 'asdf', 'min_value' : 0., 'max_value' : 10, + 'filter_value': None, 'scale' : 1e-12, 'default_scale' : 1.0, diff --git a/pyNastran/gui/qt_files/gui_attributes.py b/pyNastran/gui/qt_files/gui_attributes.py index abdbc9b01..cfd3b60f5 100644 --- a/pyNastran/gui/qt_files/gui_attributes.py +++ b/pyNastran/gui/qt_files/gui_attributes.py @@ -846,7 +846,8 @@ def _set_legend_fringe(self, is_fringe) -> None: def on_update_legend(self, title: str='Title', - min_value: float=0., max_value: float=1., + min_value: float=0.0, max_value: float=1.0, + filter_value: Optional[float]=None, scale: float=0.0, phase: float=0.0, arrow_scale: float=1., data_format: str='%.0f', @@ -871,6 +872,7 @@ def on_update_legend(self, """ self.legend_obj.on_update_legend( title=title, min_value=min_value, max_value=max_value, + filter_value=filter_value, scale=scale, phase=phase, arrow_scale=arrow_scale, data_format=data_format, diff --git a/pyNastran/gui/qt_files/gui_qt_common.py b/pyNastran/gui/qt_files/gui_qt_common.py index df0a2be9d..9a4453de6 100644 --- a/pyNastran/gui/qt_files/gui_qt_common.py +++ b/pyNastran/gui/qt_files/gui_qt_common.py @@ -528,7 +528,6 @@ def on_fringe(self, icase: int, location = data.location min_value = data.min_value max_value = data.max_value - #norm_value = data.norm_value data_format = data.data_format scale = data.scale methods = data.methods @@ -570,9 +569,11 @@ def on_fringe(self, icase: int, phase = 0.0 arrow_scale = 0.0 if update_legend_window: + filter_value = None self.legend_obj.update_legend( icase_fringe, icase_disp, icase_vector, - legend_title, min_value, max_value, data_format, scale, phase, + legend_title, min_value, max_value, filter_value, + data_format, scale, phase, arrow_scale, nlabels, labelsize, ncolors, colormap, use_disp_internal=True, use_vector_internal=True) @@ -809,9 +810,11 @@ def _on_disp_vector(self, icase: int, phase = None arrow_scale = None if update_legend_window: + filter_value = None self.legend_obj.update_legend( icase_fringe, icase_disp, icase_vector, - legend_title, min_value, max_value, data_format, scale, phase, + legend_title, min_value, max_value, filter_value, + data_format, scale, phase, arrow_scale, nlabels, labelsize, ncolors, colormap, use_fringe_internal=True, use_disp_internal=True, use_vector_internal=True, @@ -1210,9 +1213,11 @@ def _set_case(self, unused_result_name, icase: int, imax=imax, max_value=max_value, ) + filter_value = None self.legend_obj.update_legend( icase_fringe, icase_disp, icase_vector, - legend_title, min_value, max_value, data_format, scale, phase, + legend_title, min_value, max_value, filter_value, + data_format, scale, phase, arrow_scale, nlabels, labelsize, ncolors, colormap, use_fringe_internal=True, @@ -1293,7 +1298,8 @@ def set_normal_result(self, icase: int, name: str, unused_subcase_id: int) -> No #icase_fringe = icase #self.legend_obj.update_legend( #icase_fringe, icase_disp, icase_vector, - #legend_title, min_value, max_value, data_format, scale, phase, + #legend_title, min_value, max_value, filter_value, + #data_format, scale, phase, #nlabels, labelsize, ncolors, colormap, external_call=False) self.hide_legend() self.scalar_bar.is_shown = False diff --git a/pyNastran/gui/testing_methods.py b/pyNastran/gui/testing_methods.py index 3ed7a5735..650c67261 100644 --- a/pyNastran/gui/testing_methods.py +++ b/pyNastran/gui/testing_methods.py @@ -207,7 +207,8 @@ def grid_selected(self): #pass def update_legend(self, icase_fringe, icase_disp, icase_vector, - name, min_value, max_value, data_format, scale, phase, + name, min_value, max_value, filter_value, + data_format, scale, phase, arrow_scale, nlabels, labelsize, ncolors, colormap, use_fringe_internal=False, use_disp_internal=False,