diff --git a/src/Gui/AxisOrigin.pyi b/src/Gui/AxisOrigin.pyi new file mode 100644 index 0000000000..adece2cfd0 --- /dev/null +++ b/src/Gui/AxisOrigin.pyi @@ -0,0 +1,75 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Any, Final, Tuple, Dict + + +@export( + Constructor=True, + Delete=True, +) +class AxisOrigin(BaseClass): + """ + Gui.AxisOrigin class. + + Class for creating a Coin3D representation of a coordinate system. + + Author: Zheng, Lei (realthunder.dev@gmail.com) + Licence: LGPL + """ + + @constmethod + def getElementPicked(self, pickedPoint: Any) -> str: + """ + getElementPicked(pickedPoint) -> str + + Returns the picked element name. + + pickedPoint : coin.SoPickedPoint + """ + ... + + @constmethod + def getDetailPath(self, subname: str, path: Any) -> Any: + """ + getDetailPath(subname, path) -> coin.SoDetail or None + + Returns Coin detail of a subelement. + Note: Not fully implemented. Currently only returns None. + + subname : str + String reference to the subelement. + path: coin.SoPath + Output Coin path leading to the returned element detail. + """ + ... + + AxisLength: float = 0.0 + """Get/set the axis length.""" + + LineWidth: float = 0.0 + """Get/set the axis line width for rendering.""" + + PointSize: float = 0.0 + """Get/set the origin point size for rendering.""" + + Scale: float = 0.0 + """Get/set auto scaling factor, 0 to disable.""" + + Plane: Tuple[Any, ...] = () + """Get/set axis plane size and distance to axis line.""" + + Labels: Dict[str, str] = {} + """ + Get/set axis component names as a dictionary. + Available keys are: + 'O': origin + 'X': x axis + 'Y': y axis + 'Z': z axis + 'XY': xy plane + 'XZ': xz plane + 'YZ': yz plane + """ + + Node: Final[Any] = ... + """Get the Coin3D node.""" diff --git a/src/Gui/CMakeLists.txt b/src/Gui/CMakeLists.txt index a98cee9f14..66c4cb8978 100644 --- a/src/Gui/CMakeLists.txt +++ b/src/Gui/CMakeLists.txt @@ -271,18 +271,31 @@ if(FREECAD_USE_PYSIDE) endif(FREECAD_USE_PYSIDE) generate_from_xml(DocumentPy) +generate_from_py(Document) generate_from_xml(PythonWorkbenchPy) +generate_from_py(PythonWorkbench) generate_from_xml(ViewProviderPy) +generate_from_py(ViewProvider) generate_from_xml(ViewProviderDocumentObjectPy) +generate_from_py(ViewProviderDocumentObject) generate_from_xml(ViewProviderGeometryObjectPy) +generate_from_py(ViewProviderGeometryObject) generate_from_xml(ViewProviderExtensionPy) +generate_from_py(ViewProviderExtension) generate_from_xml(WorkbenchPy) +generate_from_py(Workbench) generate_from_xml(Selection/SelectionObjectPy) +generate_from_py(Selection/SelectionObjectPy) generate_from_xml(LinkViewPy) +generate_from_py(LinkView) generate_from_xml(ViewProviderLinkPy) +generate_from_py(ViewProviderLink) generate_from_xml(AxisOriginPy) +generate_from_py(AxisOrigin) generate_from_xml(CommandPy) +generate_from_py(Command) generate_from_xml(Navigation/NavigationStylePy) +generate_from_py(Navigation/NavigationStyle) generate_embed_from_py(FreeCADGuiInit GuiInitScript.h) diff --git a/src/Gui/Command.pyi b/src/Gui/Command.pyi new file mode 100644 index 0000000000..3ff64ae94d --- /dev/null +++ b/src/Gui/Command.pyi @@ -0,0 +1,183 @@ +from Base.Metadata import constmethod +from Base.PyObjectBase import PyObjectBase +from typing import Any, Dict, List, Optional + + +class Command(PyObjectBase): + """ + FreeCAD Python wrapper of Command functions + + Author: Werner Mayer (wmayer[at]users.sourceforge.net) + Licence: LGPL + """ + + @staticmethod + def get(name: str) -> Optional["Command"]: + """ + get(name) -> Gui.Command or None + + Get a given command by name or None if it doesn't exist. + + name : str + Command name. + """ + ... + + @staticmethod + def update() -> None: + """ + update() -> None + + Update active status of all commands. + """ + ... + + @staticmethod + def listAll() -> List[str]: + """ + listAll() -> list of str + + Returns the name of all commands. + """ + ... + + @staticmethod + def listByShortcut(string: str, useRegExp: bool = False) -> List[str]: + """ + listByShortcut(string, useRegExp=False) -> list of str + + Returns a list of all commands, filtered by shortcut. + Shortcuts are converted to uppercase and spaces removed + prior to comparison. + + string : str + Shortcut to be searched. + useRegExp : bool + Filter using regular expression. + """ + ... + + def run(self, item: int = 0) -> None: + """ + run(item=0) -> None + + Runs the given command. + + item : int + Item to be run. + """ + ... + + @constmethod + def isActive(self) -> bool: + """ + isActive() -> bool + + Returns True if the command is active, False otherwise. + """ + ... + + def getShortcut(self) -> str: + """ + getShortcut() -> str + + Returns string representing shortcut key accelerator for command. + """ + ... + + def setShortcut(self, string: str) -> bool: + """ + setShortcut(string) -> bool + + Sets shortcut for given command, returns True for success. + + string : str + Shortcut to be set. + """ + ... + + def resetShortcut(self) -> bool: + """ + resetShortcut() -> bool + + Resets shortcut for given command back to the default, returns True for success. + """ + ... + + def getInfo(self) -> Dict[Any, Any]: + """ + getInfo() -> dict + + Return information about this command. + """ + ... + + def getAction(self) -> List[Any]: + """ + getAction() -> list of QAction + + Return the associated QAction object. + """ + ... + + @staticmethod + def createCustomCommand( + *, + macroFile: str, + menuText: str, + toolTip: str, + whatsThis: str, + statusTip: str, + pixmap: str, + shortcut: str + ) -> str: + """ + createCustomCommand(macroFile, menuText, toolTip, whatsThis, statusTip, pixmap, shortcut) -> str + + Create a custom command for a macro. Returns name of the created command. + + macroFile : str + Macro file. + menuText : str + Menu text. Optional. + toolTip : str + Tool tip text. Optional. + whatsThis : str + `What's this?` text. Optional. + statusTip : str + Status tip text. Optional. + pixmap : str + Pixmap name. Optional. + shortcut : str + Shortcut key sequence. Optional. + """ + ... + + @staticmethod + def removeCustomCommand(name: str) -> bool: + """ + removeCustomCommand(name) -> bool + + Remove the custom command if it exists. + Given the name of a custom command, this removes that command. + It is not an error to remove a non-existent command, the function + simply does nothing in that case. + Returns True if something was removed, or False if not. + + name : str + Command name. + """ + ... + + @staticmethod + def findCustomCommand(name: str) -> Optional[str]: + """ + findCustomCommand(name) -> str or None + + Given the name of a macro, return the name of the custom command for that macro + or None if there is no command matching that macro script name. + + name : str + Macro name. + """ + ... diff --git a/src/Gui/Document.pyi b/src/Gui/Document.pyi new file mode 100644 index 0000000000..3c585d7c7c --- /dev/null +++ b/src/Gui/Document.pyi @@ -0,0 +1,255 @@ +from Base.Metadata import constmethod +from Base.Persistence import Persistence +from Base.Matrix import Matrix +from typing import Any, Final, List, Optional + + +class Document(Persistence): + """ + This is a Document class + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + + def show(self, objName: str) -> None: + """ + show(objName) -> None + + Show an object. + + objName : str + Name of the `Gui.ViewProvider` to show. + """ + ... + + def hide(self, objName: str) -> None: + """ + hide(objName) -> None + + Hide an object. + + objName : str + Name of the `Gui.ViewProvider` to hide. + """ + ... + + def setPos(self, objName: str, matrix: Matrix) -> None: + """ + setPos(objName, matrix) -> None + + Set the position of an object. + + objName : str + Name of the `Gui.ViewProvider`. + + matrix : Base.Matrix + Transformation to apply on the object. + """ + ... + + def setEdit(self, obj: Any, mod: int = 0, subName: Optional[str] = None) -> bool: + """ + setEdit(obj, mod=0, subName) -> bool + + Set an object in edit mode. + + obj : str, App.DocumentObject, Gui.ViewPrivider + Object to set in edit mode. + mod : int + Edit mode. + subName : str + Subelement name. Optional. + """ + ... + + def getInEdit(self) -> Optional[Any]: + """ + getInEdit() -> Gui.ViewProviderDocumentObject or None + + Returns the current object in edit mode or None if there is no such object. + """ + ... + + def resetEdit(self) -> None: + """ + resetEdit() -> None + + End the current editing. + """ + ... + + def addAnnotation(self, annoName: str, fileName: str, modName: str) -> None: + """ + addAnnotation(annoName, fileName, modName) -> None + + Add an Inventor object from a file. + + annoName : str + Annotation name. + fileName : str + File name. + modName : str + Display mode name. Optional. + """ + ... + + def update(self) -> None: + """ + update() -> None + + Update the view representations of all objects. + """ + ... + + def getObject(self, objName: str) -> Optional[Any]: + """ + getObject(objName) -> object or None + + Return the object with the given name. If no one exists, return None. + + ObjName : str + Object name. + """ + ... + + def activeObject(self) -> Optional[Any]: + """ + activeObject() -> object or None + + The active object of the document. Deprecated, use ActiveObject. + """ + ... + + def activeView(self) -> Optional[Any]: + """ + activeView() -> object or None + + The active view of the document. Deprecated, use ActiveView. + """ + ... + + def createView(self, type: str) -> Optional[Any]: + """ + createView(type) -> object or None + + Return a newly created view of a given type. + + type : str + Type name. + """ + ... + + @constmethod + def mdiViewsOfType(self, type: str) -> List[Any]: + """ + mdiViewsOfType(type) -> list of MDIView + + Return a list of mdi views of a given type. + + type : str + Type name. + """ + ... + + def save(self) -> bool: + """ + save() -> bool + + Attempts to save the document + """ + ... + + def saveAs(self) -> bool: + """ + saveAs() -> bool + + Attempts to save the document under a new name + """ + ... + + def sendMsgToViews(self, msg: str) -> None: + """ + sendMsgToViews(msg) -> None + + Send a message to all views of the document. + + msg : str + """ + ... + + def mergeProject(self, fileName: str) -> None: + """ + mergeProject(fileName) -> None + + Merges this document with another project file. + + fileName : str + File name. + """ + ... + + def toggleTreeItem( + self, obj: Any, mod: int = 0, subName: Optional[str] = None + ) -> None: + """ + toggleTreeItem(obj, mod=0, subName) -> None + + Change TreeItem of a document object. + + obj : App.DocumentObject + mod : int + Item mode. + 0: Toggle, 1: Collapse, 2: Expand, 3: Expand path. + subName : str + Subelement name. Optional. + """ + ... + + def scrollToTreeItem(self, obj: Any) -> None: + """ + scrollToTreeItem(obj) -> None + + Scroll the tree view to the item of a view object. + + obj : Gui.ViewProviderDocumentObject + """ + ... + + def toggleInSceneGraph(self, obj: Any) -> None: + """ + toggleInSceneGraph(obj) -> None + + Add or remove view object from scene graph of all views depending + on its canAddToSceneGraph(). + + obj : Gui.ViewProvider + """ + ... + + ActiveObject: Any = ... + """The active object of the document.""" + + ActiveView: Any = ... + """The active view of the document.""" + + EditingTransform: Any = ... + """The editing transformation matrix.""" + + InEditInfo: Any = ... + """A tuple(obj,subname,subElement,editMode) of editing object reference, or None if no object is in edit.""" + + EditMode: Final[int] = 0 + """Current edit mode. Only meaningful when there is a current object in edit.""" + + Document: Final[Any] = ... + """The related App document to this Gui document.""" + + Transacting: Final[bool] = False + """Indicate whether the document is undoing/redoing.""" + + Modified: bool = False + """Returns True if the document is marked as modified, and False otherwise.""" + + TreeRootObjects: Final[List[Any]] = [] + """The list of tree root objects.""" diff --git a/src/Gui/LinkView.pyi b/src/Gui/LinkView.pyi new file mode 100644 index 0000000000..fbd1dd47f5 --- /dev/null +++ b/src/Gui/LinkView.pyi @@ -0,0 +1,182 @@ +from Base.Metadata import export, constmethod +from Base.BaseClass import BaseClass +from typing import Any, Final, List, Dict, Tuple, overload + + +@export( + Include="Gui/ViewProviderLink.h", + Constructor=True, + Delete=True, +) +class LinkView(BaseClass): + """ + Helper class to link to a view object + + Author: Zheng, Lei (realthunder.dev@gmail.com) + Licence: LGPL + """ + + def reset(self) -> None: + """ + Reset the link view and clear the links + """ + ... + + def setMaterial(self, material: Any) -> None: + """ + setMaterial(Material): set the override material of the entire linked object + + setMaterial([Material,...]): set the materials for the elements of the link + array/group. + + setMaterial({Int:Material,...}): set the material for the elements of the + link array/group by index. + + If material is None, then the material is unset. If the material of an element + is unset, it defaults to the override material of the linked object, if there + is one + """ + ... + + @overload + def setMaterial(self, material: None) -> None: ... + + @overload + def setMaterial(self, material: Any) -> None: ... + + @overload + def setMaterial(self, material: List[Any]) -> None: ... + + @overload + def setMaterial(self, material: Dict[int, Any]) -> None: ... + + def setType(self, type: int, sublink: bool = True) -> None: + """ + setType(type, sublink=True): set the link type. + + type=0: override transformation and visibility + type=1: override visibility + type=2: no override + type=-1: sub-object link with override visibility + type=-2: sub-object link with override transformation and visibility + + sublink: auto delegate to the sub-object references in the link, if there is + one and only one. + """ + ... + + @overload + def setType(self, type: int) -> None: ... + + @overload + def setType(self, type: int, sublink: bool) -> None: ... + + def setTransform(self, matrix: Any) -> None: + """ + setTransform(matrix): set transformation of the linked object + + setTransform([matrix,...]): set transformation for the elements of the link + array/group + + setTransform({index:matrix,...}): set transformation for elements of the link + array/group by index + """ + ... + + @overload + def setTransform(self, matrix: Any) -> None: ... + + @overload + def setTransform(self, matrix: List[Any]) -> None: ... + + @overload + def setTransform(self, matrix: Dict[int, Any]) -> None: ... + + def setChildren( + self, children: List[Any], vis: List[Any] = [], type: int = 0 + ) -> None: + """ + setChildren([obj...],vis=[],type=0) + Group a list of children objects. Note, this mode of operation is incompatible + with link array. Calling this function will deactivate link array. And calling + setSize() will reset all linked children. + + vis: initial visibility status of the children + + type: children linking type, + 0: override transformation and visibility, + 1: override visibility, + 2: override none. + """ + ... + + def setLink(self, obj: Any, subname: Any = None) -> None: + """ + setLink(object): Set the link + + setLink(object, subname): Set the link with a sub-object reference + + setLink(object, [subname,...]): Set the link with a list of sub object references + + object: The linked document object or its view object + + subname: a string or tuple/list of strings sub-name references to sub object + or sub elements (e.g. Face1, Edge2) belonging to the linked object. + The sub-name must end with a '.' if it is referencing an sub-object, + or else it is considered a sub-element reference. + """ + ... + + @overload + def setLink(self, obj: Any) -> None: ... + + @overload + def setLink(self, obj: Any, subname: str) -> None: ... + + @overload + def setLink(self, obj: Any, subname: List[str]) -> None: ... + + def getDetailPath(self, element: Any) -> Tuple[Any, Any]: + """ + getDetailPath(element): get the 3d path an detail of an element. + + Return a tuple(path,detail) for the coin3D SoPath and SoDetail of the element + """ + ... + + def getElementPicked(self, pickPoint: Any) -> Any: + """ + getElementPicked(pickPoint): get the element under a 3d pick point. + """ + ... + + def getBoundBox(self, vobj: Any = None) -> Any: + """ + getBoundBox(vobj=None): get the bounding box. + """ + ... + + @constmethod + def getChildren(self) -> Any: + """ + Get children view objects + """ + ... + + LinkedView: Final[Any] = ... + """The linked view object""" + + SubNames: Final[Any] = ... + """The sub-object reference of the link""" + + RootNode: Final[Any] = ... + """A pivy node holding the cloned representation of the linked view object""" + + Owner: Any = ... + """The owner view object of this link handle""" + + Visibilities: Any = ... + """Get/set the child element visibility""" + + Count: int = 0 + """Set the element size to create an array of linked object""" diff --git a/src/Gui/Navigation/NavigationStyle.pyi b/src/Gui/Navigation/NavigationStyle.pyi new file mode 100644 index 0000000000..286d25766f --- /dev/null +++ b/src/Gui/Navigation/NavigationStyle.pyi @@ -0,0 +1,15 @@ +from Base.Metadata import export +from Base.BaseClass import BaseClass + + +@export( + Include="Gui/Navigation/NavigationStyle.h", +) +class NavigationStyle(BaseClass): + """ + This is the base class for navigation styles + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + ... diff --git a/src/Gui/PythonWorkbench.pyi b/src/Gui/PythonWorkbench.pyi new file mode 100644 index 0000000000..f8d2943c0e --- /dev/null +++ b/src/Gui/PythonWorkbench.pyi @@ -0,0 +1,142 @@ +from Base.Metadata import export +from Workbench import Workbench +from warnings import deprecated + + +@export( + Twin="PythonBaseWorkbench", + TwinPointer="PythonBaseWorkbench", + Include="Gui/Workbench.h", +) +class PythonWorkbench(Workbench): + """ + This is the class for Python workbenches + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + + def appendMenu(self) -> None: + """ + Append a new menu + """ + ... + + def removeMenu(self) -> None: + """ + Remove a menu + """ + ... + + def appendContextMenu(self) -> None: + """ + Append a new context menu item + """ + ... + + def removeContextMenu(self) -> None: + """ + Remove a context menu item + """ + ... + + def appendToolbar(self) -> None: + """ + Append a new toolbar + """ + ... + + def removeToolbar(self) -> None: + """ + Remove a toolbar + """ + ... + + def appendCommandbar(self) -> None: + """ + Append a new command bar + """ + ... + + def removeCommandbar(self) -> None: + """ + Remove a command bar + """ + ... + + @deprecated + def AppendMenu(self) -> None: + """ + deprecated -- use appendMenu + """ + ... + + @deprecated + def RemoveMenu(self) -> None: + """ + deprecated -- use removeMenu + """ + ... + + @deprecated + def ListMenus(self) -> None: + """ + deprecated -- use listMenus + """ + ... + + @deprecated + def AppendContextMenu(self) -> None: + """ + deprecated -- use appendContextMenu + """ + ... + + @deprecated + def RemoveContextMenu(self) -> None: + """ + deprecated -- use removeContextMenu + """ + ... + + @deprecated + def AppendToolbar(self) -> None: + """ + deprecated -- use appendToolbar + """ + ... + + @deprecated + def RemoveToolbar(self) -> None: + """ + deprecated -- use removeToolbar + """ + ... + + @deprecated + def ListToolbars(self) -> None: + """ + deprecated -- use listToolbars + """ + ... + + @deprecated + def AppendCommandbar(self) -> None: + """ + deprecated -- use appendCommandBar + """ + ... + + @deprecated + def RemoveCommandbar(self) -> None: + """ + deprecated -- use removeCommandBar + """ + ... + + @deprecated + def ListCommandbars(self) -> None: + """ + deprecated -- use listCommandBars + """ + ... diff --git a/src/Gui/Selection/SelectionObject.pyi b/src/Gui/Selection/SelectionObject.pyi new file mode 100644 index 0000000000..efd2e3fd59 --- /dev/null +++ b/src/Gui/Selection/SelectionObject.pyi @@ -0,0 +1,62 @@ +from Base.Metadata import export +from Base.BaseClass import BaseClass +from typing import Any, Final, Tuple + + +@export( + Include="Gui/Selection/SelectionObject.h", + Delete=True, +) +class SelectionObject(BaseClass): + """ + This class represents selections made by the user. It holds information about the object, document and sub-element of the selection. + + Author: Juergen Riegel (FreeCAD@juergen-riegel.net) + Licence: LGPL + """ + + def remove(self) -> None: + """ + Remove this selection item from the selection. + remove() -> None + -- + This object becomes invalid. + """ + ... + + def isObjectTypeOf(self, type: Any) -> bool: + """ + Test for a certain father class. + isObjectTypeOf(type) -> Bool + """ + ... + + ObjectName: Final[str] = "" + """Name of the selected object""" + + SubElementNames: Final[Tuple[str, ...]] = () + """Name of the selected sub-element if any""" + + FullName: Final[str] = "" + """Name of the selected object""" + + TypeName: Final[str] = "" + """Type name of the selected object""" + + DocumentName: Final[str] = "" + """Name of the document of the selected object""" + + Document: Final[Any] = ... + """Document of the selected object""" + + Object: Final[Any] = ... + """Selected object""" + + SubObjects: Final[Tuple[Any, ...]] = () + """Selected sub-element, if any""" + + PickedPoints: Final[Tuple[Any, ...]] = () + """Picked points for selection""" + + HasSubObjects: Final[bool] = False + """Selected sub-element, if any""" diff --git a/src/Gui/ViewProvider.pyi b/src/Gui/ViewProvider.pyi new file mode 100644 index 0000000000..5d651e9893 --- /dev/null +++ b/src/Gui/ViewProvider.pyi @@ -0,0 +1,369 @@ +from Base.Metadata import constmethod +from Base.BoundBox import BoundBox +from App.ExtensionContainer import ExtensionContainer +from typing import Any, Final, List, Optional + + +class ViewProvider(ExtensionContainer): + """ + This is the ViewProvider base class + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + + def addProperty( + self, + type: str, + name: str, + group: str, + doc: str, + attr: int = 0, + ro: bool = False, + hd: bool = False, + ) -> "ViewProvider": + """ + addProperty(type, name, group, doc, attr=0, ro=False, hd=False) -> ViewProvider + + Add a generic property. + + type : str + Property type. + name : str + Property name. Optional. + group : str + Property group. Optional. + attr : int + Property attributes. + ro : bool + Read only property. + hd : bool + Hidden property. + """ + ... + + def removeProperty(self, name: str) -> bool: + """ + removeProperty(name) -> bool + + Remove a generic property. + Only user-defined properties can be removed, not built-in ones. + + name : str + Property name. + """ + ... + + def supportedProperties(self) -> list: + """ + supportedProperties() -> list + + A list of supported property types. + """ + ... + + def show(self) -> None: + """ + show() -> None + + Show the object. + """ + ... + + def hide(self) -> None: + """ + hide() -> None + + Hide the object. + """ + ... + + def isVisible(self) -> bool: + """ + isVisible() -> bool + + Check if the object is visible. + """ + ... + + def canDragObject(self, obj: Any = None) -> bool: + """ + canDragObject(obj=None) -> bool + + Check whether the child object can be removed by dragging. + If 'obj' is not given, check without filter by any particular object. + + obj : App.DocumentObject + Object to be dragged. + """ + ... + + def dragObject(self, obj: Any) -> None: + """ + dragObject(obj) -> None + + Remove a child object by dropping. + + obj : App.DocumentObject + Object to be dragged. + """ + ... + + def canDropObject( + self, + *, + obj: Any = None, + owner: Any = None, + subname: str, + elem: Optional[List[str]] = None + ) -> bool: + """ + canDropObject(obj=None, owner=None, subname, elem=None) -> bool + + Check whether the child object can be added by dropping. + If 'obj' is not given, check without filter by any particular object. + + obj : App.DocumentObject + Object to be dropped. + owner : App.DocumentObject + Parent object of the dropping object. + subname : str + Subname reference to the dropping object. Optional. + elem : sequence of str + Non-objects subelements selected when the object is + being dropped. + """ + ... + + def dropObject( + self, + *, + obj: Any, + owner: Any = None, + subname: str, + elem: Optional[List[str]] = None + ) -> str: + """ + dropObject(obj, owner=None, subname, elem=None) -> str + + Add a child object by dropping. + + obj : App.DocumentObject + Object to be dropped. + owner : App.DocumentObject + Parent object of the dropping object. + subname : str + Subname reference to the dropping object. Optional. + elem : sequence of str + Non-objects subelements selected when the object is + being dropped. + """ + ... + + def canDragAndDropObject(self, obj: Any) -> bool: + """ + canDragAndDropObject(obj) -> bool + + Check whether the child object can be removed from + other parent and added here by drag and drop. + + obj : App.DocumentObject + Object to be dragged and dropped. + """ + ... + + def replaceObject(self, oldObj: Any, newObj: Any) -> int: + """ + replaceObject(oldObj, newObj) -> int + + Replace a child object. + Returns 1 if succeeded, 0 if not found, -1 if not supported. + + oldObj : App.DocumentObject + Old object. + newObj : App.DocumentObject + New object. + """ + ... + + def doubleClicked(self) -> bool: + """ + doubleClicked() -> bool + + Trigger double clicking the corresponding tree item of this view object. + """ + ... + + def addDisplayMode(self, obj: Any, mode: str) -> None: + """ + addDisplayMode(obj, mode) -> None + + Add a new display mode to the view provider. + + obj : coin.SoNode + Display mode. + mode : str + Name of the display mode. + """ + ... + + def listDisplayModes(self) -> list: + """ + listDisplayModes() -> list + + Show a list of all display modes. + """ + ... + + def toString(self) -> str: + """ + toString() -> str + + Return a string representation of the Inventor node. + """ + ... + + def setTransformation(self, trans: Any) -> None: + """ + setTransformation(trans) -> None + + Set a transformation on the Inventor node. + + trans : Base.Placement, Base.Matrix + """ + ... + + @constmethod + def claimChildren(self) -> list: + """ + claimChildren() -> list + + Returns list of objects that are to be grouped in tree under this object. + """ + ... + + @constmethod + def claimChildrenRecursive(self) -> list: + """ + claimChildrenRecursive() -> list + + Returns list of objects that are to be grouped in tree under this object recursively. + """ + ... + + def partialRender(self, sub: Any = None, clear: bool = False) -> int: + """ + partialRender(sub=None, clear=False) -> int + + Render only part of the object. + + sub: None, str, sequence of str + Refer to the subelement. If it is None then reset the partial rendering. + clear: bool + True to add, or False to remove the subelement(s) for rendering. + """ + ... + + def getElementColors(self, elementName: Optional[str] = None) -> dict: + """ + getElementColors(elementName) -> dict + + Get a dictionary of the form {elementName : (r,g,b,a)}. + If no element name is given a dictionary with all the elements is returned. + + elementName : str + Name of the element. Optional. + """ + ... + + def setElementColors(self, colors: dict) -> None: + """ + setElementColors(colors) -> None + + Set element colors. + + colors: dict + Color dictionary of the form {elementName:(r,g,b,a)}. + """ + ... + + @constmethod + def getElementPicked(self, pickPoint: Any) -> str: + """ + getElementPicked(pickPoint) -> str + + Return the picked subelement. + + pickPoint : coin.SoPickedPoint + """ + ... + + @constmethod + def getDetailPath(self, subelement: str, path: Any, append: bool = True) -> Any: + """ + getDetailPath(subelement, path, append=True) -> coin.SoDetail or None + + Return Coin detail and path of an subelement. + + subname: str + Dot separated string reference to the sub element. + pPath: coin.SoPath + Output coin path leading to the returned element detail. + append: bool + If True, path will be first appended with the root node and the mode + switch node of this view provider. + """ + ... + + @constmethod + def signalChangeIcon(self) -> None: + """ + signalChangeIcon() -> None + + Trigger icon changed signal. + """ + ... + + def getBoundingBox( + self, subName: Optional[str] = None, transform: bool = True, view: Any = None + ) -> BoundBox: + """ + getBoundingBox(subName, transform=True, view) -> Base.BoundBox + + Obtain the bounding box of this view object. + + subName : str + Name referring a sub-object. Optional. + transform: bool + Whether to apply the transformation matrix of this view provider. + view: View3DInventorPy + Default to active view. Optional. + """ + ... + + Annotation: Any = ... + """A pivy Separator to add a custom scenegraph to this ViewProvider.""" + + Icon: Final[Any] = ... + """The icon of this ViewProvider.""" + + RootNode: Any = ... + """A pivy Separator with the root of this ViewProvider.""" + + SwitchNode: Any = ... + """A pivy SoSwitch for the display mode switch of this ViewProvider.""" + + DefaultMode: int = 0 + """Get/Set the default display mode in turns of coin node index.""" + + IV: Final[str] = "" + """Represents the whole ViewProvider as an Inventor string.""" + + CanRemoveChildrenFromRoot: Final[bool] = False + """Tells the tree view whether to remove the children item from root or not.""" + + LinkVisibility: bool = False + """Get/set visibilities of all links to this view object.""" + + DropPrefix: Final[str] = "" + """Subname referencing the sub-object for holding dropped object.""" diff --git a/src/Gui/ViewProviderDocumentObject.pyi b/src/Gui/ViewProviderDocumentObject.pyi new file mode 100644 index 0000000000..2057c2bd14 --- /dev/null +++ b/src/Gui/ViewProviderDocumentObject.pyi @@ -0,0 +1,26 @@ +from ViewProvider import ViewProvider +from typing import Any, Final + + +class ViewProviderDocumentObject(ViewProvider): + """ + This is the ViewProvider base class + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + + def update(self) -> None: + """ + Update the view representation of the object + """ + ... + + Object: Any = ... + """Set/Get the associated data object""" + + ForceUpdate: bool = False + """Reference count to force update visual""" + + Document: Final[Any] = ... + """Return the document the view provider is part of""" diff --git a/src/Gui/ViewProviderExtension.pyi b/src/Gui/ViewProviderExtension.pyi new file mode 100644 index 0000000000..66df2b2695 --- /dev/null +++ b/src/Gui/ViewProviderExtension.pyi @@ -0,0 +1,24 @@ +from Base.Metadata import constmethod +from App.Extension import Extension + + +class ViewProviderExtension(Extension): + """ + Base class for all view provider extensions + + Author: Werner Mayer (wmayer[at]users.sourceforge.net) + Licence: LGPL + """ + + def setIgnoreOverlayIcon(self) -> None: + """ + Ignore the overlay icon of an extension + """ + ... + + @constmethod + def ignoreOverlayIcon(self) -> None: + """ + Ignore the overlay icon of an extension + """ + ... diff --git a/src/Gui/ViewProviderGeometryObject.pyi b/src/Gui/ViewProviderGeometryObject.pyi new file mode 100644 index 0000000000..6034c942ff --- /dev/null +++ b/src/Gui/ViewProviderGeometryObject.pyi @@ -0,0 +1,21 @@ +from Base.Metadata import no_args +from ViewProviderDocumentObject import ViewProviderDocumentObject + + +class ViewProviderGeometryObject(ViewProviderDocumentObject): + """ + This is the ViewProvider geometry class + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + + @staticmethod + @no_args + def getUserDefinedMaterial() -> object: + """ + getUserDefinedMaterial() -> object + + Get a material object with the user-defined colors. + """ + ... diff --git a/src/Gui/ViewProviderLink.pyi b/src/Gui/ViewProviderLink.pyi new file mode 100644 index 0000000000..b9a3ebf84a --- /dev/null +++ b/src/Gui/ViewProviderLink.pyi @@ -0,0 +1,17 @@ +from ViewProviderDocumentObject import ViewProviderDocumentObject +from typing import Any, Final + + +class ViewProviderLink(ViewProviderDocumentObject): + """ + This is the ViewProviderLink class + + Author: Zheng, Lei (realthunder.dev@gmail.com) + Licence: LGPL + """ + + DraggingPlacement: Any = ... + """Get/set dragger placement during dragging""" + + LinkView: Final[Any] = ... + """Get the associated LinkView object""" diff --git a/src/Gui/Workbench.pyi b/src/Gui/Workbench.pyi new file mode 100644 index 0000000000..0c88fb61d8 --- /dev/null +++ b/src/Gui/Workbench.pyi @@ -0,0 +1,58 @@ +from Base.Metadata import export +from Base.BaseClass import BaseClass +from typing import Any, List, Dict + + +@export( + Include="Gui/Workbench.h", +) +class Workbench(BaseClass): + """ + This is the base class for workbenches + + Author: Werner Mayer (wmayer@users.sourceforge.net) + Licence: LGPL + """ + + def name(self) -> str: + """ + Return the workbench name + """ + ... + + def activate(self) -> None: + """ + Activate this workbench + """ + ... + + def listToolbars(self) -> List[Any]: + """ + Show a list of all toolbars + """ + ... + + def getToolbarItems(self) -> Dict[Any, Any]: + """ + Show a dict of all toolbars and their commands + """ + ... + + def listCommandbars(self) -> List[Any]: + """ + Show a list of all command bars + """ + ... + + def listMenus(self) -> List[Any]: + """ + Show a list of all menus + """ + ... + + @staticmethod + def reloadActive() -> None: + """ + Reload the active workbench after changing menus or toolbars + """ + ...