- fixed Tool Move to work only for objects that are selected but also plotted, therefore disabled objects will not be moved even if selected
This commit is contained in:
@@ -15,6 +15,7 @@ CAD program, and create G-Code for Isolation routing.
|
|||||||
- made FCDoubleSpinner to use either comma or dot as a decimal separator
|
- made FCDoubleSpinner to use either comma or dot as a decimal separator
|
||||||
- fixed the FCDoubleSpinner to only allow the amount of decimals already set with set_precision()
|
- fixed the FCDoubleSpinner to only allow the amount of decimals already set with set_precision()
|
||||||
- fixed ToolPanelize to use FCDoubleSpinner in some places
|
- fixed ToolPanelize to use FCDoubleSpinner in some places
|
||||||
|
- fixed Tool Move to work only for objects that are selected but also plotted, therefore disabled objects will not be moved even if selected
|
||||||
|
|
||||||
8.10.2019
|
8.10.2019
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,10 @@ class ToolMove(FlatCAMTool):
|
|||||||
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
|
from flatcamGUI.PlotCanvasLegacy import ShapeCollectionLegacy
|
||||||
self.sel_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name="move")
|
self.sel_shapes = ShapeCollectionLegacy(obj=self, app=self.app, name="move")
|
||||||
|
|
||||||
|
self.mm = None
|
||||||
|
self.mp = None
|
||||||
|
self.kr = None
|
||||||
|
|
||||||
self.replot_signal[list].connect(self.replot)
|
self.replot_signal[list].connect(self.replot)
|
||||||
|
|
||||||
def install(self, icon=None, separator=None, **kwargs):
|
def install(self, icon=None, separator=None, **kwargs):
|
||||||
@@ -90,10 +94,11 @@ class ToolMove(FlatCAMTool):
|
|||||||
# signal that there is a command active and it is 'Move'
|
# signal that there is a command active and it is 'Move'
|
||||||
self.app.command_active = "Move"
|
self.app.command_active = "Move"
|
||||||
|
|
||||||
if self.app.collection.get_selected():
|
sel_obj_list = self.app.collection.get_selected()
|
||||||
|
if sel_obj_list:
|
||||||
self.app.inform.emit(_("MOVE: Click on the Start point ..."))
|
self.app.inform.emit(_("MOVE: Click on the Start point ..."))
|
||||||
# draw the selection box
|
# draw the selection box
|
||||||
self.draw_sel_bbox()
|
self.draw_sel_bbox(obj_list=sel_obj_list)
|
||||||
else:
|
else:
|
||||||
self.setVisible(False)
|
self.setVisible(False)
|
||||||
# signal that there is no command active
|
# signal that there is no command active
|
||||||
@@ -143,7 +148,8 @@ class ToolMove(FlatCAMTool):
|
|||||||
dx = pos[0] - self.point1[0]
|
dx = pos[0] - self.point1[0]
|
||||||
dy = pos[1] - self.point1[1]
|
dy = pos[1] - self.point1[1]
|
||||||
|
|
||||||
obj_list = self.app.collection.get_selected()
|
# move only the objects selected and plotted
|
||||||
|
obj_list = [obj for obj in self.app.collection.get_selected() if obj.options['plot']]
|
||||||
|
|
||||||
def job_move(app_obj):
|
def job_move(app_obj):
|
||||||
with self.app.proc_container.new(_("Moving...")) as proc:
|
with self.app.proc_container.new(_("Moving...")) as proc:
|
||||||
@@ -248,13 +254,12 @@ class ToolMove(FlatCAMTool):
|
|||||||
self.toggle()
|
self.toggle()
|
||||||
return
|
return
|
||||||
|
|
||||||
def draw_sel_bbox(self):
|
def draw_sel_bbox(self, obj_list):
|
||||||
xminlist = []
|
xminlist = []
|
||||||
yminlist = []
|
yminlist = []
|
||||||
xmaxlist = []
|
xmaxlist = []
|
||||||
ymaxlist = []
|
ymaxlist = []
|
||||||
|
|
||||||
obj_list = self.app.collection.get_selected()
|
|
||||||
if not obj_list:
|
if not obj_list:
|
||||||
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Object(s) not selected"))
|
self.app.inform.emit('[WARNING_NOTCL] %s' % _("Object(s) not selected"))
|
||||||
self.toggle()
|
self.toggle()
|
||||||
@@ -263,13 +268,16 @@ class ToolMove(FlatCAMTool):
|
|||||||
self.mm = self.app.plotcanvas.graph_event_connect('mouse_move', self.on_move)
|
self.mm = self.app.plotcanvas.graph_event_connect('mouse_move', self.on_move)
|
||||||
self.mp = self.app.plotcanvas.graph_event_connect('mouse_press', self.on_left_click)
|
self.mp = self.app.plotcanvas.graph_event_connect('mouse_press', self.on_left_click)
|
||||||
self.kr = self.app.plotcanvas.graph_event_connect('key_release', self.on_key_press)
|
self.kr = self.app.plotcanvas.graph_event_connect('key_release', self.on_key_press)
|
||||||
|
|
||||||
# first get a bounding box to fit all
|
# first get a bounding box to fit all
|
||||||
for obj in obj_list:
|
for obj in obj_list:
|
||||||
xmin, ymin, xmax, ymax = obj.bounds()
|
# don't move disabled objects, move only plotted objects
|
||||||
xminlist.append(xmin)
|
if obj.options['plot']:
|
||||||
yminlist.append(ymin)
|
xmin, ymin, xmax, ymax = obj.bounds()
|
||||||
xmaxlist.append(xmax)
|
xminlist.append(xmin)
|
||||||
ymaxlist.append(ymax)
|
yminlist.append(ymin)
|
||||||
|
xmaxlist.append(xmax)
|
||||||
|
ymaxlist.append(ymax)
|
||||||
|
|
||||||
# get the minimum x,y and maximum x,y for all objects selected
|
# get the minimum x,y and maximum x,y for all objects selected
|
||||||
xminimal = min(xminlist)
|
xminimal = min(xminlist)
|
||||||
|
|||||||
Reference in New Issue
Block a user