[ Fixed ] Escape switches off continueMode?

A forum dedicated to the Draft, Arch and BIM workbenches development.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

[ Fixed ] Escape switches off continueMode?

Post by Roy_043 »

At first I thought that the Draft_ToggleConstructionMode command did not work properly. Upon further analysis I find that the "Escape" behavior is causing confusion.

DraftGui.py:

Code: Select all

    def escape(self):
        """escapes the current command"""
        self.continueMode = False
        if not self.taskmode:
            # self.taskmode == 0  Draft toolbar is obsolete and has been disabled (February 2020)
            self.continueCmd.setChecked(False)
        self.finish()
IMO the using Esc should not set continueMode to False.

I suppose this function in DraftGui.py should also be changed (but I do not know when it is triggered):

Code: Select all

    def Deactivated(self):
        if (FreeCAD.activeDraftCommand != None):
            self.continueMode = False
            FreeCAD.activeDraftCommand.finish()
        if self.taskmode:
            FreeCADGui.Control.clearTaskWatcher()
            #self.tray = None
            if hasattr(self,"tray"):
                self.tray.hide()
        else: # self.taskmode == 0  Draft toolbar is obsolete and has been disabled (February 2020)
            self.draftWidget.setVisible(False)
            self.draftWidget.toggleViewAction().setVisible(False)
Last edited by Roy_043 on Wed Oct 19, 2022 2:35 pm, edited 1 time in total.
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: Escape switches off continueMode?

Post by Roy_043 »

Q&D fix:

Code: Select all

    def escape(self):
        """escapes the current command"""
        if self.continueMode == True:
            self.continueMode = False
            self.finish()
            self.continueMode = True
        else:
            self.finish()
User avatar
Roy_043
Veteran
Posts: 8450
Joined: Thu Dec 27, 2018 12:28 pm

Re: [ Fixed ] Escape switches off continueMode?

Post by Roy_043 »

Post Reply