Skip to content

Commit

Permalink
Draft: fixes #4100 Problems with Points command callbacks
Browse files Browse the repository at this point in the history
The point callback was not properly removed on continue mode.
  • Loading branch information
carlopav authored and yorikvanhavre committed Jun 15, 2020
1 parent 720b0b9 commit 59ed708
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Mod/Draft/draftguitools/gui_points.py
Expand Up @@ -108,13 +108,12 @@ def click(self, event_cb=None):
"""
if event_cb:
event = event_cb.getEvent()
if event.getState() != coin.SoMouseButtonEvent.DOWN:
if (event.getState() != coin.SoMouseButtonEvent.DOWN or
event.getButton() != event.BUTTON1):
return
if self.point:
self.stack.append(self.point)
if len(self.stack) == 1:
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)
# The command to run is built as a series of text strings
# to be committed through the `draftutils.todo.ToDo` class.
commitlist = []
Expand Down Expand Up @@ -151,6 +150,11 @@ def click(self, event_cb=None):
def finish(self, cont=False):
"""Terminate the operation and restart if needed."""
super(Point, self).finish()
if self.callbackClick:
self.view.removeEventCallbackPivy(coin.SoMouseButtonEvent.getClassTypeId(), self.callbackClick)
if self.callbackMove:
self.view.removeEventCallbackPivy(coin.SoLocation2Event.getClassTypeId(), self.callbackMove)

if self.ui:
if self.ui.continueMode:
self.Activated()
Expand Down

0 comments on commit 59ed708

Please sign in to comment.