- modified the GUI for Exclusion areas; now the shapes are displayed in a Table where they can be selected and deleted. Modification applied for Geometry Objects only (for now).

- fixed and error when converting units, error that acted when in those fields that accept lists of tools only one tool was added
This commit is contained in:
Marius Stanciu
2020-05-09 05:18:05 +03:00
committed by Marius
parent ee69744d6e
commit 0e07ea1541
6 changed files with 207 additions and 41 deletions

View File

@@ -2125,35 +2125,29 @@ class GeometryObjectUI(ObjectUI):
self.exclusion_box.setContentsMargins(0, 0, 0, 0)
self.exclusion_frame.setLayout(self.exclusion_box)
h_lay = QtWidgets.QHBoxLayout()
self.exclusion_box.addLayout(h_lay)
self.exclusion_table = FCTable()
self.exclusion_box.addWidget(self.exclusion_table)
self.exclusion_table.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents)
# Button Add Area
self.add_area_button = QtWidgets.QPushButton(_('Add area'))
self.add_area_button.setToolTip(_("Add an Exclusion Area."))
h_lay.addWidget(self.add_area_button)
self.exclusion_table.setColumnCount(4)
self.exclusion_table.setColumnWidth(0, 20)
self.exclusion_table.setHorizontalHeaderLabels(['#', _('Object'), _('Strategy'), _('Over Z')])
# Button Delete Area
self.delete_area_button = QtWidgets.QPushButton(_('Clear areas'))
self.delete_area_button.setToolTip(_("Delete all exclusion areas."))
h_lay.addWidget(self.delete_area_button)
self.exclusion_table.horizontalHeaderItem(0).setToolTip(_("This is the Area ID."))
self.exclusion_table.horizontalHeaderItem(1).setToolTip(
_("Type of the object where the exclusion area was added."))
self.exclusion_table.horizontalHeaderItem(2).setToolTip(
_("The strategy used for exclusion area. Go around the exclusion areas or over it."))
self.exclusion_table.horizontalHeaderItem(3).setToolTip(
_("If the strategy is to go over the area then this is the height at which the tool will go to avoid the "
"exclusion area."))
grid_l = QtWidgets.QGridLayout()
grid_l.setColumnStretch(0, 0)
grid_l.setColumnStretch(1, 1)
self.exclusion_box.addLayout(grid_l)
self.exclusion_table.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectRows)
# Area Selection shape
self.area_shape_label = QtWidgets.QLabel('%s:' % _("Shape"))
self.area_shape_label.setToolTip(
_("The kind of selection shape used for area selection.")
)
self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
{'label': _("Polygon"), 'value': 'polygon'}])
grid_l.addWidget(self.area_shape_label, 0, 0)
grid_l.addWidget(self.area_shape_radio, 0, 1)
grid_a1 = QtWidgets.QGridLayout()
grid_a1.setColumnStretch(0, 0)
grid_a1.setColumnStretch(1, 1)
self.exclusion_box.addLayout(grid_a1)
# Chose Strategy
self.strategy_label = FCLabel('%s:' % _("Strategy"))
@@ -2164,8 +2158,8 @@ class GeometryObjectUI(ObjectUI):
self.strategy_radio = RadioSet([{'label': _('Over'), 'value': 'over'},
{'label': _('Around'), 'value': 'around'}])
grid_l.addWidget(self.strategy_label, 1, 0)
grid_l.addWidget(self.strategy_radio, 1, 1)
grid_a1.addWidget(self.strategy_label, 1, 0)
grid_a1.addWidget(self.strategy_radio, 1, 1)
# Over Z
self.over_z_label = FCLabel('%s:' % _("Over Z"))
@@ -2175,8 +2169,36 @@ class GeometryObjectUI(ObjectUI):
self.over_z_entry.set_range(0.000, 9999.9999)
self.over_z_entry.set_precision(self.decimals)
grid_l.addWidget(self.over_z_label, 2, 0)
grid_l.addWidget(self.over_z_entry, 2, 1)
grid_a1.addWidget(self.over_z_label, 2, 0)
grid_a1.addWidget(self.over_z_entry, 2, 1)
# Button Add Area
self.add_area_button = QtWidgets.QPushButton(_('Add area'))
self.add_area_button.setToolTip(_("Add an Exclusion Area."))
# Area Selection shape
self.area_shape_radio = RadioSet([{'label': _("Square"), 'value': 'square'},
{'label': _("Polygon"), 'value': 'polygon'}])
self.area_shape_radio.setToolTip(
_("The kind of selection shape used for area selection.")
)
grid_a1.addWidget(self.add_area_button, 4, 0)
grid_a1.addWidget(self.area_shape_radio, 4, 1)
h_lay_1 = QtWidgets.QHBoxLayout()
self.exclusion_box.addLayout(h_lay_1)
# Button Delete All Areas
self.delete_area_button = QtWidgets.QPushButton(_('Clear areas'))
self.delete_area_button.setToolTip(_("Delete all exclusion areas."))
# Button Delete Selected Areas
self.delete_sel_area_button = QtWidgets.QPushButton(_('Delete Selected'))
self.delete_sel_area_button.setToolTip(_("Delete all exclusion areas that are selected in the table."))
h_lay_1.addWidget(self.delete_area_button)
h_lay_1.addWidget(self.delete_sel_area_button)
# -------------------------- EXCLUSION AREAS END -------------------------------------------------------------
# ------------------------------------------------------------------------------------------------------------