Merge pull request #24262 from mnesarco/pyi-fixes-1
This commit is contained in:
@@ -1,38 +1,34 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.PyObjectBase import PyObjectBase
|
||||
from typing import List
|
||||
|
||||
|
||||
class ApplicationDirectories(PyObjectBase):
|
||||
"""
|
||||
App.ApplicationDirectories class.
|
||||
Provides access to the directory versioning methods of its C++ counterpart.
|
||||
|
||||
For the time being this class only provides access to the directory versioning methods of its
|
||||
C++ counterpart. These are all static methods, so no instance is needed. The main methods of
|
||||
These are all static methods, so no instance is needed. The main methods of
|
||||
this class are migrateAllPaths(), usingCurrentVersionConfig(), and versionStringForPath().
|
||||
|
||||
Author: Chris Hennes (chennes@pioneerlibrarysystem.org)
|
||||
Licence: LGPL-2.1-or-later
|
||||
DeveloperDocu: ApplicationDirectories
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def usingCurrentVersionConfig(path:str) -> bool:
|
||||
def usingCurrentVersionConfig(path: str, /) -> bool:
|
||||
"""
|
||||
usingCurrentVersionConfig(path)
|
||||
Determine if a given config path is for the current version of the program.
|
||||
|
||||
Determine if a given config path is for the current version of the program
|
||||
|
||||
path : the path to check
|
||||
Args:
|
||||
path: The path to check.
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def migrateAllPaths(paths: List[str]) -> None:
|
||||
def migrateAllPaths(paths: list[str], /) -> None:
|
||||
"""
|
||||
migrateAllPaths(paths)
|
||||
Migrate a set of versionable configuration directories from the given paths to a new version.
|
||||
|
||||
Migrate a set of versionable configuration directories from the given paths to a new
|
||||
version. The new version's directories cannot exist yet, and the old ones *must* exist.
|
||||
The new version's directories cannot exist yet, and the old ones *must* exist.
|
||||
If the old paths are themselves versioned, then the new paths will be placed at the same
|
||||
level in the directory structure (e.g., they will be siblings of each entry in paths).
|
||||
If paths are NOT versioned, the new (versioned) copies will be placed *inside* the
|
||||
@@ -41,6 +37,9 @@ class ApplicationDirectories(PyObjectBase):
|
||||
If the list contains the same path multiple times, the duplicates are ignored, so it is safe
|
||||
to pass the same path multiple times.
|
||||
|
||||
Args:
|
||||
paths: List of paths to migrate from.
|
||||
|
||||
Examples:
|
||||
Running FreeCAD 1.1, /usr/share/FreeCAD/Config/ -> /usr/share/FreeCAD/Config/v1-1/
|
||||
Running FreeCAD 1.1, /usr/share/FreeCAD/Config/v1-1 -> raises exception, path exists
|
||||
@@ -49,60 +48,80 @@ class ApplicationDirectories(PyObjectBase):
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def versionStringForPath(major:int, minor:int) -> str:
|
||||
def versionStringForPath(major: int, minor: int, /) -> str:
|
||||
"""
|
||||
versionStringForPath(major, minor) -> str
|
||||
Given a major and minor version number, return the name for a versioned subdirectory.
|
||||
|
||||
Given a major and minor version number, return a string that can be used as the name for a
|
||||
versioned subdirectory. Only returns the version string, not the full path.
|
||||
Args:
|
||||
major: Major version number.
|
||||
minor: Minor version number.
|
||||
|
||||
Returns:
|
||||
A string that can be used as the name for a versioned subdirectory.
|
||||
Only returns the version string, not the full path.
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def isVersionedPath(startingPath:str) -> bool:
|
||||
def isVersionedPath(startingPath: str, /) -> bool:
|
||||
"""
|
||||
isVersionedPath(startingPath) -> bool
|
||||
Determine if a given path is versioned.
|
||||
|
||||
Determine if a given path is versioned (that is, if its last component contains
|
||||
something that this class would have created as a versioned subdirectory). Returns true
|
||||
for any path that the *current* version of FreeCAD would recognized as versioned, and false
|
||||
for either something that is not versioned, or something that is versioned but for a later
|
||||
version of FreeCAD.
|
||||
That is, if its last component contains something that this class would have
|
||||
created as a versioned subdirectory).
|
||||
|
||||
Args:
|
||||
startingPath: The path to check.
|
||||
|
||||
Returns:
|
||||
True for any path that the *current* version of FreeCAD would recognize as versioned,
|
||||
and False for either something that is not versioned, or something that is versioned
|
||||
but for a later version of FreeCAD.
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def mostRecentAvailableConfigVersion(startingPath:str) -> str:
|
||||
def mostRecentAvailableConfigVersion(startingPath: str, /) -> str:
|
||||
"""
|
||||
mostRecentAvailableConfigVersion(startingPath) -> str
|
||||
|
||||
Given a base path that is expected to contain versioned subdirectories, locate the
|
||||
directory name (*not* the path, only the final component, the version string itself)
|
||||
corresponding to the most recent version of the software, up to and including the current
|
||||
running version, but NOT exceeding it -- any *later* version whose directories exist
|
||||
in the path is ignored. See also mostRecentConfigFromBase().
|
||||
|
||||
Args:
|
||||
startingPath: The path to check.
|
||||
|
||||
Returns:
|
||||
Most recent available dir name (not path).
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def mostRecentConfigFromBase(startingPath: str) -> str:
|
||||
def mostRecentConfigFromBase(startingPath: str, /) -> str:
|
||||
"""
|
||||
mostRecentConfigFromBase(startingPath) -> str
|
||||
|
||||
Given a base path that is expected to contained versioned subdirectories, locate the
|
||||
directory corresponding to the most recent version of the software, up to and including
|
||||
the current version, but NOT exceeding it. Returns the complete path, not just the final
|
||||
component. See also mostRecentAvailableConfigVersion().
|
||||
|
||||
Args:
|
||||
startingPath: The base path to check.
|
||||
|
||||
Returns:
|
||||
Most recent available full path (not just dir name).
|
||||
"""
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def migrateConfig(oldPath: str, newPath: str) -> None:
|
||||
def migrateConfig(oldPath: str, newPath: str, /) -> None:
|
||||
"""
|
||||
migrateConfig(oldPath, newPath) -> None
|
||||
|
||||
A utility method to copy all files and directories from oldPath to newPath, handling the
|
||||
case where newPath might itself be a subdirectory of oldPath (and *not* attempting that
|
||||
otherwise-recursive copy).
|
||||
|
||||
Args:
|
||||
oldPath: Path from.
|
||||
newPath: Path to.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, constmethod
|
||||
from Base.Persistence import Persistence
|
||||
from Base.BoundBox import BoundBox as BoundBoxPy
|
||||
from Base.BoundBox import BoundBox
|
||||
from Base.Vector import Vector
|
||||
from Base.Placement import Placement as PlacementPy
|
||||
from Base.Placement import Placement
|
||||
from Base.Rotation import Rotation
|
||||
from Base.Matrix import Matrix
|
||||
from StringHasher import StringHasher
|
||||
from typing import Any, Final, List, Dict
|
||||
from typing import Any, Final
|
||||
|
||||
|
||||
@export(
|
||||
@@ -15,89 +19,94 @@ from typing import Any, Final, List, Dict
|
||||
)
|
||||
class ComplexGeoData(Persistence):
|
||||
"""
|
||||
Data.ComplexGeoData class.
|
||||
|
||||
Author: Juergen Riegel (Juergen.Riegel@web.de)
|
||||
Licence: LGPL
|
||||
UserDocu: Father of all complex geometric data types
|
||||
Father of all complex geometric data types.
|
||||
"""
|
||||
|
||||
@constmethod
|
||||
def getElementTypes(self) -> List[str]:
|
||||
def getElementTypes(self) -> list[str]:
|
||||
"""
|
||||
Return a list of element types present in the complex geometric data
|
||||
Return a list of element types present in the complex geometric data.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def countSubElements(self) -> int:
|
||||
"""
|
||||
Return the number of elements of a type
|
||||
Return the number of elements of a type.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getFacesFromSubElement(self) -> Any:
|
||||
def getFacesFromSubElement(self, ) -> tuple[list[Vector], list[tuple[int, int, int]]]:
|
||||
"""
|
||||
Return vertexes and faces from a sub-element
|
||||
Return vertexes and faces from a sub-element.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getLinesFromSubElement(self) -> Any:
|
||||
def getLinesFromSubElement(self, ) -> tuple[list[Vector], list[tuple[int, int]]]:
|
||||
"""
|
||||
Return vertexes and lines from a sub-element
|
||||
Return vertexes and lines from a sub-element.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getPoints(self) -> Any:
|
||||
def getPoints(self) -> tuple[list[Vector], list[Vector]]:
|
||||
"""
|
||||
Return a tuple of points and normals with a given accuracy
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getLines(self) -> Any:
|
||||
def getLines(self) -> tuple[list[Vector], list[tuple[int, int]]]:
|
||||
"""
|
||||
Return a tuple of points and lines with a given accuracy
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getFaces(self) -> Any:
|
||||
def getFaces(self) -> tuple[list[Vector], list[tuple[int, int, int]]]:
|
||||
"""
|
||||
Return a tuple of points and triangles with a given accuracy
|
||||
"""
|
||||
...
|
||||
|
||||
def applyTranslation(self, translation: Vector) -> None:
|
||||
def applyTranslation(self, translation: Vector, /) -> None:
|
||||
"""
|
||||
Apply an additional translation to the placement
|
||||
"""
|
||||
...
|
||||
|
||||
def applyRotation(self, rotation: Rotation) -> None:
|
||||
def applyRotation(self, rotation: Rotation, /) -> None:
|
||||
"""
|
||||
Apply an additional rotation to the placement
|
||||
"""
|
||||
...
|
||||
|
||||
def transformGeometry(self, transformation: Matrix) -> None:
|
||||
def transformGeometry(self, transformation: Matrix, /) -> None:
|
||||
"""
|
||||
Apply a transformation to the underlying geometry
|
||||
"""
|
||||
...
|
||||
|
||||
def setElementName(self, *, element: str, name: str = None, postfix: str = None, overwrite: bool = False, sid: Any = None) -> None:
|
||||
def setElementName(
|
||||
self,
|
||||
*,
|
||||
element: str,
|
||||
name: str = None,
|
||||
postfix: str = None,
|
||||
overwrite: bool = False,
|
||||
sid: Any = None,
|
||||
) -> None:
|
||||
"""
|
||||
setElementName(element,name=None,postfix=None,overwrite=False,sid=None), Set an element name
|
||||
Set an element name.
|
||||
|
||||
element : the original element name, e.g. Edge1, Vertex2
|
||||
name : the new name for the element, None to remove the mapping
|
||||
postfix : postfix of the name that will not be hashed
|
||||
overwrite: if true, it will overwrite exiting name
|
||||
sid : to hash the name any way you want, provide your own string id(s) in this parameter
|
||||
Args:
|
||||
element : the original element name, e.g. Edge1, Vertex2
|
||||
name : the new name for the element, None to remove the mapping
|
||||
postfix : postfix of the name that will not be hashed
|
||||
overwrite: if true, it will overwrite exiting name
|
||||
sid : to hash the name any way you want, provide your own string id(s) in this parameter
|
||||
|
||||
An element can have multiple mapped names. However, a name can only be mapped
|
||||
to one element
|
||||
@@ -105,33 +114,33 @@ class ComplexGeoData(Persistence):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getElementName(self, name: str, direction: int = 0) -> Any:
|
||||
def getElementName(self, name: str, direction: int = 0, /) -> str:
|
||||
"""
|
||||
getElementName(name,direction=0) - Return a mapped element name or reverse
|
||||
Return a mapped element name or reverse.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getElementIndexedName(self, name: str) -> Any:
|
||||
def getElementIndexedName(self, name: str, /) -> str | tuple[str, list[int]]:
|
||||
"""
|
||||
getElementIndexedName(name) - Return the indexed element name
|
||||
Return the indexed element name.
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getElementMappedName(self, name: str) -> Any:
|
||||
def getElementMappedName(self, name: str, /) -> str | tuple[str, list[int]]:
|
||||
"""
|
||||
getElementMappedName(name) - Return the mapped element name
|
||||
Return the mapped element name
|
||||
"""
|
||||
...
|
||||
|
||||
BoundBox: Final[BoundBoxPy] = ...
|
||||
BoundBox: Final[BoundBox] = ...
|
||||
"""Get the bounding box (BoundBox) of the complex geometric data."""
|
||||
|
||||
CenterOfGravity: Final[Vector] = ...
|
||||
"""Get the center of gravity"""
|
||||
|
||||
Placement: PlacementPy = ...
|
||||
Placement: Placement = ...
|
||||
"""Get the current transformation of the object as placement"""
|
||||
|
||||
Tag: int = 0
|
||||
@@ -143,10 +152,10 @@ class ComplexGeoData(Persistence):
|
||||
ElementMapSize: Final[int] = 0
|
||||
"""Get the current element map size"""
|
||||
|
||||
ElementMap: Dict[Any, Any] = {}
|
||||
ElementMap: dict[str, str] = {}
|
||||
"""Get/Set a dict of element mapping"""
|
||||
|
||||
ElementReverseMap: Final[Dict[Any, Any]] = {}
|
||||
ElementReverseMap: Final[dict[str, str | list[str]]] = {}
|
||||
"""Get a dict of element reverse mapping"""
|
||||
|
||||
ElementMapVersion: Final[str] = ""
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from PropertyContainer import PropertyContainer
|
||||
from DocumentObject import DocumentObject
|
||||
from typing import Final, List, Tuple, Sequence
|
||||
from typing import Final, Sequence
|
||||
|
||||
|
||||
class Document(PropertyContainer):
|
||||
"""
|
||||
This is a Document class
|
||||
Author: Juergen Riegel (FreeCAD@juergen-riegel.net)
|
||||
Licence: LGPL
|
||||
This is the Document class.
|
||||
"""
|
||||
|
||||
DependencyGraph: Final[str] = ""
|
||||
@@ -16,16 +18,16 @@ class Document(PropertyContainer):
|
||||
ActiveObject: Final[DocumentObject] = None
|
||||
"""The last created object in this document"""
|
||||
|
||||
Objects: Final[List[DocumentObject]] = []
|
||||
Objects: Final[list[DocumentObject]] = []
|
||||
"""The list of objects in this document"""
|
||||
|
||||
TopologicalSortedObjects: Final[List[DocumentObject]] = []
|
||||
TopologicalSortedObjects: Final[list[DocumentObject]] = []
|
||||
"""The list of objects in this document in topological sorted order"""
|
||||
|
||||
RootObjects: Final[List[DocumentObject]] = []
|
||||
RootObjects: Final[list[DocumentObject]] = []
|
||||
"""The list of root objects in this document"""
|
||||
|
||||
RootObjectsIgnoreLinks: Final[List[DocumentObject]] = []
|
||||
RootObjectsIgnoreLinks: Final[list[DocumentObject]] = []
|
||||
"""The list of root objects in this document ignoring references from links."""
|
||||
|
||||
UndoMode: int = 0
|
||||
@@ -40,10 +42,10 @@ class Document(PropertyContainer):
|
||||
RedoCount: Final[int] = 0
|
||||
"""Number of possible Redos"""
|
||||
|
||||
UndoNames: Final[List[str]] = []
|
||||
UndoNames: Final[list[str]] = []
|
||||
"""A list of Undo names"""
|
||||
|
||||
RedoNames: Final[List[str]] = []
|
||||
RedoNames: Final[list[str]] = []
|
||||
"""A List of Redo names"""
|
||||
|
||||
Name: Final[str] = ""
|
||||
@@ -55,10 +57,10 @@ class Document(PropertyContainer):
|
||||
HasPendingTransaction: Final[bool] = False
|
||||
"""Check if there is a pending transaction"""
|
||||
|
||||
InList: Final[List["Document"]] = []
|
||||
InList: Final[list[Document]] = []
|
||||
"""A list of all documents that link to this document."""
|
||||
|
||||
OutList: Final[List["Document"]] = []
|
||||
OutList: Final[list[Document]] = []
|
||||
"""A list of all documents that this document links to."""
|
||||
|
||||
Restoring: Final[bool] = False
|
||||
@@ -84,25 +86,25 @@ class Document(PropertyContainer):
|
||||
|
||||
def save(self) -> None:
|
||||
"""
|
||||
Save the document to disk
|
||||
Save the document to disk.
|
||||
"""
|
||||
...
|
||||
|
||||
def saveAs(self) -> None:
|
||||
def saveAs(self, path: str, /) -> None:
|
||||
"""
|
||||
Save the document under a new name to disk
|
||||
Save the document under a new name to disk.
|
||||
"""
|
||||
...
|
||||
|
||||
def saveCopy(self) -> None:
|
||||
def saveCopy(self, path: str, /) -> None:
|
||||
"""
|
||||
Save a copy of the document under a new name to disk
|
||||
Save a copy of the document under a new name to disk.
|
||||
"""
|
||||
...
|
||||
|
||||
def load(self) -> None:
|
||||
def load(self, path: str, /) -> None:
|
||||
"""
|
||||
Load the document from the given path
|
||||
Load the document from the given path.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -131,37 +133,40 @@ class Document(PropertyContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def getUniqueObjectName(self, objName: str) -> str:
|
||||
def getUniqueObjectName(self, objName: str, /) -> str:
|
||||
"""
|
||||
getUniqueObjectName(objName) -> objName
|
||||
|
||||
Return the same name, or the name made unique, for Example Box -> Box002 if there are conflicting name
|
||||
already in the document.
|
||||
|
||||
ObjName : str
|
||||
Object name.
|
||||
Args:
|
||||
objName: Object name candidate.
|
||||
|
||||
Returns:
|
||||
Unique object name based on objName.
|
||||
"""
|
||||
...
|
||||
|
||||
def mergeProject(self) -> None:
|
||||
def mergeProject(self, path: str, /) -> None:
|
||||
"""
|
||||
Merges this document with another project file
|
||||
Merges this document with another project file.
|
||||
"""
|
||||
...
|
||||
|
||||
def exportGraphviz(self) -> None:
|
||||
def exportGraphviz(self, path: str = None, /) -> str | None:
|
||||
"""
|
||||
Export the dependencies of the objects as graph
|
||||
Export the dependencies of the objects as graph.
|
||||
|
||||
If path is passed, graph is written to it. if not a string is returned.
|
||||
"""
|
||||
...
|
||||
|
||||
def openTransaction(self, name: str) -> None:
|
||||
def openTransaction(self, name: str, /) -> None:
|
||||
"""
|
||||
openTransaction(name) - Open a new Undo/Redo transaction.
|
||||
Open a new Undo/Redo transaction.
|
||||
|
||||
This function no long creates a new transaction, but calls
|
||||
FreeCAD.setActiveTransaction(name) instead, which will auto creates a
|
||||
transaction with the given name when any change happed in any opened document.
|
||||
transaction with the given name when any change happened in any opened document.
|
||||
If more than one document is changed, all newly created transactions will have
|
||||
the same internal ID and will be undo/redo together.
|
||||
"""
|
||||
@@ -181,7 +186,6 @@ class Document(PropertyContainer):
|
||||
|
||||
def addObject(
|
||||
self,
|
||||
*,
|
||||
type: str,
|
||||
name: str = None,
|
||||
objProxy: object = None,
|
||||
@@ -190,24 +194,22 @@ class Document(PropertyContainer):
|
||||
viewType: str = None,
|
||||
) -> DocumentObject:
|
||||
"""
|
||||
addObject(type, name=None, objProxy=None, viewProxy=None, attach=False, viewType=None)
|
||||
Add an object to document.
|
||||
|
||||
Add an object to document
|
||||
|
||||
type (String): the type of the document object to create.
|
||||
name (String): the optional name of the new object.
|
||||
objProxy (Object): the Python binding object to attach to the new document object.
|
||||
viewProxy (Object): the Python binding object to attach the view provider of this object.
|
||||
attach (Boolean): if True, then bind the document object first before adding to the document
|
||||
to allow Python code to override view provider type. Once bound, and before adding to
|
||||
the document, it will try to call Python binding object's attach(obj) method.
|
||||
viewType (String): override the view provider type directly, only effective when attach is False.
|
||||
Args:
|
||||
type: the type of the document object to create.
|
||||
name: the optional name of the new object.
|
||||
objProxy: the Python binding object to attach to the new document object.
|
||||
viewProxy: the Python binding object to attach the view provider of this object.
|
||||
attach: if True, then bind the document object first before adding to the document
|
||||
to allow Python code to override view provider type. Once bound, and before adding to
|
||||
the document, it will try to call Python binding object's attach(obj) method.
|
||||
viewType: override the view provider type directly, only effective when attach is False.
|
||||
"""
|
||||
...
|
||||
|
||||
def addProperty(
|
||||
self,
|
||||
*,
|
||||
type: str,
|
||||
name: str,
|
||||
group: str = "",
|
||||
@@ -216,22 +218,37 @@ class Document(PropertyContainer):
|
||||
read_only: bool = False,
|
||||
hidden: bool = False,
|
||||
locked: bool = False,
|
||||
) -> "Document":
|
||||
enum_vals: list[str] | None = None,
|
||||
) -> Document:
|
||||
"""
|
||||
addProperty(type: string, name: string, group="", doc="", attr=0, read_only=False, hidden=False, locked=False) -- Add a generic property.
|
||||
Add a generic property.
|
||||
|
||||
Args:
|
||||
type: The type of the property to add.
|
||||
name: The name of the property.
|
||||
group: The group to which the property belongs. Defaults to "".
|
||||
doc: The documentation string for the property. Defaults to "".
|
||||
attr: Attribute flags for the property. Defaults to 0.
|
||||
read_only: Whether the property is read-only. Defaults to False.
|
||||
hidden: Whether the property is hidden. Defaults to False.
|
||||
locked: Whether the property is locked. Defaults to False.
|
||||
|
||||
Returns:
|
||||
The document instance with the added property.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeProperty(self, string: str) -> None:
|
||||
def removeProperty(self, name: str, /) -> None:
|
||||
"""
|
||||
removeProperty(string) -- Remove a generic property.
|
||||
Remove a generic property.
|
||||
|
||||
Note, you can only remove user-defined properties but not built-in ones.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeObject(self) -> None:
|
||||
def removeObject(self, name: str, /) -> None:
|
||||
"""
|
||||
Remove an object from the document
|
||||
Remove an object from the document.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -241,34 +258,39 @@ class Document(PropertyContainer):
|
||||
*,
|
||||
recursive: bool = False,
|
||||
return_all: bool = False,
|
||||
) -> Tuple[DocumentObject, ...]:
|
||||
) -> tuple[DocumentObject, ...]:
|
||||
"""
|
||||
copyObject(object, recursive=False, return_all=False)
|
||||
Copy an object or objects from another document to this document.
|
||||
|
||||
object: can either be a single object or sequence of objects
|
||||
recursive: if True, also recursively copies internal objects
|
||||
return_all: if True, returns all copied objects, or else return only the copied
|
||||
object corresponding to the input objects.
|
||||
Args:
|
||||
object: can either be a single object or sequence of objects
|
||||
recursive: if True, also recursively copies internal objects
|
||||
return_all: if True, returns all copied objects, or else return only the copied
|
||||
object corresponding to the input objects.
|
||||
"""
|
||||
...
|
||||
|
||||
def moveObject(
|
||||
self, object: DocumentObject, with_dependencies: bool = False
|
||||
self,
|
||||
object: DocumentObject,
|
||||
with_dependencies: bool = False,
|
||||
/,
|
||||
) -> DocumentObject:
|
||||
"""
|
||||
moveObject(object, bool with_dependencies = False)
|
||||
Transfers an object from another document to this document.
|
||||
|
||||
object: can either a single object or sequence of objects
|
||||
with_dependencies: if True, all internal dependent objects are copied too.
|
||||
Args:
|
||||
object: can either a single object or sequence of objects
|
||||
with_dependencies: if True, all internal dependent objects are copied too.
|
||||
"""
|
||||
...
|
||||
|
||||
def importLinks(self, object: DocumentObject = None) -> Tuple[DocumentObject, ...]:
|
||||
def importLinks(
|
||||
self,
|
||||
object: DocumentObject = None,
|
||||
/,
|
||||
) -> tuple[DocumentObject, ...]:
|
||||
"""
|
||||
importLinks(object|[object...])
|
||||
|
||||
Import any externally linked object given a list of objects in
|
||||
this document. Any link type properties of the input objects
|
||||
will be automatically reassigned to the imported object
|
||||
@@ -302,7 +324,7 @@ class Document(PropertyContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def setClosable(self, closable: bool) -> None:
|
||||
def setClosable(self, closable: bool, /) -> None:
|
||||
"""
|
||||
Set a flag that allows or forbids to close a document
|
||||
"""
|
||||
@@ -314,7 +336,7 @@ class Document(PropertyContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def setAutoCreated(self, autoCreated: bool) -> None:
|
||||
def setAutoCreated(self, autoCreated: bool, /) -> None:
|
||||
"""
|
||||
Set a flag that indicates if a document is autoCreated
|
||||
"""
|
||||
@@ -326,9 +348,15 @@ class Document(PropertyContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def recompute(self, objs: Sequence[DocumentObject] = None) -> int:
|
||||
def recompute(
|
||||
self,
|
||||
objs: Sequence[DocumentObject] = None,
|
||||
force: bool = False,
|
||||
check_cycle: bool = False,
|
||||
/,
|
||||
) -> int:
|
||||
"""
|
||||
recompute(objs=None): Recompute the document and returns the amount of recomputed features
|
||||
Recompute the document and returns the amount of recomputed features.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -350,41 +378,55 @@ class Document(PropertyContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def getObject(self, name: str) -> DocumentObject:
|
||||
def getObject(self, name: str, /) -> DocumentObject:
|
||||
"""
|
||||
Return the object with the given name
|
||||
"""
|
||||
...
|
||||
|
||||
def getObjectsByLabel(self, label: str) -> List[DocumentObject]:
|
||||
def getObjectsByLabel(self, label: str, /) -> list[DocumentObject]:
|
||||
"""
|
||||
Return the objects with the given label name.
|
||||
|
||||
NOTE: It's possible that several objects have the same label name.
|
||||
"""
|
||||
...
|
||||
|
||||
def findObjects(
|
||||
self, *, Type: str = None, Name: str = None, Label: str = None
|
||||
) -> List[DocumentObject]:
|
||||
self,
|
||||
Type: str = None,
|
||||
Name: str = None,
|
||||
Label: str = None,
|
||||
) -> list[DocumentObject]:
|
||||
"""
|
||||
findObjects([Type=string], [Name=string], [Label=string]) -> list
|
||||
Return a list of objects that match the specified type, name or label.
|
||||
|
||||
Name and label support regular expressions. All parameters are optional.
|
||||
|
||||
Args:
|
||||
Type: Type of the feature.
|
||||
Name: Name
|
||||
Label: Label
|
||||
"""
|
||||
...
|
||||
|
||||
def getLinksTo(
|
||||
self, obj: DocumentObject, options: int = 0, maxCount: int = 0
|
||||
) -> Tuple[DocumentObject, ...]:
|
||||
self,
|
||||
obj: DocumentObject,
|
||||
options: int = 0,
|
||||
maxCount: int = 0,
|
||||
/,
|
||||
) -> tuple[DocumentObject, ...]:
|
||||
"""
|
||||
getLinksTo(obj, options=0, maxCount=0): return objects linked to 'obj'
|
||||
Return objects linked to 'obj'
|
||||
|
||||
options: 1: recursive, 2: check link array. Options can combine.
|
||||
maxCount: to limit the number of links returned
|
||||
Args:
|
||||
options: 1: recursive, 2: check link array. Options can combine.
|
||||
maxCount: to limit the number of links returned.
|
||||
"""
|
||||
...
|
||||
|
||||
def supportedTypes(self) -> List[str]:
|
||||
def supportedTypes(self) -> list[str]:
|
||||
"""
|
||||
A list of supported types of objects
|
||||
"""
|
||||
@@ -396,12 +438,11 @@ class Document(PropertyContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def getDependentDocuments(self, sort: bool = True) -> List[DocumentObject]:
|
||||
def getDependentDocuments(self, sort: bool = True, /) -> list[DocumentObject]:
|
||||
"""
|
||||
getDependentDocuments(sort=True)
|
||||
|
||||
Returns a list of documents that this document directly or indirectly links to including itself.
|
||||
|
||||
sort: whether to topologically sort the return list
|
||||
Args:
|
||||
sort: whether to topologically sort the return list
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import constmethod
|
||||
from Base.Matrix import Matrix
|
||||
from Document import Document
|
||||
@@ -63,7 +67,6 @@ class DocumentObject(ExtensionContainer):
|
||||
|
||||
def addProperty(
|
||||
self,
|
||||
*,
|
||||
type: str,
|
||||
name: str,
|
||||
group: str = "",
|
||||
@@ -72,16 +75,16 @@ class DocumentObject(ExtensionContainer):
|
||||
read_only: bool = False,
|
||||
hidden: bool = False,
|
||||
locked: bool = False,
|
||||
enum_vals: list = []
|
||||
enum_vals: list = [],
|
||||
) -> "DocumentObject":
|
||||
"""
|
||||
addProperty(type: string, name: string, group="", doc="", attr=0, read_only=False, hidden=False, locked = False, enum_vals=[]) -- Add a generic property.
|
||||
Add a generic property.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeProperty(self, string: str) -> None:
|
||||
def removeProperty(self, string: str, /) -> None:
|
||||
"""
|
||||
removeProperty(string) -- Remove a generic property.
|
||||
Remove a generic property.
|
||||
|
||||
Note, you can only remove user-defined properties but not built-in ones.
|
||||
"""
|
||||
@@ -111,28 +114,28 @@ class DocumentObject(ExtensionContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def setExpression(self, name: str, expression: str) -> None:
|
||||
def setExpression(self, name: str, expression: str, /) -> None:
|
||||
"""
|
||||
Register an expression for a property
|
||||
"""
|
||||
...
|
||||
|
||||
def clearExpression(self, name: str) -> None:
|
||||
def clearExpression(self, name: str, /) -> None:
|
||||
"""
|
||||
Clear the expression for a property
|
||||
"""
|
||||
...
|
||||
|
||||
@classmethod
|
||||
def evalExpression(cls, expression: str) -> Any:
|
||||
def evalExpression(cls, expression: str, /) -> Any:
|
||||
"""
|
||||
Evaluate an expression
|
||||
"""
|
||||
...
|
||||
|
||||
def recompute(self, recursive: bool = False) -> None:
|
||||
def recompute(self, recursive: bool = False, /) -> None:
|
||||
"""
|
||||
recompute(recursive=False): Recomputes this object
|
||||
Recomputes this object
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -155,16 +158,14 @@ class DocumentObject(ExtensionContainer):
|
||||
|
||||
def getSubObject(
|
||||
self,
|
||||
*,
|
||||
subname: Union[str, List[str], Tuple[str, ...]],
|
||||
*,
|
||||
retType: int = 0,
|
||||
matrix: Matrix = None,
|
||||
transform: bool = True,
|
||||
depth: int = 0,
|
||||
) -> Any:
|
||||
"""
|
||||
getSubObject(subname, retType=0, matrix=None, transform=True, depth=0)
|
||||
|
||||
* subname(string|list|tuple): dot separated string or sequence of strings
|
||||
referencing subobject.
|
||||
|
||||
@@ -191,17 +192,15 @@ class DocumentObject(ExtensionContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def getSubObjectList(self, subname: str) -> list:
|
||||
def getSubObjectList(self, subname: str, /) -> list:
|
||||
"""
|
||||
getSubObjectList(subname)
|
||||
|
||||
Return a list of objects referenced by a given subname including this object
|
||||
"""
|
||||
...
|
||||
|
||||
def getSubObjects(self, reason: int = 0) -> list:
|
||||
def getSubObjects(self, reason: int = 0, /) -> list:
|
||||
"""
|
||||
getSubObjects(reason=0): Return subname reference of all sub-objects
|
||||
Return subname reference of all sub-objects
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -214,7 +213,6 @@ class DocumentObject(ExtensionContainer):
|
||||
depth: int = 0,
|
||||
) -> Any:
|
||||
"""
|
||||
getLinkedObject(recursive=True, matrix=None, transform=True, depth=0)
|
||||
Returns the linked object if there is one, or else return itself
|
||||
|
||||
* recursive: whether to recursively resolve the links
|
||||
@@ -229,16 +227,16 @@ class DocumentObject(ExtensionContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def setElementVisible(self, element: str, visible: bool) -> int:
|
||||
def setElementVisible(self, element: str, visible: bool, /) -> int:
|
||||
"""
|
||||
setElementVisible(element,visible): Set the visibility of a child element
|
||||
Set the visibility of a child element
|
||||
Return -1 if element visibility is not supported, 0 if element not found, 1 if success
|
||||
"""
|
||||
...
|
||||
|
||||
def isElementVisible(self, element: str) -> int:
|
||||
def isElementVisible(self, element: str, /) -> int:
|
||||
"""
|
||||
isElementVisible(element): Check if a child element is visible
|
||||
Check if a child element is visible
|
||||
Return -1 if element visibility is not supported or element not found, 0 if invisible, or else 1
|
||||
"""
|
||||
...
|
||||
@@ -283,9 +281,9 @@ class DocumentObject(ExtensionContainer):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def resolve(self, subname: str) -> tuple:
|
||||
def resolve(self, subname: str, /) -> tuple:
|
||||
"""
|
||||
resolve(subname) -- resolve the sub object
|
||||
resolve the sub object
|
||||
|
||||
Returns a tuple (subobj,parent,elementName,subElement), where 'subobj' is the
|
||||
last object referenced in 'subname', and 'parent' is the direct parent of
|
||||
@@ -296,9 +294,9 @@ class DocumentObject(ExtensionContainer):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def resolveSubElement(self, subname: str, append: bool, type: int) -> tuple:
|
||||
def resolveSubElement(self, subname: str, append: bool, type: int, /) -> tuple:
|
||||
"""
|
||||
resolveSubElement(subname,append,type) -- resolve both new and old style sub element
|
||||
resolve both new and old style sub element
|
||||
|
||||
subname: subname reference containing object hierarchy
|
||||
append: Whether to append object hierarchy prefix inside subname to returned element name
|
||||
@@ -308,24 +306,22 @@ class DocumentObject(ExtensionContainer):
|
||||
"""
|
||||
...
|
||||
|
||||
def adjustRelativeLinks(self, parent: DocumentObject, recursive: bool = True) -> bool:
|
||||
def adjustRelativeLinks(self, parent: DocumentObject, recursive: bool = True, /) -> bool:
|
||||
"""
|
||||
adjustRelativeLinks(parent,recursive=True) -- auto correct potential cyclic dependencies
|
||||
auto correct potential cyclic dependencies
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def getElementMapVersion(self, property_name: str) -> str:
|
||||
def getElementMapVersion(self, property_name: str, /) -> str:
|
||||
"""
|
||||
getElementMapVersion(property_name): return element map version of a given geometry property
|
||||
return element map version of a given geometry property
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def isAttachedToDocument(self) -> bool:
|
||||
"""
|
||||
isAttachedToDocument() -> bool
|
||||
|
||||
Return true if the object is part of a document, false otherwise.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Extension import Extension
|
||||
|
||||
|
||||
@@ -7,4 +11,5 @@ class DocumentObjectExtension(Extension):
|
||||
Author: Stefan Troeger (stefantroeger@gmx.net)
|
||||
Licence: LGPL
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from DocumentObject import DocumentObject
|
||||
|
||||
|
||||
@@ -7,4 +11,5 @@ class DocumentObjectGroup(DocumentObject):
|
||||
Author: Werner Mayer (wmayer@users.sourceforge.net)
|
||||
Licence: LGPL
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Final, Any
|
||||
from Base.PyObjectBase import PyObjectBase
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, constmethod
|
||||
from PropertyContainer import PropertyContainer
|
||||
|
||||
@@ -13,14 +17,14 @@ class ExtensionContainer(PropertyContainer):
|
||||
Licence: LGPL
|
||||
"""
|
||||
|
||||
def addExtension(self, identifier: str) -> None:
|
||||
def addExtension(self, identifier: str, /) -> None:
|
||||
"""
|
||||
Adds an extension to the object. Requires the string identifier for the python extension as argument
|
||||
"""
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def hasExtension(self, identifier: str) -> bool:
|
||||
def hasExtension(self, identifier: str, /) -> bool:
|
||||
"""
|
||||
Returns if this object has the specified extension
|
||||
"""
|
||||
|
||||
@@ -1,5 +1,9 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from DocumentObject import DocumentObject
|
||||
from Base import Placement
|
||||
from Base.Placement import Placement
|
||||
from typing import Any, Final, Optional
|
||||
|
||||
|
||||
@@ -19,8 +23,6 @@ class GeoFeature(DocumentObject):
|
||||
|
||||
def getPaths(self) -> Any:
|
||||
"""
|
||||
getPaths()
|
||||
|
||||
Returns all possible paths to the root of the document.
|
||||
Note: Not implemented.
|
||||
"""
|
||||
@@ -28,7 +30,6 @@ class GeoFeature(DocumentObject):
|
||||
|
||||
def getGlobalPlacement(self) -> Placement:
|
||||
"""
|
||||
getGlobalPlacement() -> Base.Placement
|
||||
Deprecated: This function does not handle Links correctly. Use getGlobalPlacementOf instead.
|
||||
|
||||
Returns the placement of the object in the global coordinate space, respecting all stacked
|
||||
@@ -39,16 +40,18 @@ class GeoFeature(DocumentObject):
|
||||
...
|
||||
|
||||
@staticmethod
|
||||
def getGlobalPlacementOf(targetObj: Any, rootObj: Any, subname: str) -> Placement:
|
||||
def getGlobalPlacementOf(targetObj: Any, rootObj: Any, subname: str, /) -> Placement:
|
||||
"""
|
||||
getGlobalPlacementOf(targetObj, rootObj, subname) -> Base.Placement
|
||||
Selection example: obj = "part1" sub = "linkToPart2.LinkToBody.Pad.face1"
|
||||
Examples:
|
||||
obj = "part1"
|
||||
sub = "linkToPart2.LinkToBody.Pad.face1"
|
||||
|
||||
Global placement of Pad in this context :
|
||||
getGlobalPlacementOf(pad, part1, "linkToPart2.LinkToBody.Pad.face1")
|
||||
Global placement of Pad in this context:
|
||||
getGlobalPlacementOf(pad, part1, "linkToPart2.LinkToBody.Pad.face1")
|
||||
|
||||
Global placement of linkToPart2 in this context :
|
||||
getGlobalPlacementOf(linkToPart2, part1, "linkToPart2.LinkToBody.Pad.face1")
|
||||
|
||||
Global placement of linkToPart2 in this context:
|
||||
getGlobalPlacementOf(linkToPart2, part1, "linkToPart2.LinkToBody.Pad.face1")
|
||||
|
||||
Returns the placement of the object in the global coordinate space, respecting all stacked
|
||||
relationships.
|
||||
@@ -57,8 +60,6 @@ class GeoFeature(DocumentObject):
|
||||
|
||||
def getPropertyNameOfGeometry(self) -> Optional[str]:
|
||||
"""
|
||||
getPropertyNameOfGeometry() -> str or None
|
||||
|
||||
Returns the property name of the actual geometry.
|
||||
For example for a Part feature it returns the value 'Shape', for a mesh feature the value
|
||||
'Mesh' and so on.
|
||||
@@ -68,8 +69,6 @@ class GeoFeature(DocumentObject):
|
||||
|
||||
def getPropertyOfGeometry(self) -> Optional[Any]:
|
||||
"""
|
||||
getPropertyOfGeometry() -> object or None
|
||||
|
||||
Returns the property of the actual geometry.
|
||||
For example for a Part feature it returns its Shape property, for a Mesh feature its
|
||||
Mesh property and so on.
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from GroupExtension import GroupExtension
|
||||
|
||||
|
||||
@@ -7,4 +11,5 @@ class GeoFeatureGroupExtension(GroupExtension):
|
||||
Licence: LGPL
|
||||
This class handles placeable group of document objects
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export
|
||||
from DocumentObjectExtension import DocumentObjectExtension
|
||||
from typing import Any, List
|
||||
|
||||
|
||||
@export(
|
||||
Include="App/DocumentObjectGroup.h",
|
||||
)
|
||||
@export(Include="App/DocumentObjectGroup.h", )
|
||||
class GroupExtension(DocumentObjectExtension):
|
||||
"""
|
||||
Extension class which allows grouping of document objects
|
||||
@@ -13,37 +15,37 @@ class GroupExtension(DocumentObjectExtension):
|
||||
Licence: LGPL
|
||||
"""
|
||||
|
||||
def newObject(self, type: str, name: str) -> Any:
|
||||
def newObject(self, type: str, name: str, /) -> Any:
|
||||
"""
|
||||
Create and add an object with given type and name to the group
|
||||
"""
|
||||
...
|
||||
|
||||
def addObject(self, obj: Any) -> List[Any]:
|
||||
def addObject(self, obj: Any, /) -> List[Any]:
|
||||
"""
|
||||
Add an object to the group. Returns all objects that have been added.
|
||||
"""
|
||||
...
|
||||
|
||||
def addObjects(self, objects: List[Any]) -> List[Any]:
|
||||
def addObjects(self, objects: List[Any], /) -> List[Any]:
|
||||
"""
|
||||
Adds multiple objects to the group. Expects a list and returns all objects that have been added.
|
||||
"""
|
||||
...
|
||||
|
||||
def setObjects(self, objects: List[Any]) -> List[Any]:
|
||||
def setObjects(self, objects: List[Any], /) -> List[Any]:
|
||||
"""
|
||||
Sets the objects of the group. Expects a list and returns all objects that are now in the group.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeObject(self, obj: Any) -> List[Any]:
|
||||
def removeObject(self, obj: Any, /) -> List[Any]:
|
||||
"""
|
||||
Remove an object from the group and returns all objects that have been removed.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeObjects(self, objects: List[Any]) -> List[Any]:
|
||||
def removeObjects(self, objects: List[Any], /) -> List[Any]:
|
||||
"""
|
||||
Remove multiple objects from the group. Expects a list and returns all objects that have been removed.
|
||||
"""
|
||||
@@ -55,30 +57,28 @@ class GroupExtension(DocumentObjectExtension):
|
||||
"""
|
||||
...
|
||||
|
||||
def getObject(self, name: str) -> Any:
|
||||
def getObject(self, name: str, /) -> Any:
|
||||
"""
|
||||
Return the object with the given name
|
||||
"""
|
||||
...
|
||||
|
||||
def getObjectsOfType(self, typename: str) -> List[Any]:
|
||||
def getObjectsOfType(self, typename: str, /) -> List[Any]:
|
||||
"""
|
||||
Returns all object in the group of given type
|
||||
@param typename The Freecad type identifier
|
||||
"""
|
||||
...
|
||||
|
||||
def hasObject(self, obj: Any, recursive: bool = False) -> bool:
|
||||
def hasObject(self, obj: Any, recursive: bool = False, /) -> bool:
|
||||
"""
|
||||
hasObject(obj, recursive=false)
|
||||
|
||||
Checks if the group has a given object
|
||||
@param obj the object to check for.
|
||||
@param recursive if true check also if the obj is child of some sub group (default is false).
|
||||
"""
|
||||
...
|
||||
|
||||
def allowObject(self, obj: Any) -> bool:
|
||||
def allowObject(self, obj: Any, /) -> bool:
|
||||
"""
|
||||
Returns true if obj is allowed in the group extension.
|
||||
"""
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export
|
||||
from DocumentObjectExtension import DocumentObjectExtension
|
||||
from typing import Any, Final, List, Tuple, Optional, Union, overload
|
||||
|
||||
|
||||
@export(
|
||||
Include="App/Link.h",
|
||||
)
|
||||
@export(Include="App/Link.h", )
|
||||
class LinkBaseExtension(DocumentObjectExtension):
|
||||
"""
|
||||
Link extension base class
|
||||
@@ -16,15 +18,18 @@ class LinkBaseExtension(DocumentObjectExtension):
|
||||
LinkedChildren: Final[List[Any]] = []
|
||||
"""Return a flattened (in case grouped by plain group) list of linked children"""
|
||||
|
||||
def configLinkProperty(self, **kwargs) -> Any:
|
||||
def configLinkProperty(self, *args, **kwargs) -> Any:
|
||||
"""
|
||||
configLinkProperty(key=val,...): property configuration
|
||||
configLinkProperty(key,...): property configuration with default name
|
||||
Examples:
|
||||
Called with default names:
|
||||
configLinkProperty(prop1, prop2, ..., propN)
|
||||
Called with custom names:
|
||||
configLinkProperty(prop1=val1, prop2=val2, ..., propN=valN)
|
||||
|
||||
This methode is here to implement what I called Property Design
|
||||
This method is here to implement what I called Property Design
|
||||
Pattern. The extension operates on a predefined set of properties,
|
||||
but it relies on the extended object to supply the actual property by
|
||||
calling this methode. You can choose a sub set of functionality of
|
||||
calling this method. You can choose a sub set of functionality of
|
||||
this extension by supplying only some of the supported properties.
|
||||
|
||||
The 'key' are names used to refer to properties supported by this
|
||||
@@ -41,48 +46,48 @@ class LinkBaseExtension(DocumentObjectExtension):
|
||||
"""
|
||||
...
|
||||
|
||||
def getLinkExtProperty(self, name: str) -> Any:
|
||||
def getLinkExtProperty(self, name: str, /) -> Any:
|
||||
"""
|
||||
getLinkExtProperty(name): return the property value by its predefined name
|
||||
return the property value by its predefined name
|
||||
"""
|
||||
...
|
||||
|
||||
def getLinkExtPropertyName(self, name: str) -> str:
|
||||
def getLinkExtPropertyName(self, name: str, /) -> str:
|
||||
"""
|
||||
getLinkExtPropertyName(name): lookup the property name by its predefined name
|
||||
lookup the property name by its predefined name
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def getLinkPropertyInfo(self) -> tuple:
|
||||
def getLinkPropertyInfo(self, /) -> tuple[tuple[str, str, str]]:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def getLinkPropertyInfo(self, index: int) -> tuple:
|
||||
def getLinkPropertyInfo(self, index: int, /) -> tuple[str, str, str]:
|
||||
...
|
||||
|
||||
|
||||
@overload
|
||||
def getLinkPropertyInfo(self, name: str) -> tuple:
|
||||
def getLinkPropertyInfo(self, name: str, /) -> tuple[str, str]:
|
||||
...
|
||||
|
||||
def getLinkPropertyInfo(self, arg: Any = None) -> tuple:
|
||||
|
||||
def getLinkPropertyInfo(self, arg: Any = None, /) -> tuple:
|
||||
"""
|
||||
getLinkPropertyInfo(): return a tuple of (name,type,doc) for all supported properties.
|
||||
|
||||
getLinkPropertyInfo(index): return (name,type,doc) of a specific property
|
||||
|
||||
getLinkPropertyInfo(name): return (type,doc) of a specific property
|
||||
Overloads:
|
||||
(): return (name,type,doc) for all supported properties.
|
||||
(index): return (name,type,doc) of a specific property
|
||||
(name): return (type,doc) of a specific property
|
||||
"""
|
||||
...
|
||||
|
||||
def setLink(self, obj: Any, subName: Optional[str] = None, subElements: Optional[Union[str, Tuple[str, ...]]] = None) -> None:
|
||||
def setLink(
|
||||
self,
|
||||
obj: Any,
|
||||
subName: Optional[str] = None,
|
||||
subElements: Optional[Union[str, Tuple[str, ...]]] = None,
|
||||
/,
|
||||
) -> None:
|
||||
"""
|
||||
setLink(obj,subName=None,subElements=None): Set link object.
|
||||
|
||||
setLink([obj,...]),
|
||||
setLink([(obj,subName,subElements),...]),
|
||||
setLink({index:obj,...}),
|
||||
setLink({index:(obj,subName,subElements),...}): set link element of a link group.
|
||||
Called with only obj, set link object, otherwise set link element of a link group.
|
||||
|
||||
obj (DocumentObject): the object to link to. If this is None, then the link is cleared
|
||||
|
||||
@@ -92,27 +97,23 @@ class LinkBaseExtension(DocumentObjectExtension):
|
||||
"""
|
||||
...
|
||||
|
||||
def cacheChildLabel(self, enable: bool = True) -> None:
|
||||
def cacheChildLabel(self, enable: bool = True, /) -> None:
|
||||
"""
|
||||
cacheChildLabel(enable=True): enable/disable child label cache
|
||||
enable/disable child label cache
|
||||
|
||||
The cache is not updated on child label change for performance reason. You must
|
||||
call this function on any child label change
|
||||
"""
|
||||
...
|
||||
|
||||
def flattenSubname(self, subname: str) -> str:
|
||||
def flattenSubname(self, subname: str, /) -> str:
|
||||
"""
|
||||
flattenSubname(subname) -> string
|
||||
|
||||
Return a flattened subname in case it references an object inside a linked plain group
|
||||
"""
|
||||
...
|
||||
|
||||
def expandSubname(self, subname: str) -> str:
|
||||
def expandSubname(self, subname: str, /) -> str:
|
||||
"""
|
||||
expandSubname(subname) -> string
|
||||
|
||||
Return an expanded subname in case it references an object inside a linked plain group
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, class_declarations
|
||||
from Base.PyObjectBase import PyObjectBase
|
||||
from typing import Any, overload
|
||||
@@ -7,11 +11,9 @@ from typing import Any, overload
|
||||
Constructor=True,
|
||||
Delete=True,
|
||||
)
|
||||
@class_declarations(
|
||||
"""public:
|
||||
@class_declarations("""public:
|
||||
static Base::Color toColor(PyObject* value);
|
||||
"""
|
||||
)
|
||||
""")
|
||||
class Material(PyObjectBase):
|
||||
"""
|
||||
App.Material class.
|
||||
@@ -21,11 +23,7 @@ class Material(PyObjectBase):
|
||||
UserDocu: This is the Material class
|
||||
"""
|
||||
|
||||
@overload
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
...
|
||||
|
||||
def set(self, string: str) -> None:
|
||||
def set(self, string: str, /) -> None:
|
||||
"""
|
||||
Set(string) -- Set the material.
|
||||
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, no_args
|
||||
from Base.PyObjectBase import PyObjectBase
|
||||
from typing import List, Tuple, TypeAlias
|
||||
|
||||
|
||||
MeasureType: TypeAlias = object
|
||||
|
||||
|
||||
@export(
|
||||
Constructor=False,
|
||||
Delete=True,
|
||||
)
|
||||
)
|
||||
class MeasureManager(PyObjectBase):
|
||||
"""
|
||||
MeasureManager class.
|
||||
@@ -21,10 +25,8 @@ class MeasureManager(PyObjectBase):
|
||||
"""
|
||||
|
||||
@staticmethod
|
||||
def addMeasureType(id: str, label: str, measureType: MeasureType) -> None:
|
||||
def addMeasureType(id: str, label: str, measureType: MeasureType, /) -> None:
|
||||
"""
|
||||
addMeasureType(id, label, measureType) -> None
|
||||
|
||||
Add a new measure type.
|
||||
|
||||
id : str
|
||||
@@ -40,8 +42,6 @@ class MeasureManager(PyObjectBase):
|
||||
@no_args
|
||||
def getMeasureTypes() -> List[Tuple[str, str, MeasureType]]:
|
||||
"""
|
||||
getMeasureTypes() -> List[(id, label, pythonMeasureType)]
|
||||
|
||||
Returns a list of all registered measure types.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, class_declarations
|
||||
from Base.PyObjectBase import PyObjectBase
|
||||
from typing import Any, List, Dict, overload, Optional
|
||||
@@ -8,7 +12,7 @@ from typing import Any, List, Dict, overload, Optional
|
||||
Delete=True,
|
||||
NumberProtocol=False,
|
||||
RichCompare=False,
|
||||
)
|
||||
)
|
||||
@class_declarations(
|
||||
"""public:
|
||||
MetadataPy(const Metadata & pla, PyTypeObject *T = &Type)
|
||||
@@ -49,16 +53,20 @@ class Metadata(PyObjectBase):
|
||||
"""
|
||||
|
||||
@overload
|
||||
def __init__(self) -> None: ...
|
||||
def __init__(self) -> None:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __init__(self, metadata: "Metadata") -> None: ...
|
||||
def __init__(self, metadata: "Metadata") -> None:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __init__(self, file: str) -> None: ...
|
||||
def __init__(self, file: str) -> None:
|
||||
...
|
||||
|
||||
@overload
|
||||
def __init__(self, bytes: bytes) -> None: ...
|
||||
def __init__(self, bytes: bytes) -> None:
|
||||
...
|
||||
|
||||
Name: str = ""
|
||||
"""String representing the name of this item."""
|
||||
@@ -183,8 +191,6 @@ class Metadata(PyObjectBase):
|
||||
|
||||
def getLastSupportedFreeCADVersion(self) -> Optional[str]:
|
||||
"""
|
||||
getLastSupportedFreeCADVersion() -> str or None
|
||||
|
||||
Search through all content package items, and determine if a maximum supported
|
||||
version of FreeCAD is set.
|
||||
Returns None if no maximum version is set, or if *any* content item fails to
|
||||
@@ -195,8 +201,6 @@ class Metadata(PyObjectBase):
|
||||
|
||||
def getFirstSupportedFreeCADVersion(self) -> Optional[str]:
|
||||
"""
|
||||
getFirstSupportedFreeCADVersion() -> str or None
|
||||
|
||||
Search through all content package items, and determine if a minimum supported
|
||||
version of FreeCAD is set.
|
||||
Returns 0.0 if no minimum version is set, or if *any* content item fails to
|
||||
@@ -208,8 +212,6 @@ class Metadata(PyObjectBase):
|
||||
|
||||
def supportsCurrentFreeCAD(self) -> bool:
|
||||
"""
|
||||
supportsCurrentFreeCAD() -> bool
|
||||
|
||||
Returns False if this metadata object directly indicates that it does not
|
||||
support the current version of FreeCAD, or True if it makes no indication, or
|
||||
specifically indicates that it does support the current version. Does not
|
||||
@@ -217,10 +219,8 @@ class Metadata(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def getGenericMetadata(self, name: str) -> List[Any]:
|
||||
def getGenericMetadata(self, name: str, /) -> List[Any]:
|
||||
"""
|
||||
getGenericMetadata(name) -> list
|
||||
|
||||
Get the list of GenericMetadata objects with key 'name'.
|
||||
Generic metadata objects are Python objects with a string 'contents' and a
|
||||
dictionary of strings, 'attributes'. They represent unrecognized simple XML tags
|
||||
@@ -228,58 +228,44 @@ class Metadata(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def addContentItem(self, content_type: str, metadata: "Metadata") -> None:
|
||||
def addContentItem(self, content_type: str, metadata: "Metadata", /) -> None:
|
||||
"""
|
||||
addContentItem(content_type,metadata)
|
||||
|
||||
Add a new content item of type 'content_type' with metadata 'metadata'.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeContentItem(self, content_type: str, name: str) -> None:
|
||||
def removeContentItem(self, content_type: str, name: str, /) -> None:
|
||||
"""
|
||||
removeContentItem(content_type,name)
|
||||
|
||||
Remove the content item of type 'content_type' with name 'name'.
|
||||
"""
|
||||
...
|
||||
|
||||
def addMaintainer(self, name: str, email: str) -> None:
|
||||
def addMaintainer(self, name: str, email: str, /) -> None:
|
||||
"""
|
||||
addMaintainer(name, email)
|
||||
|
||||
Add a new Maintainer.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeMaintainer(self, name: str, email: str) -> None:
|
||||
def removeMaintainer(self, name: str, email: str, /) -> None:
|
||||
"""
|
||||
removeMaintainer(name, email)
|
||||
|
||||
Remove the Maintainer.
|
||||
"""
|
||||
...
|
||||
|
||||
def addLicense(self, short_code: str, path: str) -> None:
|
||||
def addLicense(self, short_code: str, path: str, /) -> None:
|
||||
"""
|
||||
addLicense(short_code,path)
|
||||
|
||||
Add a new License.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeLicense(self, short_code: str) -> None:
|
||||
def removeLicense(self, short_code: str, /) -> None:
|
||||
"""
|
||||
removeLicense(short_code)
|
||||
|
||||
Remove the License.
|
||||
"""
|
||||
...
|
||||
|
||||
def addUrl(self, url_type: str, url: str, branch: str) -> None:
|
||||
def addUrl(self, url_type: str, url: str, branch: str, /) -> None:
|
||||
"""
|
||||
addUrl(url_type,url,branch)
|
||||
|
||||
Add a new Url or type 'url_type' (which should be one of 'repository', 'readme',
|
||||
|
||||
'bugtracker', 'documentation', or 'webpage') If type is 'repository' you
|
||||
@@ -288,118 +274,90 @@ class Metadata(PyObjectBase):
|
||||
"""
|
||||
...
|
||||
|
||||
def removeUrl(self, url_type: str, url: str) -> None:
|
||||
def removeUrl(self, url_type: str, url: str, /) -> None:
|
||||
"""
|
||||
removeUrl(url_type,url)
|
||||
|
||||
Remove the Url.
|
||||
"""
|
||||
...
|
||||
|
||||
def addAuthor(self, name: str, email: str) -> None:
|
||||
def addAuthor(self, name: str, email: str, /) -> None:
|
||||
"""
|
||||
addAuthor(name, email)
|
||||
|
||||
Add a new Author with name 'name', and optionally email 'email'.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeAuthor(self, name: str, email: str) -> None:
|
||||
def removeAuthor(self, name: str, email: str, /) -> None:
|
||||
"""
|
||||
removeAuthor(name, email)
|
||||
|
||||
Remove the Author.
|
||||
"""
|
||||
...
|
||||
|
||||
def addDepend(self, name: str, kind: str, optional: bool) -> None:
|
||||
def addDepend(self, name: str, kind: str, optional: bool, /) -> None:
|
||||
"""
|
||||
addDepend(name, kind, optional)
|
||||
|
||||
Add a new Dependency on package 'name' of kind 'kind' (optional, one of 'auto' (the default),
|
||||
|
||||
'internal', 'addon', or 'python').
|
||||
"""
|
||||
...
|
||||
|
||||
def removeDepend(self, name: str, kind: str) -> None:
|
||||
def removeDepend(self, name: str, kind: str, /) -> None:
|
||||
"""
|
||||
removeDepend(name, kind)
|
||||
|
||||
Remove the Dependency on package 'name' of kind 'kind' (optional - if unspecified any
|
||||
|
||||
matching name is removed).
|
||||
"""
|
||||
...
|
||||
|
||||
def addConflict(self, name: str, kind: str) -> None:
|
||||
def addConflict(self, name: str, kind: str, /) -> None:
|
||||
"""
|
||||
addConflict(name, kind)
|
||||
|
||||
Add a new Conflict. See documentation for addDepend().
|
||||
"""
|
||||
...
|
||||
|
||||
def removeConflict(self, name: str, kind: str) -> None:
|
||||
def removeConflict(self, name: str, kind: str, /) -> None:
|
||||
"""
|
||||
removeConflict(name, kind)
|
||||
|
||||
Remove the Conflict. See documentation for removeDepend().
|
||||
"""
|
||||
...
|
||||
|
||||
def addReplace(self, name: str) -> None:
|
||||
def addReplace(self, name: str, /) -> None:
|
||||
"""
|
||||
addReplace(name)
|
||||
|
||||
Add a new Replace.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeReplace(self, name: str) -> None:
|
||||
def removeReplace(self, name: str, /) -> None:
|
||||
"""
|
||||
removeReplace(name)
|
||||
|
||||
Remove the Replace.
|
||||
"""
|
||||
...
|
||||
|
||||
def addTag(self, tag: str) -> None:
|
||||
def addTag(self, tag: str, /) -> None:
|
||||
"""
|
||||
addTag(tag)
|
||||
|
||||
Add a new Tag.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeTag(self, tag: str) -> None:
|
||||
def removeTag(self, tag: str, /) -> None:
|
||||
"""
|
||||
removeTag(tag)
|
||||
|
||||
Remove the Tag.
|
||||
"""
|
||||
...
|
||||
|
||||
def addFile(self, filename: str) -> None:
|
||||
def addFile(self, filename: str, /) -> None:
|
||||
"""
|
||||
addFile(filename)
|
||||
|
||||
Add a new File.
|
||||
"""
|
||||
...
|
||||
|
||||
def removeFile(self, filename: str) -> None:
|
||||
def removeFile(self, filename: str, /) -> None:
|
||||
"""
|
||||
removeFile(filename)
|
||||
|
||||
Remove the File.
|
||||
"""
|
||||
...
|
||||
|
||||
def write(self, filename: str) -> None:
|
||||
def write(self, filename: str, /) -> None:
|
||||
"""
|
||||
write(filename)
|
||||
|
||||
Write the metadata to the given file as XML data.
|
||||
"""
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from GeoFeatureGroupExtension import GeoFeatureGroupExtension
|
||||
|
||||
|
||||
@@ -7,4 +11,5 @@ class OriginGroupExtension(GeoFeatureGroupExtension):
|
||||
Licence: LGPL
|
||||
This class handles placable group of document objects with an Origin
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from GeoFeature import GeoFeature
|
||||
|
||||
|
||||
@@ -7,4 +11,5 @@ class Part(GeoFeature):
|
||||
Licence: LGPL
|
||||
This class handles document objects in Part
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, constmethod
|
||||
from Base.Persistence import Persistence
|
||||
from typing import Any, Final, Union, List, Optional
|
||||
|
||||
|
||||
@export(
|
||||
DisableNotify=True,
|
||||
)
|
||||
@export(DisableNotify=True, )
|
||||
class PropertyContainer(Persistence):
|
||||
"""
|
||||
App.PropertyContainer class.
|
||||
@@ -14,10 +16,8 @@ class PropertyContainer(Persistence):
|
||||
PropertiesList: Final[list] = []
|
||||
"""A list of all property names."""
|
||||
|
||||
def getPropertyByName(self, name: str, checkOwner: int = 0) -> Any:
|
||||
def getPropertyByName(self, name: str, checkOwner: int = 0, /) -> Any:
|
||||
"""
|
||||
getPropertyByName(name, checkOwner=0) -> object or Tuple
|
||||
|
||||
Returns the value of a named property. Note that the returned property may not
|
||||
always belong to this container (e.g. from a linked object).
|
||||
|
||||
@@ -30,10 +30,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getPropertyTouchList(self, name: str) -> tuple:
|
||||
def getPropertyTouchList(self, name: str, /) -> tuple:
|
||||
"""
|
||||
getPropertyTouchList(name) -> tuple
|
||||
|
||||
Returns a list of index of touched values for list type properties.
|
||||
|
||||
name : str
|
||||
@@ -41,10 +39,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getTypeOfProperty(self, name: str) -> list:
|
||||
def getTypeOfProperty(self, name: str, /) -> list:
|
||||
"""
|
||||
getTypeOfProperty(name) -> list
|
||||
|
||||
Returns the type of a named property. This can be a list conformed by elements in
|
||||
(Hidden, NoRecompute, NoPersist, Output, ReadOnly, Transient).
|
||||
|
||||
@@ -53,10 +49,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getTypeIdOfProperty(self, name: str) -> str:
|
||||
def getTypeIdOfProperty(self, name: str, /) -> str:
|
||||
"""
|
||||
getTypeIdOfProperty(name) -> str
|
||||
|
||||
Returns the C++ class name of a named property.
|
||||
|
||||
name : str
|
||||
@@ -64,10 +58,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def setEditorMode(self, name: str, type: Union[int, List[str]]) -> None:
|
||||
def setEditorMode(self, name: str, type: Union[int, List[str]], /) -> None:
|
||||
"""
|
||||
setEditorMode(name, type) -> None
|
||||
|
||||
Set the behaviour of the property in the property editor.
|
||||
|
||||
name : str
|
||||
@@ -79,10 +71,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getEditorMode(self, name: str) -> list:
|
||||
def getEditorMode(self, name: str, /) -> list:
|
||||
"""
|
||||
getEditorMode(name) -> list
|
||||
|
||||
Get the behaviour of the property in the property editor.
|
||||
It returns a list of strings with the current mode. If the list is empty there are no
|
||||
special restrictions.
|
||||
@@ -95,10 +85,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getGroupOfProperty(self, name: str) -> str:
|
||||
def getGroupOfProperty(self, name: str, /) -> str:
|
||||
"""
|
||||
getGroupOfProperty(name) -> str
|
||||
|
||||
Returns the name of the group which the property belongs to in this class.
|
||||
The properties are sorted in different named groups for convenience.
|
||||
|
||||
@@ -107,10 +95,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def setGroupOfProperty(self, name: str, group: str) -> None:
|
||||
def setGroupOfProperty(self, name: str, group: str, /) -> None:
|
||||
"""
|
||||
setGroupOfProperty(name, group) -> None
|
||||
|
||||
Set the name of the group of a dynamic property.
|
||||
|
||||
name : str
|
||||
@@ -120,12 +106,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def setPropertyStatus(
|
||||
self, name: str, val: Union[int, str, List[Union[str, int]]]
|
||||
) -> None:
|
||||
def setPropertyStatus(self, name: str, val: Union[int, str, List[Union[str, int]]], /) -> None:
|
||||
"""
|
||||
setPropertyStatus(name, val) -> None
|
||||
|
||||
Set property status.
|
||||
|
||||
name : str
|
||||
@@ -136,10 +118,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getPropertyStatus(self, name: str = "") -> list:
|
||||
def getPropertyStatus(self, name: str = "", /) -> list:
|
||||
"""
|
||||
getPropertyStatus(name='') -> list
|
||||
|
||||
Get property status.
|
||||
|
||||
name : str
|
||||
@@ -147,10 +127,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getDocumentationOfProperty(self, name: str) -> str:
|
||||
def getDocumentationOfProperty(self, name: str, /) -> str:
|
||||
"""
|
||||
getDocumentationOfProperty(name) -> str
|
||||
|
||||
Returns the documentation string of the property of this class.
|
||||
|
||||
name : str
|
||||
@@ -158,10 +136,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def setDocumentationOfProperty(self, name: str, docstring: str) -> None:
|
||||
def setDocumentationOfProperty(self, name: str, docstring: str, /) -> None:
|
||||
"""
|
||||
setDocumentationOfProperty(name, docstring) -> None
|
||||
|
||||
Set the documentation string of a dynamic property of this class.
|
||||
|
||||
name : str
|
||||
@@ -171,10 +147,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def getEnumerationsOfProperty(self, name: str) -> Optional[list]:
|
||||
def getEnumerationsOfProperty(self, name: str, /) -> Optional[list]:
|
||||
"""
|
||||
getEnumerationsOfProperty(name) -> list or None
|
||||
|
||||
Return all enumeration strings of the property of this class or None if not a
|
||||
PropertyEnumeration.
|
||||
|
||||
@@ -186,8 +160,6 @@ class PropertyContainer(Persistence):
|
||||
@constmethod
|
||||
def dumpPropertyContent(self, Property: str, *, Compression: int = 3) -> bytearray:
|
||||
"""
|
||||
dumpPropertyContent(Property, Compression=3) -> bytearray
|
||||
|
||||
Dumps the content of the property, both the XML representation and the additional
|
||||
data files required, into a byte representation.
|
||||
|
||||
@@ -198,10 +170,8 @@ class PropertyContainer(Persistence):
|
||||
"""
|
||||
...
|
||||
|
||||
def restorePropertyContent(self, name: str, obj: object) -> None:
|
||||
def restorePropertyContent(self, name: str, obj: object, /) -> None:
|
||||
"""
|
||||
restorePropertyContent(name, obj) -> None
|
||||
|
||||
Restore the content of the object from a byte representation as stored by `dumpPropertyContent`.
|
||||
It could be restored from any Python object implementing the buffer protocol.
|
||||
|
||||
@@ -213,10 +183,8 @@ class PropertyContainer(Persistence):
|
||||
...
|
||||
|
||||
@constmethod
|
||||
def renameProperty(self, oldName: str, newName: str) -> None:
|
||||
def renameProperty(self, oldName: str, newName: str, /) -> None:
|
||||
"""
|
||||
renameProperty(oldName, newName) -> None
|
||||
|
||||
Rename a property.
|
||||
|
||||
oldName : str
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, constmethod
|
||||
from Base.BaseClass import BaseClass
|
||||
from typing import Any, Final, overload, Dict
|
||||
@@ -16,13 +20,15 @@ class StringHasher(BaseClass):
|
||||
"""
|
||||
|
||||
@overload
|
||||
def __init__(self, *args: Any, **kwargs: Any) -> None:
|
||||
def getID(self, txt: str, base64: bool = False, /) -> Any:
|
||||
...
|
||||
|
||||
def getID(self, arg: Any, base64: bool = False) -> Any:
|
||||
"""
|
||||
getID(txt|id, base64=False) -> StringID
|
||||
@overload
|
||||
def getID(self, id: int, base64: bool = False, /) -> Any:
|
||||
...
|
||||
|
||||
def getID(self, arg: Any, base64: bool = False, /) -> Any:
|
||||
"""
|
||||
If the input is text, return a StringID object that is unique within this hasher. This
|
||||
StringID object is reference counted. The hasher may only save hash ID's that are used.
|
||||
|
||||
@@ -33,14 +39,8 @@ class StringHasher(BaseClass):
|
||||
"""
|
||||
...
|
||||
|
||||
@overload
|
||||
def getID(self, txt: str, base64: bool = False) -> Any: ...
|
||||
|
||||
@overload
|
||||
def getID(self, id: int, base64: bool = False) -> Any: ...
|
||||
|
||||
@constmethod
|
||||
def isSame(self, other: "StringHasher") -> bool:
|
||||
def isSame(self, other: "StringHasher", /) -> bool:
|
||||
"""
|
||||
Check if two hasher are the same
|
||||
"""
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from Base.Metadata import export, constmethod, class_declarations
|
||||
from Base.BaseClass import BaseClass
|
||||
from typing import Any, Final, List
|
||||
@@ -10,8 +14,7 @@ from typing import Any, Final, List
|
||||
@class_declarations("""private:
|
||||
friend class StringID;
|
||||
int _index = 0;
|
||||
"""
|
||||
)
|
||||
""")
|
||||
class StringID(BaseClass):
|
||||
"""
|
||||
This is the StringID class
|
||||
@@ -21,7 +24,7 @@ class StringID(BaseClass):
|
||||
"""
|
||||
|
||||
@constmethod
|
||||
def isSame(self, other: "StringID") -> bool:
|
||||
def isSame(self, other: "StringID", /) -> bool:
|
||||
"""
|
||||
Check if two StringIDs are the same
|
||||
"""
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from DocumentObjectExtension import DocumentObjectExtension
|
||||
|
||||
|
||||
@@ -7,4 +11,5 @@ class SuppressibleExtension(DocumentObjectExtension):
|
||||
Licence: LGPL
|
||||
Extension class which allows suppressing of document objects
|
||||
"""
|
||||
|
||||
...
|
||||
|
||||
Reference in New Issue
Block a user