]> SALOME platform Git repositories - modules/geom.git/commitdiff
Salome HOME
[bos #38044][EDF] (2023-T3) Support for automatic reparation. Added selected sub...
authorKonstantin Leontev <Konstantin.LEONTEV@opencascade.com>
Thu, 21 Mar 2024 11:56:20 +0000 (11:56 +0000)
committerDUC ANH HOANG <dh77501n@dsp1043837>
Thu, 23 May 2024 11:58:25 +0000 (13:58 +0200)
src/RepairGUIAdv/geomrepairadv_common.py
src/RepairGUIAdv/locate_subshapes.py

index 4d2feafb7d6e8af644bc543bfa0e11dc98f2a04e..83c93379d275abac446ce4d413988e10fe1319f5 100644 (file)
@@ -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):
     """
index 8f4ec67ab6b26e88a914d6774dca49364c6dd948..b568ba0d3e5e1cb5ba3cc4a99f044a6ac27c88f0 100644 (file)
 
 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):
         """