From 136f2615e9946bd7dd052f9f1270acfd41a7c76f Mon Sep 17 00:00:00 2001 From: carlopav Date: Sun, 14 Jun 2020 22:51:50 +0200 Subject: [PATCH] Draft: fixes #4100 Problems with Points command callbacks The point callback was not properly removed on continue mode. --- src/Mod/Draft/draftguitools/gui_points.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Mod/Draft/draftguitools/gui_points.py b/src/Mod/Draft/draftguitools/gui_points.py index 677f2af88f..6804bdc568 100644 --- a/src/Mod/Draft/draftguitools/gui_points.py +++ b/src/Mod/Draft/draftguitools/gui_points.py @@ -108,13 +108,12 @@ class Point(gui_base_original.Creator): """ 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 = [] @@ -151,6 +150,11 @@ class Point(gui_base_original.Creator): 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()