From 8833db2ff19abe6812afc074e251e650667d5d88 Mon Sep 17 00:00:00 2001 From: Konstantin Leontev Date: Thu, 21 Mar 2024 11:56:20 +0000 Subject: [PATCH] [bos #38044][EDF] (2023-T3) Support for automatic reparation. Added selected sub-shapes list for locate subshapes dialog. --- src/RepairGUIAdv/geomrepairadv_common.py | 1 + src/RepairGUIAdv/locate_subshapes.py | 54 +++++++++++++++++++++--- 2 files changed, 50 insertions(+), 5 deletions(-) diff --git a/src/RepairGUIAdv/geomrepairadv_common.py b/src/RepairGUIAdv/geomrepairadv_common.py index 4d2feafb7..83c93379d 100644 --- a/src/RepairGUIAdv/geomrepairadv_common.py +++ b/src/RepairGUIAdv/geomrepairadv_common.py @@ -30,6 +30,7 @@ GEOM_RESULT_NAME_GRP = 'Result name' NAME_LBL = 'Name' GEOM_SELECTED_LBL = 'Name' GEOM_SELECTED_SHAPE = 'Selected shape' +GEOM_SELECTED_SUBSHAPE = 'Selected sub-shape' class DlgRef_1Sel_QTD(Ui_DlgRef_1Sel_QTD, QWidget): """ diff --git a/src/RepairGUIAdv/locate_subshapes.py b/src/RepairGUIAdv/locate_subshapes.py index 8f4ec67ab..b568ba0d3 100644 --- a/src/RepairGUIAdv/locate_subshapes.py +++ b/src/RepairGUIAdv/locate_subshapes.py @@ -21,11 +21,13 @@ import sys -from qtsalome import QGridLayout, QFrame, QApplication, QComboBox, QLabel, QPushButton, QMessageBox +from qtsalome import QGridLayout, QFrame, QApplication, \ + QComboBox, QLabel, QPushButton, QMessageBox from salome.geom.geomrepairadv.basedlg import BaseDlg -from .geomrepairadv_common import DlgRef_1Spin_QTD +from .geomrepairadv_common import DlgRef_1Spin_QTD, DlgRef_1Sel_QTD, \ + GEOM_SELECTED_SUBSHAPE import GEOM class LocateSubShapesDlg(BaseDlg): @@ -47,6 +49,9 @@ class LocateSubShapesDlg(BaseDlg): self._type_widget.setToolTip('Select a type of shape measurement') self._type_widget.currentIndexChanged.connect(self.on_measurment_type_changed) + # A widget to show preliminarily selected sub-shapes + self._pre_selected_widget = self.create_pre_selected_widget() + # Min/max values widgets decimals = 2 max_value = sys.float_info.max @@ -60,9 +65,10 @@ class LocateSubShapesDlg(BaseDlg): # Add the widgets to layout layout.addWidget(type_label, 0, 0) layout.addWidget(self._type_widget, 1, 0) - layout.addWidget(self._min_widget, 2, 0) - layout.addWidget(self._max_widget, 3, 0) - layout.addWidget(self._select_button, 4, 0) + layout.addWidget(self._pre_selected_widget, 2, 0) + layout.addWidget(self._min_widget, 3, 0) + layout.addWidget(self._max_widget, 4, 0) + layout.addWidget(self._select_button, 5, 0) # Init base dialog BaseDlg.__init__( @@ -75,6 +81,41 @@ class LocateSubShapesDlg(BaseDlg): ) + def create_pre_selected_widget(self): + """ + Returns a widget that lists preliminarily selected for processing sub_shapes. + + Args: + None. + + Returns: + A new widget. + """ + + pre_sel_widget = DlgRef_1Sel_QTD() + pre_sel_widget.TextLabel1.setText(GEOM_SELECTED_SUBSHAPE) + pre_sel_widget.PushButton1.clicked.connect(self.on_select_subshape) + + return pre_sel_widget + + + def on_select_subshape(self): + """ + Updates pre selected widget. + + Args: + None. + + Returns: + None. + """ + + selected_ids = self.get_local_selection() + selected_ids_str = ', '.join(str(id) for id in selected_ids) + self._pre_selected_widget.LineEdit1.setText(selected_ids_str) + + + def get_limits(self): """ Returns current values for min/max limits. @@ -124,6 +165,9 @@ class LocateSubShapesDlg(BaseDlg): selection_level = self.get_measurment_type(index) self.set_selection_level(selection_level) + # Clear pre selected sub-shapes list + self.on_select_subshape() + def on_select_button_clicked(self): """ -- 2.39.2