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):
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
# 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__(
)
+ 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.
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):
"""