from .geomrepairadv_execute import execute
from .geomrepairadv_logger import logger
from .geomrepairadv_common import DlgRef_1Sel_QTD, \
- GEOM_RESULT_NAME_GRP, NAME_LBL, GEOM_SELECTED_LBL, GEOM_SELECTED_SHAPE
+ GEOM_RESULT_NAME_GRP, NAME_LBL, GEOM_SELECTED_LBL, GEOM_SELECTED_SHAPE, GEOM_SELECTED_SUBSHAPE
import GEOM
class BaseDlg(Ui_BaseDlg, QWidget):
self._selected_widget.TextLabel1.setText(GEOM_SELECTED_SHAPE)
self._selected_widget.PushButton1.clicked.connect(self.on_select_object)
+ # A widget to show selected sub-shapes
+ self._sel_subshape_widget = self.create_sel_subshape_widget()
+
# Keep references to selected object and its temporary copy
# that we need to pass for execution instead of original one.
# TODO: decide if we really need to pass a copy.
self.child_layout.setContentsMargins(0, 0, 0, 0)
self.child_layout.addWidget(self._result_widget, 0, 0)
self.child_layout.addWidget(self._selected_widget, 1, 0)
+ self.child_layout.addWidget(self._sel_subshape_widget, 2, 0)
if child_widget:
- self.child_layout.addWidget(child_widget, 2, 0)
+ self.child_layout.addWidget(child_widget, 3, 0)
# Set basic button's actions
self.buttonOk.clicked.connect(self.on_apply_close)
self._sel_manager = salome_pyqt.getSelection()
self._sel_connection = \
self._sel_manager.currentSelectionChanged.connect(self.on_select_object)
+ self._sel_subshape_connection = \
+ self._sel_manager.currentSelectionChanged.connect(self.on_select_subshape)
# Check if we already have selected object
self.on_select_object()
return True
+ def create_sel_subshape_widget(self):
+ """
+ Returns a widget that lists preliminarily selected for processing sub_shapes.
+
+ Args:
+ None.
+
+ Returns:
+ A new widget.
+ """
+
+ sel_subshape_widget = DlgRef_1Sel_QTD()
+ sel_subshape_widget.TextLabel1.setText(GEOM_SELECTED_SUBSHAPE)
+ sel_subshape_widget.PushButton1.clicked.connect(self.on_select_subshape)
+
+ return sel_subshape_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._sel_subshape_widget.LineEdit1.setText(selected_ids_str)
+
+
def closeEvent(self, event):
"""
Overrides default close envent to reset selection level.
# Clean up all selection changes
self._sel_manager.currentSelectionChanged.disconnect(self._sel_connection)
+ self._sel_manager.currentSelectionChanged.disconnect(self._sel_subshape_connection)
self.set_selection(None)
from salome.geom.geomrepairadv.basedlg import BaseDlg
-from .geomrepairadv_common import DlgRef_1Spin_QTD, DlgRef_1Sel_QTD, \
- GEOM_SELECTED_SUBSHAPE
+from .geomrepairadv_common import DlgRef_1Spin_QTD
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._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)
+ layout.addWidget(self._min_widget, 2, 0)
+ layout.addWidget(self._max_widget, 3, 0)
+ layout.addWidget(self._select_button, 4, 0)
# Init base dialog
BaseDlg.__init__(
selection_level
)
- # Connect selection manager from a base class
- self._sel_subshape_connection = \
- self._sel_manager.currentSelectionChanged.connect(self.on_select_subshape)
-
-
- 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):
"""
return None
- def closeEvent(self, event):
- """
- Overrides default close envent to reset selection level.
- """
-
- super().closeEvent(event)
-
- # Clean up all selection changes
- self._sel_manager.currentSelectionChanged.disconnect(self._sel_subshape_connection)
-
-
# For testing run as a module from geomrepairadv parent directory in
# Salome INSTALL, because the dialog needs a generated Ui_BaseDlg class
# that we don't have in the SOURCE.
# Precision widget
self._precision_widget = DlgRef_1Spin_QTD('Precision', 0, 2, 100)
+
+ # Add the widgets to layout
layout.addWidget(self._precision_widget, 0, 0)
BaseDlg.__init__(