Added delete button in drawing toolbar.

This commit is contained in:
jpcaram 2015-01-01 15:41:50 -05:00
parent 977b5b1f91
commit f17f955355
6 changed files with 22 additions and 12 deletions

View File

@ -526,7 +526,7 @@ class FlatCAMDraw(QtCore.QObject):
self.drawing_toolbar = QtGui.QToolBar()
self.drawing_toolbar.setDisabled(disabled)
self.app.ui.addToolBar(self.drawing_toolbar)
self.select_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), 'Select')
self.select_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/pointer32.png'), "Select 'Esc'")
self.add_circle_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/circle32.png'), 'Add Circle')
self.add_arc_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/arc32.png'), 'Add Arc')
self.add_rectangle_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/rectangle32.png'), 'Add Rectangle')
@ -535,8 +535,9 @@ class FlatCAMDraw(QtCore.QObject):
self.union_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/union32.png'), 'Polygon Union')
self.subtract_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/subtract32.png'), 'Polygon Subtraction')
self.cutpath_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/cutpath32.png'), 'Cut Path')
self.move_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/move32.png'), 'Move Objects')
self.copy_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/copy32.png'), 'Copy Objects')
self.move_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/move32.png'), "Move Objects 'm'")
self.copy_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/copy32.png'), "Copy Objects 'c'")
self.delete_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), "Delete Shape '-'")
### Snap Toolbar ###
self.snap_toolbar = QtGui.QToolBar()
@ -569,6 +570,7 @@ class FlatCAMDraw(QtCore.QObject):
self.union_btn.triggered.connect(self.union)
self.subtract_btn.triggered.connect(self.subtract)
self.cutpath_btn.triggered.connect(self.cutpath)
self.delete_btn.triggered.connect(self.on_delete_btn)
## Toolbar events and properties
self.tools = {
@ -926,6 +928,10 @@ class FlatCAMDraw(QtCore.QObject):
def on_canvas_key_release(self, event):
self.key = None
def on_delete_btn(self):
self.delete_selected()
self.replot()
def get_selected(self):
"""
Returns list of shapes that are selected in the editor.

View File

@ -2370,19 +2370,14 @@ class CNCjob(Geometry):
try:
while True:
path_count += 1
print "Current: ", "(%.3f, %.3f)" % current_pt
# TODO: There shoudn't be any None in geometry.flatten()
# if geo is None:
# storage.remove(geo)
# continue
#print "Current: ", "(%.3f, %.3f)" % current_pt
# Remove before modifying, otherwise
# deletion will fail.
storage.remove(geo)
if list(pt) == list(geo.coords[-1]):
print "Reversing"
#print "Reversing"
geo.coords = list(geo.coords)[::-1]
# G-code

View File

@ -15,12 +15,14 @@ Drawing
* [DONE] Remove from index (rebuild index or make deleted instances
equal to None in the list).
* Better handling/abstraction of geometry types and lists of such.
* Plotting and extraction of point is now done in a quite
efficient recursive way.
Algorithms
----------
* Reverse path if end is nearer.
* [DONE] Reverse path if end is nearer.
* Seed paint: Specify seed.
@ -48,4 +50,11 @@ Bugs
----
* Unit conversion on opening.
* `cascaded_union([])` bug requires more testing.
* [DONE] `cascaded_union([])` bug requires more testing.
* Old version of GEOS
Other
-----
* Unit testing

BIN
share/deleteshape16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

BIN
share/deleteshape24.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 679 B

BIN
share/deleteshape32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B