[bos #38044][EDF] (2023-T3) Support for automatic reparation. Added selected sub-shapes list for locate subshapes dialog.

This commit is contained in:
Konstantin Leontev 2024-03-21 11:56:20 +00:00 committed by DUC ANH HOANG
parent 71e5c3b989
commit 8833db2ff1
2 changed files with 50 additions and 5 deletions

View 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):
"""

View File

@ -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):
"""