00001
00002
00003
00004 class DocumentObject(object):
00005 def __init__(self):
00006 self.__object__=None
00007 def execute(self):
00008 raise Exception("Not yet implemented")
00009
00010
00011
00012
00013
00014
00015
00016 def addProperty(self,type,name='',group='',doc='',attr=0,readonly=False,hidden=False):
00017 self.__object__.addProperty(type,name,group,doc,attr,readonly,hidden)
00018 def supportedProperties(self):
00019 return self.__object__.supportedProperties()
00020 def isDerivedFrom(self, obj):
00021 return self.__object__.isDerivedFrom(obj)
00022 def getAllDerivedFrom(self):
00023 return self.__object__.getAllDerivedFrom()
00024 def getProperty(self,attr):
00025 return self.__object__.getPropertyByName(attr)
00026 def getTypeOfProperty(self,attr):
00027 return self.__object__.getTypeOfProperty(attr)
00028 def getGroupOfProperty(self,attr):
00029 return self.__object__.getGroupOfProperty(attr)
00030 def getDocumentationOfProperty(self,attr):
00031 return self.__object__.getDocumentationOfProperty(attr)
00032 def touch(self):
00033 return self.__object__.touch()
00034 def purgeTouched(self):
00035 return self.__object__.purgeTouched()
00036 def __setstate__(self,value):
00037 return None
00038 def __getstate__(self):
00039 return None
00040 @property
00041 def PropertiesList(self):
00042 return self.__object__.PropertiesList
00043 @property
00044 def Type(self):
00045 return self.__object__.Type
00046 @property
00047 def Module(self):
00048 return self.__object__.Module
00049 @property
00050 def Content(self):
00051 return self.__object__.Content
00052 @property
00053 def MemSize(self):
00054 return self.__object__.MemSize
00055 @property
00056 def Name(self):
00057 return self.__object__.Name
00058 @property
00059 def Document(self):
00060 return self.__object__.Document
00061 @property
00062 def State(self):
00063 return self.__object__.State
00064 @property
00065 def ViewObject(self):
00066 return self.__object__.ViewObject
00067 @ViewObject.setter
00068 def ViewObject(self,value):
00069 self.__object__.ViewObject=value
00070 @property
00071 def InList(self):
00072 return self.__object__.InList
00073 @property
00074 def OutList(self):
00075 return self.__object__.OutList
00076
00077 class ViewProvider(object):
00078 def __init__(self):
00079 self.__vobject__=None
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 def addDisplayMode(self,node,mode):
00095 self.__vobject__.addDisplayMode(node,mode)
00096
00097
00098
00099
00100
00101
00102 def addProperty(self,type,name='',group='',doc='',attr=0,readonly=False,hidden=False):
00103 self.__vobject__.addProperty(type,name,group,doc,attr,readonly,hidden)
00104 def update(self):
00105 self.__vobject__.update()
00106 def show(self):
00107 self.__vobject__.show()
00108 def hide(self):
00109 self.__vobject__.hide()
00110 def isVisible(self):
00111 return self.__vobject__.isVisible()
00112 def toString(self):
00113 return self.__vobject__.toString()
00114 def startEditing(self,mode=0):
00115 return self.__vobject__.startEditing(mode)
00116 def finishEditing(self):
00117 self.__vobject__.finishEditing()
00118 def isEditing(self):
00119 self.__vobject__.isEditing()
00120 def setTransformation(self,trsf):
00121 return self.__vobject__.setTransformation(trsf)
00122 def supportedProperties(self):
00123 return self.__vobject__.supportedProperties()
00124 def isDerivedFrom(self, obj):
00125 return self.__vobject__.isDerivedFrom(obj)
00126 def getAllDerivedFrom(self):
00127 return self.__vobject__.getAllDerivedFrom()
00128 def getProperty(self,attr):
00129 return self.__vobject__.getPropertyByName(attr)
00130 def getTypeOfProperty(self,attr):
00131 return self.__vobject__.getTypeOfProperty(attr)
00132 def getGroupOfProperty(self,attr):
00133 return self.__vobject__.getGroupOfProperty(attr)
00134 def getDocumentationOfProperty(self,attr):
00135 return self.__vobject__.getDocumentationOfProperty(attr)
00136 @property
00137 def Annotation(self):
00138 return self.__vobject__.Annotation
00139 @property
00140 def RootNode(self):
00141 return self.__vobject__.RootNode
00142 @property
00143 def DisplayModes(self):
00144 return self.__vobject__.listDisplayModes()
00145 @property
00146 def PropertiesList(self):
00147 return self.__vobject__.PropertiesList
00148 @property
00149 def Type(self):
00150 return self.__vobject__.Type
00151 @property
00152 def Module(self):
00153 return self.__vobject__.Module
00154 @property
00155 def Content(self):
00156 return self.__vobject__.Content
00157 @property
00158 def MemSize(self):
00159 return self.__vobject__.MemSize
00160 @property
00161 def Object(self):
00162 return self.__vobject__.Object
00163
00164
00165
00166
00167
00168 class MyFeature(DocumentObject):
00169 def execute(self):
00170 print "Execute my feature"
00171 def onChanged(self,prop):
00172 print "Property %s has changed" % (prop)
00173
00174 def testMethod():
00175 import FreeCAD
00176 doc=FreeCAD.newDocument()
00177 obj=MyFeature()
00178 doc.addObject("Mesh::FeaturePython","MyName",obj,None)
00179 obj.addProperty("App::PropertyLinkList","Layers","Base", "Layers")