Debian Codegraph @

src/App/DocumentObject.pyi

raw
1 from Base.Metadata import constmethod
2 from Base.Matrix import Matrix
3 from Document import Document
4 from DocumentObjectGroup import DocumentObjectGroup
5 from ExtensionContainer import ExtensionContainer
6 from typing import Any, Final, List, Optional, Union, Tuple
7
8
9 class DocumentObject(ExtensionContainer):
10 """
11 This is the father of all classes handled by the document
12 Author: Juergen Riegel ([email protected])
13 Licence: LGPL
14 """
15
16 OutList: Final[List["DocumentObject"]] = []
17 """A list of all objects this object links to."""
18
19 OutListRecursive: Final[List["DocumentObject"]] = []
20 """A list of all objects this object links to recursively."""
21
22 InList: Final[List["DocumentObject"]] = []
23 """A list of all objects which link to this object."""
24
25 InListRecursive: Final[List["DocumentObject"]] = []
26 """A list of all objects which link to this object recursively."""
27
28 FullName: Final[str] = ""
29 """Return the document name and internal name of this object"""
30
31 Name: Final[Optional[str]] = ""
32 """Return the internal name of this object"""
33
34 Document: Final[Document] = None
35 """Return the document this object is part of"""
36
37 State: Final[List[Any]] = []
38 """State of the object in the document"""
39
40 ViewObject: Final[Any] = None
41 """
42 If the GUI is loaded the associated view provider is returned
43 or None if the GUI is not up
44 """
45
46 MustExecute: Final[bool] = False
47 """Check if the object must be recomputed"""
48
49 ID: Final[int] = 0
50 """The unique identifier (among its document) of this object"""
51
52 Removing: Final[bool] = False
53 """Indicate if the object is being removed"""
54
55 Parents: Final[List[Any]] = []
56 """A List of tuple(parent,subname) holding all parents to this object"""
57
58 OldLabel: Final[str] = ""
59 """Contains the old label before change"""
60
61 NoTouch: bool = False
62 """Enable/disable no touch on any property change"""
63
64 def addProperty(
65 self,
66 *,
67 type: str,
68 name: str,
69 group: str = "",
70 doc: str = "",
71 attr: int = 0,
72 read_only: bool = False,
73 hidden: bool = False,
74 locked: bool = False,
75 enum_vals: list = []
76 ) -> "DocumentObject":
77 """
78 addProperty(type: string, name: string, group="", doc="", attr=0, read_only=False, hidden=False, locked = False, enum_vals=[]) -- Add a generic property.
79 """
80 ...
81
82 def removeProperty(self, string: str) -> None:
83 """
84 removeProperty(string) -- Remove a generic property.
85
86 Note, you can only remove user-defined properties but not built-in ones.
87 """
88 ...
89
90 def supportedProperties(self) -> list:
91 """
92 A list of supported property types
93 """
94 ...
95
96 def touch(self) -> None:
97 """
98 Mark the object as changed (touched)
99 """
100 ...
101
102 def purgeTouched(self) -> None:
103 """
104 Mark the object as unchanged
105 """
106 ...
107
108 def enforceRecompute(self) -> None:
109 """
110 Mark the object for recompute
111 """
112 ...
113
114 def setExpression(self, name: str, expression: str) -> None:
115 """
116 Register an expression for a property
117 """
118 ...
119
120 def clearExpression(self, name: str) -> None:
121 """
122 Clear the expression for a property
123 """
124 ...
125
126 @classmethod
127 def evalExpression(cls, expression: str) -> Any:
128 """
129 Evaluate an expression
130 """
131 ...
132
133 def recompute(self, recursive: bool = False) -> None:
134 """
135 recompute(recursive=False): Recomputes this object
136 """
137 ...
138
139 @constmethod
140 def getStatusString(self) -> str:
141 """
142 Returns the status of the object as string.
143 If the object is invalid its error description will be returned.
144 If the object is valid but touched then 'Touched' will be returned,
145 'Valid' otherwise.
146 """
147 ...
148
149 @constmethod
150 def isValid(self) -> bool:
151 """
152 Returns True if the object is valid, False otherwise
153 """
154 ...
155
156 def getSubObject(
157 self,
158 *,
159 subname: Union[str, List[str], Tuple[str, ...]],
160 retType: int = 0,
161 matrix: Matrix = None,
162 transform: bool = True,
163 depth: int = 0,
164 ) -> Any:
165 """
166 getSubObject(subname, retType=0, matrix=None, transform=True, depth=0)
167
168 * subname(string|list|tuple): dot separated string or sequence of strings
169 referencing subobject.
170
171 * retType: return type, 0=PyObject, 1=DocObject, 2=DocAndPyObject, 3=Placement
172
173 PyObject: return a python binding object for the (sub)object referenced in
174 each 'subname' The actual type of 'PyObject' is implementation dependent.
175 For Part::Feature compatible objects, this will be of type TopoShapePy and
176 pre-transformed by accumulated transformation matrix along the object path.
177
178 DocObject: return the document object referenced in subname, if 'matrix' is
179 None. Or, return a tuple (object, matrix) for each 'subname' and 'matrix' is
180 the accumulated transformation matrix for the sub object.
181
182 DocAndPyObject: return a tuple (object, matrix, pyobj) for each subname
183
184 Placement: return a transformed placement of the sub-object
185
186 * matrix: the initial transformation to be applied to the sub object.
187
188 * transform: whether to transform the sub object using this object's placement
189
190 * depth: current recursive depth
191 """
192 ...
193
194 def getSubObjectList(self, subname: str) -> list:
195 """
196 getSubObjectList(subname)
197
198 Return a list of objects referenced by a given subname including this object
199 """
200 ...
201
202 def getSubObjects(self, reason: int = 0) -> list:
203 """
204 getSubObjects(reason=0): Return subname reference of all sub-objects
205 """
206 ...
207
208 def getLinkedObject(
209 self,
210 *,
211 recursive: bool = True,
212 matrix: Matrix = None,
213 transform: bool = True,
214 depth: int = 0,
215 ) -> Any:
216 """
217 getLinkedObject(recursive=True, matrix=None, transform=True, depth=0)
218 Returns the linked object if there is one, or else return itself
219
220 * recursive: whether to recursively resolve the links
221
222 * transform: whether to transform the sub object using this object's placement
223
224 * matrix: If not none, this specifies the initial transformation to be applied
225 to the sub object. And cause the method to return a tuple (object, matrix)
226 containing the accumulated transformation matrix
227
228 * depth: current recursive depth
229 """
230 ...
231
232 def setElementVisible(self, element: str, visible: bool) -> int:
233 """
234 setElementVisible(element,visible): Set the visibility of a child element
235 Return -1 if element visibility is not supported, 0 if element not found, 1 if success
236 """
237 ...
238
239 def isElementVisible(self, element: str) -> int:
240 """
241 isElementVisible(element): Check if a child element is visible
242 Return -1 if element visibility is not supported or element not found, 0 if invisible, or else 1
243 """
244 ...
245
246 def hasChildElement(self) -> bool:
247 """
248 Return true to indicate the object having child elements
249 """
250 ...
251
252 def getParentGroup(self) -> DocumentObjectGroup:
253 """
254 Returns the group the object is in or None if it is not part of a group.
255
256 Note that an object can only be in a single group, hence only a single return value.
257 """
258 ...
259
260 def getParentGeoFeatureGroup(self) -> Any:
261 """
262 Returns the GeoFeatureGroup, and hence the local coordinate system, the object
263 is in or None if it is not part of a group.
264
265 Note that an object can only be in a single group, hence only a single return value.
266 """
267 ...
268
269 def getParent(self) -> Any:
270 """
271 Returns the group the object is in or None if it is not part of a group.
272
273 Note that an object can only be in a single group, hence only a single return value.
274 The parent can be a simple group as with getParentGroup() or a GeoFeature group as
275 with getParentGeoFeatureGroup().
276 """
277 ...
278
279 def getPathsByOutList(self) -> list:
280 """
281 Get all paths from this object to another object following the OutList.
282 """
283 ...
284
285 @constmethod
286 def resolve(self, subname: str) -> tuple:
287 """
288 resolve(subname) -- resolve the sub object
289
290 Returns a tuple (subobj,parent,elementName,subElement), where 'subobj' is the
291 last object referenced in 'subname', and 'parent' is the direct parent of
292 'subobj', and 'elementName' is the name of the subobj, which can be used
293 to call parent.isElementVisible/setElementVisible(). 'subElement' is the
294 non-object sub-element name if any.
295 """
296 ...
297
298 @constmethod
299 def resolveSubElement(self, subname: str, append: bool, type: int) -> tuple:
300 """
301 resolveSubElement(subname,append,type) -- resolve both new and old style sub element
302
303 subname: subname reference containing object hierarchy
304 append: Whether to append object hierarchy prefix inside subname to returned element name
305 type: 0: normal, 1: for import, 2: for export
306
307 Return tuple(obj,newElementName,oldElementName)
308 """
309 ...
310
311 def adjustRelativeLinks(self, parent: DocumentObject, recursive: bool = True) -> bool:
312 """
313 adjustRelativeLinks(parent,recursive=True) -- auto correct potential cyclic dependencies
314 """
315 ...
316
317 @constmethod
318 def getElementMapVersion(self, property_name: str) -> str:
319 """
320 getElementMapVersion(property_name): return element map version of a given geometry property
321 """
322 ...
323
324 @constmethod
325 def isAttachedToDocument(self) -> bool:
326 """
327 isAttachedToDocument() -> bool
328
329 Return true if the object is part of a document, false otherwise.
330 """
331 ...
332
333 def getPlacementOf(self, subname: str, target: DocumentObject = None, /) -> Any:
334 """
335 Return the placement of the sub-object relative to the link object.
336 getPlacementOf(subname, [targetObj]) -> Base.Placement
337 """
338 ...