- in Geometry Editor - added a context menu in the Geometry Table
This commit is contained in:
@@ -17,6 +17,7 @@ CHANGELOG for FlatCAM beta
|
|||||||
- in Geometry Editor - simplification method is now threaded and optimized
|
- in Geometry Editor - simplification method is now threaded and optimized
|
||||||
- in Geometry Editor - fixed a crash on Geometry Editor exit
|
- in Geometry Editor - fixed a crash on Geometry Editor exit
|
||||||
- in Geometry Editor - added a new feature: ability to change the orientation (from CW to CCW and the revers) for Polygon and LinearRing geometry elements.
|
- in Geometry Editor - added a new feature: ability to change the orientation (from CW to CCW and the revers) for Polygon and LinearRing geometry elements.
|
||||||
|
- in Geometry Editor - added a context menu in the Geometry Table
|
||||||
|
|
||||||
26.11.2020
|
26.11.2020
|
||||||
|
|
||||||
|
|||||||
@@ -3385,6 +3385,7 @@ class AppGeoEditor(QtCore.QObject):
|
|||||||
self.tw = FCTree(columns=3, header_hidden=False, protected_column=[0, 1], extended_sel=True)
|
self.tw = FCTree(columns=3, header_hidden=False, protected_column=[0, 1], extended_sel=True)
|
||||||
self.tw.setHeaderLabels(["ID", _("Type"), _("Name")])
|
self.tw.setHeaderLabels(["ID", _("Type"), _("Name")])
|
||||||
self.tw.setIndentation(0)
|
self.tw.setIndentation(0)
|
||||||
|
self.tw.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
|
||||||
self.tw.header().setStretchLastSection(True)
|
self.tw.header().setStretchLastSection(True)
|
||||||
self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)
|
self.tw.header().setSectionResizeMode(QtWidgets.QHeaderView.ResizeToContents)
|
||||||
grid0.addWidget(self.tw, 2, 0, 1, 3)
|
grid0.addWidget(self.tw, 2, 0, 1, 3)
|
||||||
@@ -3430,6 +3431,7 @@ class AppGeoEditor(QtCore.QObject):
|
|||||||
is_ccw_lbl = FCLabel('<b>%s</b>:' % _("Is CCW"))
|
is_ccw_lbl = FCLabel('<b>%s</b>:' % _("Is CCW"))
|
||||||
self.is_ccw_entry = FCLabel('None')
|
self.is_ccw_entry = FCLabel('None')
|
||||||
self.change_orientation_btn = FCButton(_("Change"))
|
self.change_orientation_btn = FCButton(_("Change"))
|
||||||
|
self.change_orientation_btn.setIcon(QtGui.QIcon(self.app.resource_location + '/orientation32.png'))
|
||||||
self.change_orientation_btn.setToolTip(
|
self.change_orientation_btn.setToolTip(
|
||||||
_("Change the orientation of the geometric element.\n"
|
_("Change the orientation of the geometric element.\n"
|
||||||
"Works for LinearRing and Polygons.")
|
"Works for LinearRing and Polygons.")
|
||||||
@@ -3673,6 +3675,8 @@ class AppGeoEditor(QtCore.QObject):
|
|||||||
self.simplification_btn.clicked.connect(self.on_simplification_click)
|
self.simplification_btn.clicked.connect(self.on_simplification_click)
|
||||||
self.change_orientation_btn.clicked.connect(self.on_change_orientation)
|
self.change_orientation_btn.clicked.connect(self.on_change_orientation)
|
||||||
|
|
||||||
|
self.tw.customContextMenuRequested.connect(self.on_menu_request)
|
||||||
|
|
||||||
self.clear_tree_sig.connect(self.on_clear_tree)
|
self.clear_tree_sig.connect(self.on_clear_tree)
|
||||||
|
|
||||||
# Event signals disconnect id holders
|
# Event signals disconnect id holders
|
||||||
@@ -3947,6 +3951,24 @@ class AppGeoEditor(QtCore.QObject):
|
|||||||
|
|
||||||
self.app.worker_task.emit({'fcn': task_job, 'params': []})
|
self.app.worker_task.emit({'fcn': task_job, 'params': []})
|
||||||
|
|
||||||
|
def on_menu_request(self, pos):
|
||||||
|
menu = QtWidgets.QMenu()
|
||||||
|
|
||||||
|
delete_action = menu.addAction(QtGui.QIcon(self.app.resource_location + '/delete32.png'), _("Delete"))
|
||||||
|
delete_action.triggered.connect(self.delete_selected)
|
||||||
|
|
||||||
|
menu.addSeparator()
|
||||||
|
|
||||||
|
orientation_change = menu.addAction(QtGui.QIcon(self.app.resource_location + '/orientation32.png'),
|
||||||
|
_("Change"))
|
||||||
|
orientation_change.triggered.connect(self.on_change_orientation)
|
||||||
|
|
||||||
|
if not self.tw.selectedItems():
|
||||||
|
delete_action.setDisabled(True)
|
||||||
|
orientation_change.setDisabled(True)
|
||||||
|
|
||||||
|
menu.exec(self.tw.viewport().mapToGlobal(pos))
|
||||||
|
|
||||||
def activate(self):
|
def activate(self):
|
||||||
# adjust the status of the menu entries related to the editor
|
# adjust the status of the menu entries related to the editor
|
||||||
self.app.ui.menueditedit.setDisabled(True)
|
self.app.ui.menueditedit.setDisabled(True)
|
||||||
|
|||||||
BIN
assets/resources/dark_resources/orientation32.png
Normal file
BIN
assets/resources/dark_resources/orientation32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 840 B |
BIN
assets/resources/orientation32.png
Normal file
BIN
assets/resources/orientation32.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 734 B |
Reference in New Issue
Block a user