Debian Codegraph @

src/App/Document.pyi

raw
1 from PropertyContainer import PropertyContainer
2 from DocumentObject import DocumentObject
3 from typing import Final, List, Tuple, Sequence
4
5
6 class Document(PropertyContainer):
7 """
8 This is a Document class
9 Author: Juergen Riegel ([email protected])
10 Licence: LGPL
11 """
12
13 DependencyGraph: Final[str] = ""
14 """The dependency graph as GraphViz text"""
15
16 ActiveObject: Final[DocumentObject] = None
17 """The last created object in this document"""
18
19 Objects: Final[List[DocumentObject]] = []
20 """The list of objects in this document"""
21
22 TopologicalSortedObjects: Final[List[DocumentObject]] = []
23 """The list of objects in this document in topological sorted order"""
24
25 RootObjects: Final[List[DocumentObject]] = []
26 """The list of root objects in this document"""
27
28 RootObjectsIgnoreLinks: Final[List[DocumentObject]] = []
29 """The list of root objects in this document ignoring references from links."""
30
31 UndoMode: int = 0
32 """The Undo mode of the Document (0 = no Undo, 1 = Undo/Redo)"""
33
34 UndoRedoMemSize: Final[int] = 0
35 """The size of the Undo stack in byte"""
36
37 UndoCount: Final[int] = 0
38 """Number of possible Undos"""
39
40 RedoCount: Final[int] = 0
41 """Number of possible Redos"""
42
43 UndoNames: Final[List[str]] = []
44 """A list of Undo names"""
45
46 RedoNames: Final[List[str]] = []
47 """A List of Redo names"""
48
49 Name: Final[str] = ""
50 """The internal name of the document"""
51
52 RecomputesFrozen: bool = False
53 """Returns or sets if automatic recomputes for this document are disabled."""
54
55 HasPendingTransaction: Final[bool] = False
56 """Check if there is a pending transaction"""
57
58 InList: Final[List["Document"]] = []
59 """A list of all documents that link to this document."""
60
61 OutList: Final[List["Document"]] = []
62 """A list of all documents that this document links to."""
63
64 Restoring: Final[bool] = False
65 """Indicate if the document is restoring"""
66
67 Partial: Final[bool] = False
68 """Indicate if the document is partially loaded"""
69
70 Importing: Final[bool] = False
71 """Indicate if the document is importing. Note the document will also report Restoring while importing"""
72
73 Recomputing: Final[bool] = False
74 """Indicate if the document is recomputing"""
75
76 Transacting: Final[bool] = False
77 """Indicate whether the document is undoing/redoing"""
78
79 OldLabel: Final[str] = ""
80 """Contains the old label before change"""
81
82 Temporary: Final[bool] = False
83 """Check if this is a temporary document"""
84
85 def save(self) -> None:
86 """
87 Save the document to disk
88 """
89 ...
90
91 def saveAs(self) -> None:
92 """
93 Save the document under a new name to disk
94 """
95 ...
96
97 def saveCopy(self) -> None:
98 """
99 Save a copy of the document under a new name to disk
100 """
101 ...
102
103 def load(self) -> None:
104 """
105 Load the document from the given path
106 """
107 ...
108
109 def restore(self) -> None:
110 """
111 Restore the document from disk
112 """
113 ...
114
115 def isSaved(self) -> bool:
116 """
117 Checks if the document is saved
118 """
119 ...
120
121 def getProgramVersion(self) -> str:
122 """
123 Get the program version that a project file was created with
124 """
125 ...
126
127 def getFileName(self) -> str:
128 """
129 For a regular document it returns its file name property.
130 For a temporary document it returns its transient directory.
131 """
132 ...
133
134 def getUniqueObjectName(self, objName: str) -> str:
135 """
136 getUniqueObjectName(objName) -> objName
137
138 Return the same name, or the name made unique, for Example Box -> Box002 if there are conflicting name
139 already in the document.
140
141 ObjName : str
142 Object name.
143 """
144 ...
145
146 def mergeProject(self) -> None:
147 """
148 Merges this document with another project file
149 """
150 ...
151
152 def exportGraphviz(self) -> None:
153 """
154 Export the dependencies of the objects as graph
155 """
156 ...
157
158 def openTransaction(self, name: str) -> None:
159 """
160 openTransaction(name) - Open a new Undo/Redo transaction.
161
162 This function no long creates a new transaction, but calls
163 FreeCAD.setActiveTransaction(name) instead, which will auto creates a
164 transaction with the given name when any change happed in any opened document.
165 If more than one document is changed, all newly created transactions will have
166 the same internal ID and will be undo/redo together.
167 """
168 ...
169
170 def abortTransaction(self) -> None:
171 """
172 Abort an Undo/Redo transaction (rollback)
173 """
174 ...
175
176 def commitTransaction(self) -> None:
177 """
178 Commit an Undo/Redo transaction
179 """
180 ...
181
182 def addObject(
183 self,
184 *,
185 type: str,
186 name: str = None,
187 objProxy: object = None,
188 viewProxy: object = None,
189 attach: bool = False,
190 viewType: str = None,
191 ) -> DocumentObject:
192 """
193 addObject(type, name=None, objProxy=None, viewProxy=None, attach=False, viewType=None)
194
195 Add an object to document
196
197 type (String): the type of the document object to create.
198 name (String): the optional name of the new object.
199 objProxy (Object): the Python binding object to attach to the new document object.
200 viewProxy (Object): the Python binding object to attach the view provider of this object.
201 attach (Boolean): if True, then bind the document object first before adding to the document
202 to allow Python code to override view provider type. Once bound, and before adding to
203 the document, it will try to call Python binding object's attach(obj) method.
204 viewType (String): override the view provider type directly, only effective when attach is False.
205 """
206 ...
207
208 def addProperty(
209 self,
210 *,
211 type: str,
212 name: str,
213 group: str = "",
214 doc: str = "",
215 attr: int = 0,
216 read_only: bool = False,
217 hidden: bool = False,
218 locked: bool = False,
219 ) -> "Document":
220 """
221 addProperty(type: string, name: string, group="", doc="", attr=0, read_only=False, hidden=False, locked=False) -- Add a generic property.
222 """
223 ...
224
225 def removeProperty(self, string: str) -> None:
226 """
227 removeProperty(string) -- Remove a generic property.
228 Note, you can only remove user-defined properties but not built-in ones.
229 """
230 ...
231
232 def removeObject(self) -> None:
233 """
234 Remove an object from the document
235 """
236 ...
237
238 def copyObject(
239 self,
240 object: DocumentObject,
241 *,
242 recursive: bool = False,
243 return_all: bool = False,
244 ) -> Tuple[DocumentObject, ...]:
245 """
246 copyObject(object, recursive=False, return_all=False)
247 Copy an object or objects from another document to this document.
248
249 object: can either be a single object or sequence of objects
250 recursive: if True, also recursively copies internal objects
251 return_all: if True, returns all copied objects, or else return only the copied
252 object corresponding to the input objects.
253 """
254 ...
255
256 def moveObject(
257 self, object: DocumentObject, with_dependencies: bool = False
258 ) -> DocumentObject:
259 """
260 moveObject(object, bool with_dependencies = False)
261 Transfers an object from another document to this document.
262
263 object: can either a single object or sequence of objects
264 with_dependencies: if True, all internal dependent objects are copied too.
265 """
266 ...
267
268 def importLinks(self, object: DocumentObject = None) -> Tuple[DocumentObject, ...]:
269 """
270 importLinks(object|[object...])
271
272 Import any externally linked object given a list of objects in
273 this document. Any link type properties of the input objects
274 will be automatically reassigned to the imported object
275
276 If no object is given as input, it import all externally linked
277 object of this document.
278 """
279 ...
280
281 def undo(self) -> None:
282 """
283 Undo one transaction
284 """
285 ...
286
287 def redo(self) -> None:
288 """
289 Redo a previously undone transaction
290 """
291 ...
292
293 def clearUndos(self) -> None:
294 """
295 Clear the undo stack of the document
296 """
297 ...
298
299 def clearDocument(self) -> None:
300 """
301 Clear the whole document
302 """
303 ...
304
305 def setClosable(self, closable: bool) -> None:
306 """
307 Set a flag that allows or forbids to close a document
308 """
309 ...
310
311 def isClosable(self) -> bool:
312 """
313 Check if the document can be closed. The default value is True
314 """
315 ...
316
317 def setAutoCreated(self, autoCreated: bool) -> None:
318 """
319 Set a flag that indicates if a document is autoCreated
320 """
321 ...
322
323 def isAutoCreated(self) -> bool:
324 """
325 Check if the document is autoCreated. The default value is False
326 """
327 ...
328
329 def recompute(self, objs: Sequence[DocumentObject] = None) -> int:
330 """
331 recompute(objs=None): Recompute the document and returns the amount of recomputed features
332 """
333 ...
334
335 def mustExecute(self) -> bool:
336 """
337 Check if any object must be recomputed
338 """
339 ...
340
341 def purgeTouched(self) -> None:
342 """
343 Purge the touched state of all objects
344 """
345 ...
346
347 def isTouched(self) -> bool:
348 """
349 Check if any object is in touched state
350 """
351 ...
352
353 def getObject(self, name: str) -> DocumentObject:
354 """
355 Return the object with the given name
356 """
357 ...
358
359 def getObjectsByLabel(self, label: str) -> List[DocumentObject]:
360 """
361 Return the objects with the given label name.
362 NOTE: It's possible that several objects have the same label name.
363 """
364 ...
365
366 def findObjects(
367 self, *, Type: str = None, Name: str = None, Label: str = None
368 ) -> List[DocumentObject]:
369 """
370 findObjects([Type=string], [Name=string], [Label=string]) -> list
371 Return a list of objects that match the specified type, name or label.
372 Name and label support regular expressions. All parameters are optional.
373 """
374 ...
375
376 def getLinksTo(
377 self, obj: DocumentObject, options: int = 0, maxCount: int = 0
378 ) -> Tuple[DocumentObject, ...]:
379 """
380 getLinksTo(obj, options=0, maxCount=0): return objects linked to 'obj'
381
382 options: 1: recursive, 2: check link array. Options can combine.
383 maxCount: to limit the number of links returned
384 """
385 ...
386
387 def supportedTypes(self) -> List[str]:
388 """
389 A list of supported types of objects
390 """
391 ...
392
393 def getTempFileName(self) -> str:
394 """
395 Returns a file name with path in the temp directory of the document.
396 """
397 ...
398
399 def getDependentDocuments(self, sort: bool = True) -> List[DocumentObject]:
400 """
401 getDependentDocuments(sort=True)
402
403 Returns a list of documents that this document directly or indirectly links to including itself.
404
405 sort: whether to topologically sort the return list
406 """
407 ...