Include other Draft commands
This commit is contained in:
@@ -124,11 +124,15 @@ class CircularArray(gui_base.GuiCommandBase):
|
||||
We should remove the callbacks that were added to the 3D view
|
||||
and then close the task panel.
|
||||
"""
|
||||
self.view.removeEventCallbackPivy(self.location,
|
||||
self.callback_move)
|
||||
self.view.removeEventCallbackPivy(self.mouse_event,
|
||||
self.callback_click)
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
self.view.removeEventCallbackPivy(self.location, self.callback_move)
|
||||
self.view.removeEventCallbackPivy(self.mouse_event, self.callback_click)
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callback_move = None
|
||||
self.callback_click = None
|
||||
if Gui.Control.activeDialog():
|
||||
Gui.Control.closeDialog()
|
||||
self.finish()
|
||||
|
||||
@@ -111,11 +111,13 @@ class OrthoArray(gui_base.GuiCommandBase):
|
||||
We should remove the callbacks that were added to the 3D view
|
||||
and then close the task panel.
|
||||
"""
|
||||
# self.view.removeEventCallbackPivy(self.location,
|
||||
# self.callback_move)
|
||||
self.view.removeEventCallbackPivy(self.mouse_event,
|
||||
self.callback_click)
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
self.view.removeEventCallbackPivy(self.mouse_event, self.callback_click)
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callback_click = None
|
||||
if Gui.Control.activeDialog():
|
||||
Gui.Control.closeDialog()
|
||||
self.finish()
|
||||
|
||||
@@ -143,13 +143,17 @@ class Point(gui_base_original.Creator):
|
||||
Restart (continue) the command if `True`, or if `None` and
|
||||
`ui.continueMode` is `True`.
|
||||
"""
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callbackClick = None
|
||||
self.callbackMove = None
|
||||
super().finish()
|
||||
|
||||
@@ -124,11 +124,15 @@ class PolarArray(gui_base.GuiCommandBase):
|
||||
We should remove the callbacks that were added to the 3D view
|
||||
and then close the task panel.
|
||||
"""
|
||||
self.view.removeEventCallbackPivy(self.location,
|
||||
self.callback_move)
|
||||
self.view.removeEventCallbackPivy(self.mouse_event,
|
||||
self.callback_click)
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
self.view.removeEventCallbackPivy(self.location, self.callback_move)
|
||||
self.view.removeEventCallbackPivy(self.mouse_event, self.callback_click)
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callback_move = None
|
||||
self.callback_click = None
|
||||
if Gui.Control.activeDialog():
|
||||
Gui.Control.closeDialog()
|
||||
self.finish()
|
||||
|
||||
@@ -1385,13 +1385,17 @@ class Snapper:
|
||||
self.view = Draft.get3DView()
|
||||
|
||||
# remove any previous leftover callbacks
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callbackClick = None
|
||||
self.callbackMove = None
|
||||
|
||||
@@ -1428,13 +1432,17 @@ class Snapper:
|
||||
accept()
|
||||
|
||||
def accept():
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callbackClick = None
|
||||
self.callbackMove = None
|
||||
Gui.Snapper.off()
|
||||
@@ -1450,13 +1458,17 @@ class Snapper:
|
||||
self.pt = None
|
||||
|
||||
def cancel():
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
try:
|
||||
if self.callbackClick:
|
||||
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
|
||||
if self.callbackMove:
|
||||
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
|
||||
if self.callbackClick or self.callbackMove:
|
||||
# Next line fixes https://github.com/FreeCAD/FreeCAD/issues/10469:
|
||||
gui_utils.end_all_events()
|
||||
except RuntimeError:
|
||||
# the view has been deleted already
|
||||
pass
|
||||
self.callbackClick = None
|
||||
self.callbackMove = None
|
||||
Gui.Snapper.off()
|
||||
|
||||
@@ -478,7 +478,8 @@ class TaskPanelCircularArray:
|
||||
the delayed functions, and perform cleanup.
|
||||
"""
|
||||
# App.ActiveDocument.commitTransaction()
|
||||
Gui.ActiveDocument.resetEdit()
|
||||
if Gui.ActiveDocument is not None:
|
||||
Gui.ActiveDocument.resetEdit()
|
||||
# Runs the parent command to complete the call
|
||||
self.source_command.completed()
|
||||
|
||||
|
||||
@@ -386,7 +386,8 @@ class TaskPanelOrthoArray:
|
||||
the delayed functions, and perform cleanup.
|
||||
"""
|
||||
# App.ActiveDocument.commitTransaction()
|
||||
Gui.ActiveDocument.resetEdit()
|
||||
if Gui.ActiveDocument is not None:
|
||||
Gui.ActiveDocument.resetEdit()
|
||||
# Runs the parent command to complete the call
|
||||
self.source_command.completed()
|
||||
|
||||
|
||||
@@ -431,7 +431,8 @@ class TaskPanelPolarArray:
|
||||
the delayed functions, and perform cleanup.
|
||||
"""
|
||||
# App.ActiveDocument.commitTransaction()
|
||||
Gui.ActiveDocument.resetEdit()
|
||||
if Gui.ActiveDocument is not None:
|
||||
Gui.ActiveDocument.resetEdit()
|
||||
# Runs the parent command to complete the call
|
||||
self.source_command.completed()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user