From 602841c5f0f2c9ce332f9d7c8df7153ac73454ba Mon Sep 17 00:00:00 2001 From: Roy-043 <70520633+Roy-043@users.noreply.github.com> Date: Fri, 25 Aug 2023 03:49:06 +0200 Subject: [PATCH] Draft: Remove unused arguments from gui_tool_utils.get_point (#10347) --- src/Mod/Draft/draftguitools/gui_ellipses.py | 10 ++---- src/Mod/Draft/draftguitools/gui_rectangles.py | 10 ++---- src/Mod/Draft/draftguitools/gui_scale.py | 3 +- src/Mod/Draft/draftguitools/gui_stretch.py | 2 -- src/Mod/Draft/draftguitools/gui_tool_utils.py | 36 +++++-------------- src/Mod/Draft/draftguitools/gui_trimex.py | 4 +-- 6 files changed, 15 insertions(+), 50 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_ellipses.py b/src/Mod/Draft/draftguitools/gui_ellipses.py index 0f96d40ccd..8040bd13aa 100644 --- a/src/Mod/Draft/draftguitools/gui_ellipses.py +++ b/src/Mod/Draft/draftguitools/gui_ellipses.py @@ -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"] diff --git a/src/Mod/Draft/draftguitools/gui_rectangles.py b/src/Mod/Draft/draftguitools/gui_rectangles.py index 227b2bde4d..eac5b8fce5 100644 --- a/src/Mod/Draft/draftguitools/gui_rectangles.py +++ b/src/Mod/Draft/draftguitools/gui_rectangles.py @@ -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"] diff --git a/src/Mod/Draft/draftguitools/gui_scale.py b/src/Mod/Draft/draftguitools/gui_scale.py index ccb31cdc76..966855654d 100644 --- a/src/Mod/Draft/draftguitools/gui_scale.py +++ b/src/Mod/Draft/draftguitools/gui_scale.py @@ -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.""" diff --git a/src/Mod/Draft/draftguitools/gui_stretch.py b/src/Mod/Draft/draftguitools/gui_stretch.py index 10a0195d0c..380f77b443 100644 --- a/src/Mod/Draft/draftguitools/gui_stretch.py +++ b/src/Mod/Draft/draftguitools/gui_stretch.py @@ -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) diff --git a/src/Mod/Draft/draftguitools/gui_tool_utils.py b/src/Mod/Draft/draftguitools/gui_tool_utils.py index c922517816..e9a64074ef 100644 --- a/src/Mod/Draft/draftguitools/gui_tool_utils.py +++ b/src/Mod/Draft/draftguitools/gui_tool_utils.py @@ -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 diff --git a/src/Mod/Draft/draftguitools/gui_trimex.py b/src/Mod/Draft/draftguitools/gui_trimex.py index 42ec8c081e..8051db5b85 100644 --- a/src/Mod/Draft/draftguitools/gui_trimex.py +++ b/src/Mod/Draft/draftguitools/gui_trimex.py @@ -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: