Skip to content

Commit

Permalink
[Draft] Shapestring Fix Transformation Regression
Browse files Browse the repository at this point in the history
  • Loading branch information
Syres916 committed Jul 6, 2022
1 parent 91f8418 commit e96704e
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions src/Mod/Draft/draftviewproviders/view_shapestring.py
Expand Up @@ -30,7 +30,7 @@

class ViewProviderShapeString(ViewProviderDraft):

def __init__(self,vobj):
def __init__(self, vobj):

vobj.Proxy = self

Expand All @@ -40,16 +40,16 @@ def getIcon(self):

def setEdit(self, vobj, mode):

self.wb_before_edit = Gui.activeWorkbench()
Gui.activateWorkbench("DraftWorkbench")
self.task = ShapeStringTaskPanelEdit(vobj)
Gui.Control.showDialog(self.task)
if mode != 1:
self.wb_before_edit = Gui.activeWorkbench()
Gui.activateWorkbench("DraftWorkbench")
self.task = ShapeStringTaskPanelEdit(vobj)
Gui.Control.showDialog(self.task)
return True

return True
def unsetEdit(self, vobj, mode):

def unsetEdit(self,vobj,mode):

self.task.finish()
Gui.activateWorkbench(self.wb_before_edit.name())

return True
if mode != 1:
self.task.finish()
Gui.activateWorkbench(self.wb_before_edit.name())
return True

1 comment on commit e96704e

@Roy-043
Copy link
Contributor

@Roy-043 Roy-043 commented on e96704e Jul 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this in correct. We need to consider other edit modes besides 0 and 1.

Note that I am unsure about the return value of unsetEdit if mode is 0. The function unsetEdit in view_base.py always returns False.

    def setEdit(self, vobj, mode):
        if mode != 0:
            return None

        self.wb_before_edit = Gui.activeWorkbench()
        Gui.activateWorkbench("DraftWorkbench")
        self.task = ShapeStringTaskPanelEdit(vobj)
        Gui.Control.showDialog(self.task)
        return True

    def unsetEdit(self, vobj, mode):
        if mode != 0:
            return False

        self.task.finish()
        Gui.activateWorkbench(self.wb_before_edit.name())
        return False

Please sign in to comment.