Draft: Remove unused arguments from gui_tool_utils.get_point (#10347)

This commit is contained in:
Roy-043
2023-08-25 03:49:06 +02:00
committed by GitHub
parent 971e74b7db
commit 602841c5f0
6 changed files with 15 additions and 50 deletions

View File

@@ -163,10 +163,7 @@ class Ellipse(gui_base_original.Creator):
if arg["Key"] == "ESCAPE":
self.finish()
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
(self.point,
ctrlPoint, info) = gui_tool_utils.getPoint(self, arg,
mobile=True,
noTracker=True)
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
self.rect.update(self.point)
gui_tool_utils.redraw3DView()
elif arg["Type"] == "SoMouseButtonEvent":
@@ -178,10 +175,7 @@ class Ellipse(gui_base_original.Creator):
if (not self.node) and (not self.support):
gui_tool_utils.getSupport(arg)
(self.point,
ctrlPoint, info) = gui_tool_utils.getPoint(self, arg,
mobile=True,
noTracker=True)
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
if self.point:
self.ui.redraw()
self.pos = arg["Position"]

View File

@@ -164,10 +164,7 @@ class Rectangle(gui_base_original.Creator):
if arg["Key"] == "ESCAPE":
self.finish()
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
(self.point,
ctrlPoint, info) = gui_tool_utils.getPoint(self, arg,
mobile=True,
noTracker=True)
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
self.rect.update(self.point)
gui_tool_utils.redraw3DView()
elif (arg["Type"] == "SoMouseButtonEvent"
@@ -180,10 +177,7 @@ class Rectangle(gui_base_original.Creator):
if (not self.node) and (not self.support):
gui_tool_utils.getSupport(arg)
(self.point,
ctrlPoint, info) = gui_tool_utils.getPoint(self, arg,
mobile=True,
noTracker=True)
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
if self.point:
self.ui.redraw()
self.pos = arg["Position"]

View File

@@ -161,8 +161,7 @@ class Scale(gui_base_original.Modifier):
"""Handle the mouse event of movement."""
for ghost in self.ghosts:
ghost.off()
(self.point,
ctrlPoint, info) = gui_tool_utils.getPoint(self, arg, sym=True)
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
def handle_mouse_click_event(self):
"""Handle the mouse click event."""

View File

@@ -141,7 +141,6 @@ class Stretch(gui_base_original.Modifier):
if arg["Key"] == "ESCAPE":
self.finish()
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
# ,mobile=True) #,noTracker=(self.step < 3))
point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
if self.step == 2:
self.rectracker.update(point)
@@ -152,7 +151,6 @@ class Stretch(gui_base_original.Modifier):
# clicked twice on the same point
self.finish()
else:
# ,mobile=True) #,noTracker=(self.step < 3))
point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
self.addPoint(point)

View File

@@ -146,8 +146,7 @@ def set_mod(args, mod, state):
setMod = set_mod
def get_point(target, args,
mobile=False, sym=False, workingplane=True, noTracker=False):
def get_point(target, args, noTracker=False):
"""Return a constrained 3D point and its original point.
It is used by the Draft tools.
@@ -165,21 +164,6 @@ def get_point(target, args,
args: Coin event
The Coin event received from the 3D view.
mobile: bool, optional
It defaults to `False`.
If it is `True` the constraining occurs from the location of
the mouse cursor when `Shift` is pressed; otherwise from the last
entered point.
sym: bool, optional
It defaults to `False`.
If it is `True`, the x and y values always stay equal.
workingplane: bool, optional
It defaults to `True`.
If it is `False`, the point won't be projected on the currently
active working plane.
noTracker: bool, optional
It defaults to `False`.
If it is `True`, the tracking line will not be displayed.
@@ -202,8 +186,8 @@ def get_point(target, args,
else:
last = None
amod = hasMod(args, MODSNAP)
cmod = hasMod(args, MODCONSTRAIN)
amod = has_mod(args, MODSNAP)
cmod = has_mod(args, MODCONSTRAIN)
point = None
if hasattr(Gui, "Snapper"):
@@ -221,15 +205,14 @@ def get_point(target, args,
mask = None
ctrlPoint = App.Vector(point)
wp = App.DraftWorkingPlane
if target.node:
if target.featureName == "Rectangle":
ui.displayPoint(point, target.node[0],
plane=App.DraftWorkingPlane, mask=mask)
ui.displayPoint(point, target.node[0], plane=wp, mask=mask)
else:
ui.displayPoint(point, target.node[-1],
plane=App.DraftWorkingPlane, mask=mask)
ui.displayPoint(point, target.node[-1], plane=wp, mask=mask)
else:
ui.displayPoint(point, plane=App.DraftWorkingPlane, mask=mask)
ui.displayPoint(point, plane=wp, mask=mask)
return point, ctrlPoint, info
@@ -363,10 +346,9 @@ def get_support(mouseEvent=None):
that contains the single selected face that was used
to align the working plane.
"""
App.DraftWorkingPlane.save()
if mouseEvent:
return setWorkingPlaneToObjectUnderCursor(mouseEvent)
return setWorkingPlaneToSelectedObject()
return set_working_plane_to_object_under_cursor(mouseEvent)
return set_working_plane_to_selected_object()
getSupport = get_support

View File

@@ -195,9 +195,7 @@ class Trimex(gui_base_original.Modifier):
arg["ShiftDown"] = False
elif hasattr(Gui, "Snapper"):
Gui.Snapper.setSelectMode(not self.ctrl)
wp = not(self.extrudeMode and self.shift)
self.point, cp, info = gui_tool_utils.getPoint(self, arg,
workingplane=wp)
self.point, cp, info = gui_tool_utils.getPoint(self, arg)
if gui_tool_utils.hasMod(arg, gui_tool_utils.MODSNAP):
self.snapped = None
else: