Py3: a few more fixes

This commit is contained in:
DeepSOIC 2017-11-21 18:52:19 +03:00
parent 6cb43a78ae
commit 760a2c1af9
3 changed files with 15 additions and 8 deletions

View File

@ -129,6 +129,7 @@ def CreateAttachablePlacement(name):
FreeCAD.ActiveDocument.openTransaction("Create Attachable Placement")
FreeCADGui.addModule("lattice2AttachablePlacement")
FreeCADGui.addModule("lattice2Executer")
FreeCADGui.addModule("PartGui")
FreeCADGui.doCommand("f = lattice2AttachablePlacement.makeAttachablePlacement(name='"+name+"')")
FreeCADGui.doCommand("lattice2Executer.executeFeature(f)")
FreeCADGui.doCommand("PartGui.AttachmentEditor.editAttachment(f, take_selection= True,"

View File

@ -195,11 +195,14 @@ class LatticeFeature():
return []
def verifyIntegrity(self):
if self.__init__.__func__ is not LatticeFeature.__init__.__func__:
FreeCAD.Console.PrintError("__init__() of lattice object is overridden. Please don't! Fix it!\n")
if self.execute.__func__ is not LatticeFeature.execute.__func__:
FreeCAD.Console.PrintError("execute() of lattice object is overridden. Please don't! Fix it!\n")
try:
if self.__init__.__func__ is not LatticeFeature.__init__.__func__:
FreeCAD.Console.PrintError("__init__() of lattice object is overridden. Please don't! Fix it!\n")
if self.execute.__func__ is not LatticeFeature.execute.__func__:
FreeCAD.Console.PrintError("execute() of lattice object is overridden. Please don't! Fix it!\n")
except AttributeError as err:
pass # quick-n-dirty fix for Py3. TODO: restore the functionality in Py3, or remove this routine altogether.
def onChanged(self, obj, prop): #prop is a string - name of the property
if prop == 'isLattice':
if obj.ViewObject is not None:
@ -244,8 +247,11 @@ class ViewProviderLatticeFeature:
pass
def verifyIntegrity(self):
if self.__init__.__func__ is not ViewProviderLatticeFeature.__init__.__func__:
FreeCAD.Console.PrintError("__init__() of lattice object view provider is overridden. Please don't! Fix it!\n")
try:
if self.__init__.__func__ is not ViewProviderLatticeFeature.__init__.__func__:
FreeCAD.Console.PrintError("__init__() of lattice object view provider is overridden. Please don't! Fix it!\n")
except AttributeError as err:
pass # quick-n-dirty fix for Py3. TODO: restore the functionality in Py3, or remove this routine altogether.
def getIcon(self):
return getIconPath("Lattice.svg")

View File

@ -129,7 +129,7 @@ class ValueSeriesGenerator:
self.readonlynessDict[propname] = bool_writable
def _setPropertyWritable(self, propname, bool_writable, suppress_warning = False):
if self.readonlynessDict.has_key(propname):
if propname in self.readonlynessDict:
bool_writable = bool_writable and self.readonlynessDict[propname]
self.documentObject.setEditorMode(propname, 0 if bool_writable else 1)