Debian Codegraph @

src/App/LinkBaseExtension.pyi

raw
1 from Base.Metadata import export
2 from DocumentObjectExtension import DocumentObjectExtension
3 from typing import Any, Final, List, Tuple, Optional, Union, overload
4
5
6 @export(
7 Include="App/Link.h",
8 )
9 class LinkBaseExtension(DocumentObjectExtension):
10 """
11 Link extension base class
12 Author: Zheng, Lei ([email protected])
13 Licence: LGPL
14 """
15
16 LinkedChildren: Final[List[Any]] = []
17 """Return a flattened (in case grouped by plain group) list of linked children"""
18
19 def configLinkProperty(self, **kwargs) -> Any:
20 """
21 configLinkProperty(key=val,...): property configuration
22 configLinkProperty(key,...): property configuration with default name
23
24 This methode is here to implement what I called Property Design
25 Pattern. The extension operates on a predefined set of properties,
26 but it relies on the extended object to supply the actual property by
27 calling this methode. You can choose a sub set of functionality of
28 this extension by supplying only some of the supported properties.
29
30 The 'key' are names used to refer to properties supported by this
31 extension, and 'val' is the actual name of the property of your
32 object. You can obtain the key names and expected types using
33 getLinkPropertyInfo(). You can use property of derived type when
34 calling configLinkProperty(). Other types will cause exception to
35 ben thrown. The actual properties supported may be different
36 depending on the actual extension object underlying this python
37 object.
38
39 If 'val' is omitted, i.e. calling configLinkProperty(key,...), then
40 it is assumed that the actual property name is the same as 'key'
41 """
42 ...
43
44 def getLinkExtProperty(self, name: str) -> Any:
45 """
46 getLinkExtProperty(name): return the property value by its predefined name
47 """
48 ...
49
50 def getLinkExtPropertyName(self, name: str) -> str:
51 """
52 getLinkExtPropertyName(name): lookup the property name by its predefined name
53 """
54 ...
55
56 @overload
57 def getLinkPropertyInfo(self) -> tuple:
58 ...
59
60 @overload
61 def getLinkPropertyInfo(self, index: int) -> tuple:
62 ...
63
64 @overload
65 def getLinkPropertyInfo(self, name: str) -> tuple:
66 ...
67
68 def getLinkPropertyInfo(self, arg: Any = None) -> tuple:
69 """
70 getLinkPropertyInfo(): return a tuple of (name,type,doc) for all supported properties.
71
72 getLinkPropertyInfo(index): return (name,type,doc) of a specific property
73
74 getLinkPropertyInfo(name): return (type,doc) of a specific property
75 """
76 ...
77
78 def setLink(self, obj: Any, subName: Optional[str] = None, subElements: Optional[Union[str, Tuple[str, ...]]] = None) -> None:
79 """
80 setLink(obj,subName=None,subElements=None): Set link object.
81
82 setLink([obj,...]),
83 setLink([(obj,subName,subElements),...]),
84 setLink({index:obj,...}),
85 setLink({index:(obj,subName,subElements),...}): set link element of a link group.
86
87 obj (DocumentObject): the object to link to. If this is None, then the link is cleared
88
89 subName (String): Dot separated object path.
90
91 subElements (String|tuple(String)): non-object sub-elements, e.g. Face1, Edge2.
92 """
93 ...
94
95 def cacheChildLabel(self, enable: bool = True) -> None:
96 """
97 cacheChildLabel(enable=True): enable/disable child label cache
98
99 The cache is not updated on child label change for performance reason. You must
100 call this function on any child label change
101 """
102 ...
103
104 def flattenSubname(self, subname: str) -> str:
105 """
106 flattenSubname(subname) -> string
107
108 Return a flattened subname in case it references an object inside a linked plain group
109 """
110 ...
111
112 def expandSubname(self, subname: str) -> str:
113 """
114 expandSubname(subname) -> string
115
116 Return an expanded subname in case it references an object inside a linked plain group
117 """
118 ...