Draft: fix handling of MouseDelay
The MouseDelay sets a point value to None. In some cases this point was then still used resulting in attribute errors. See: https://github.com/FreeCAD/FreeCAD/issues/19531#issuecomment-2651341711
This commit is contained in:
@@ -143,6 +143,8 @@ class Arc(gui_base_original.Creator):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
|
||||
# this is to make sure radius is what you see on screen
|
||||
|
||||
@@ -93,6 +93,8 @@ class BezCurve(gui_lines.Line):
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
return
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
if arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
|
||||
# existing points + this pointer position
|
||||
@@ -283,6 +285,8 @@ class CubicBezCurve(gui_lines.Line):
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
return
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
if arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
|
||||
if (len(self.node) - 1) % self.degree == 0 and len(self.node) > 2:
|
||||
|
||||
@@ -163,6 +163,8 @@ class Ellipse(gui_base_original.Creator):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
|
||||
self.rect.update(self.point)
|
||||
|
||||
@@ -133,6 +133,8 @@ class Mirror(gui_base_original.Modifier):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
|
||||
if len(self.node) > 0:
|
||||
|
||||
@@ -161,6 +161,8 @@ class Offset(gui_base_original.Modifier):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event":
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
|
||||
if (gui_tool_utils.hasMod(arg, gui_tool_utils.get_mod_constrain_key())
|
||||
|
||||
@@ -79,6 +79,8 @@ class Point(gui_base_original.Creator):
|
||||
It should automatically update the coordinates in the widgets
|
||||
of the task panel.
|
||||
"""
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
event = event_cb.getEvent()
|
||||
mousepos = event.getPosition().getValue()
|
||||
ctrl = event.wasCtrlDown()
|
||||
@@ -101,6 +103,8 @@ class Point(gui_base_original.Creator):
|
||||
It should act as if the Enter key was pressed, or the OK button
|
||||
was pressed in the task panel.
|
||||
"""
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
if event_cb:
|
||||
event = event_cb.getEvent()
|
||||
if (event.getState() != coin.SoMouseButtonEvent.DOWN or
|
||||
|
||||
@@ -113,6 +113,8 @@ class Polygon(gui_base_original.Creator):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg)
|
||||
self.polygonTrack.update(ctrlPoint)
|
||||
|
||||
@@ -158,6 +158,8 @@ class Rectangle(gui_base_original.Creator):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
|
||||
self.rect.update(self.point)
|
||||
|
||||
@@ -102,6 +102,8 @@ class Rotate(gui_base_original.Modifier):
|
||||
"""
|
||||
if arg["Type"] == "SoKeyboardEvent" and arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event":
|
||||
self.handle_mouse_move_event(arg)
|
||||
elif (arg["Type"] == "SoMouseButtonEvent"
|
||||
|
||||
@@ -1395,6 +1395,8 @@ class Snapper:
|
||||
self.callbackMove = None
|
||||
|
||||
def move(event_cb):
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
event = event_cb.getEvent()
|
||||
mousepos = event.getPosition()
|
||||
ctrl = event.wasCtrlDown()
|
||||
@@ -1421,6 +1423,8 @@ class Snapper:
|
||||
accept()
|
||||
|
||||
def click(event_cb):
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
event = event_cb.getEvent()
|
||||
if event.getButton() == 1:
|
||||
if event.getState() == coin.SoMouseButtonEvent.DOWN:
|
||||
|
||||
@@ -85,6 +85,8 @@ class BSpline(gui_lines.Line):
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
return
|
||||
if not self.ui.mouse:
|
||||
return
|
||||
if arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.point, ctrlPoint, info = gui_tool_utils.getPoint(self, arg, noTracker=True)
|
||||
self.bsplinetrack.update(self.node + [self.point])
|
||||
|
||||
@@ -201,6 +201,8 @@ class Trimex(gui_base_original.Modifier):
|
||||
if arg["Type"] == "SoKeyboardEvent":
|
||||
if arg["Key"] == "ESCAPE":
|
||||
self.finish()
|
||||
elif not self.ui.mouse:
|
||||
pass
|
||||
elif arg["Type"] == "SoLocation2Event": # mouse movement detection
|
||||
self.shift = gui_tool_utils.hasMod(arg, gui_tool_utils.get_mod_constrain_key())
|
||||
self.alt = gui_tool_utils.hasMod(arg, gui_tool_utils.get_mod_alt_key())
|
||||
|
||||
Reference in New Issue
Block a user