From 0e9bbf401c99c2bd85338b3f1e7dfa68c6f37841 Mon Sep 17 00:00:00 2001 From: Markus Lampert Date: Thu, 4 Oct 2018 20:57:59 -0700 Subject: [PATCH] Cleaning up startEditing/finishEditing/isEditing --- src/Mod/Arch/ArchMaterial.py | 4 ++-- src/Mod/Arch/ArchReference.py | 2 +- src/Mod/Fem/femcommands/commands.py | 2 +- .../_ViewProviderFemConstraintFlowVelocity.py | 2 -- src/Mod/TemplatePyMod/DocumentObject.py | 9 --------- 5 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/Mod/Arch/ArchMaterial.py b/src/Mod/Arch/ArchMaterial.py index be14d22784..506d889c9b 100644 --- a/src/Mod/Arch/ArchMaterial.py +++ b/src/Mod/Arch/ArchMaterial.py @@ -121,7 +121,7 @@ class _CommandArchMaterial: for obj in sel: if hasattr(obj,"Material"): FreeCADGui.doCommand("FreeCAD.ActiveDocument.getObject(\""+obj.Name+"\").Material = mat") - FreeCADGui.doCommandGui("mat.ViewObject.startEditing()") + FreeCADGui.doCommandGui("mat.ViewObject.Document.setEdit(mat.ViewObject, 0)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() @@ -156,7 +156,7 @@ class _CommandArchMultiMaterial: if hasattr(obj,"Material"): if not obj.isDerivedFrom("App::MaterialObject"): FreeCADGui.doCommand("FreeCAD.ActiveDocument."+obj.Name+".Material = mat") - FreeCADGui.doCommandGui("mat.ViewObject.startEditing()") + FreeCADGui.doCommandGui("mat.ViewObject.Document.setEdit(mat.ViewObject, 0)") FreeCAD.ActiveDocument.commitTransaction() FreeCAD.ActiveDocument.recompute() diff --git a/src/Mod/Arch/ArchReference.py b/src/Mod/Arch/ArchReference.py index 8e3d338eb1..9b20fc5d23 100644 --- a/src/Mod/Arch/ArchReference.py +++ b/src/Mod/Arch/ArchReference.py @@ -383,7 +383,7 @@ class ArchReferenceCommand: FreeCADGui.doCommand("obj = Arch.makeReference()") FreeCADGui.doCommand("Draft.autogroup(obj)") FreeCAD.ActiveDocument.commitTransaction() - FreeCADGui.doCommand("obj.ViewObject.startEditing()") + FreeCADGui.doCommand("obj.ViewObject.Document.setEdit(obj.ViewObject, 0)") if FreeCAD.GuiUp: FreeCADGui.addCommand('Arch_Reference', ArchReferenceCommand()) diff --git a/src/Mod/Fem/femcommands/commands.py b/src/Mod/Fem/femcommands/commands.py index c2bb9c9417..90b7e55e08 100644 --- a/src/Mod/Fem/femcommands/commands.py +++ b/src/Mod/Fem/femcommands/commands.py @@ -652,7 +652,7 @@ class _CommandFemResultShow(CommandManager): self.is_active = 'with_selresult' def Activated(self): - self.selobj.ViewObject.startEditing() + self.selobj.ViewObject.Document.setEdit(self.selobj.ViewObject, 0) class _CommandFemResultsPurge(CommandManager): diff --git a/src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintFlowVelocity.py b/src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintFlowVelocity.py index c49a2dd543..45ac4f6bc3 100644 --- a/src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintFlowVelocity.py +++ b/src/Mod/Fem/femguiobjects/_ViewProviderFemConstraintFlowVelocity.py @@ -84,7 +84,6 @@ class _TaskPanel(object): self._part.ViewObject.show() def reject(self): - # self._obj.ViewObject.finishEditing() FreeCADGui.ActiveDocument.resetEdit() self._restoreVisibility() return True @@ -94,7 +93,6 @@ class _TaskPanel(object): self._obj.References = self._refWidget.references() self._applyWidgetChanges() self._obj.Document.recompute() - # self._obj.ViewObject.finishEditing() FreeCADGui.ActiveDocument.resetEdit() self._restoreVisibility() return True diff --git a/src/Mod/TemplatePyMod/DocumentObject.py b/src/Mod/TemplatePyMod/DocumentObject.py index 63e9c7b9b4..20c3f223f2 100644 --- a/src/Mod/TemplatePyMod/DocumentObject.py +++ b/src/Mod/TemplatePyMod/DocumentObject.py @@ -194,15 +194,6 @@ class ViewProvider(object): def toString(self): "returns a string representation of the coin node of this object" return self.__vobject__.toString() - def startEditing(self,mode=0): - "sets this object in edit mode" - return self.__vobject__.startEditing(mode) - def finishEditing(self): - "leaves edit mode for this object" - self.__vobject__.finishEditing() - def isEditing(self): - "shows whether this object is in edit mode" - self.__vobject__.isEditing() def setTransformation(self,trsf): "defines a transformation for this object" return self.__vobject__.setTransformation(trsf)