Finalizing Python interface bindings for Robot, Spreadsheet, Surface.

This commit is contained in:
Ian 'z0r0' Abreu
2025-08-31 15:41:14 -04:00
parent ca435629b8
commit df20bc6609
28 changed files with 48 additions and 794 deletions

View File

@@ -19,19 +19,19 @@ set(Spreadsheet_SRCS
PreCompiled.h
PropertySheet.cpp
PropertySheet.h
PropertySheetPy.xml
PropertySheet.pyi
PropertySheetPyImp.cpp
PropertyColumnWidths.cpp
PropertyColumnWidths.h
PropertyColumnWidthsPy.xml
PropertyColumnWidths.pyi
PropertyColumnWidthsPyImp.cpp
PropertyRowHeights.cpp
PropertyRowHeights.h
PropertyRowHeightsPy.xml
PropertyRowHeights.pyi
PropertyRowHeightsPyImp.cpp
Sheet.cpp
Sheet.h
SheetPy.xml
Sheet.pyi
SheetPyImp.cpp
SheetObserver.cpp
SheetObserver.h
@@ -40,15 +40,10 @@ set(Spreadsheet_SRCS
AppSpreadsheet.cpp
)
generate_from_xml(SheetPy)
generate_from_xml(PropertySheetPy)
generate_from_xml(PropertyColumnWidthsPy)
generate_from_xml(PropertyRowHeightsPy)
generate_from_py_(SheetPy)
generate_from_py_(PropertySheetPy)
generate_from_py_(PropertyColumnWidthsPy)
generate_from_py_(PropertyRowHeightsPy)
generate_from_py(Sheet)
generate_from_py(PropertySheet)
generate_from_py(PropertyColumnWidths)
generate_from_py(PropertyRowHeights)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)

View File

@@ -0,0 +1,12 @@
from Base.Metadata import export
from Base.Persistence import Persistence
@export(
Include="Mod/Spreadsheet/App/PropertyColumnWidths.h",
Namespace="Spreadsheet",
Constructor=True,
)
class PropertyColumnWidths(Persistence):
"""
Internal spreadsheet object
"""

View File

@@ -1,18 +0,0 @@
from Base.Metadata import export
from Base.Persistence import Persistence
@export(
Father="PersistencePy",
Name="PropertyColumnWidthsPy",
Twin="PropertyColumnWidths",
TwinPointer="PropertyColumnWidths",
Include="Mod/Spreadsheet/App/PropertyColumnWidths.h",
Namespace="Spreadsheet",
FatherInclude="Base/PersistencePy.h",
FatherNamespace="Base",
Constructor=True,
)
class PropertyColumnWidthsPy(Persistence):
"""
Internal spreadsheet object
"""

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PersistencePy"
Name="PropertyColumnWidthsPy"
Twin="PropertyColumnWidths"
TwinPointer="PropertyColumnWidths"
Include="Mod/Spreadsheet/App/PropertyColumnWidths.h"
Namespace="Spreadsheet"
FatherInclude="Base/PersistencePy.h"
FatherNamespace="Base"
Constructor="true">
<Documentation>
<Author Licence="LGPL" Name="Eivind Kvedalen" EMail="eivind@kvedalen.name" />
<UserDocu>Internal spreadsheet object</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@@ -2,17 +2,11 @@ from Base.Metadata import export
from Base.Persistence import Persistence
@export(
Father="PersistencePy",
Name="PropertyRowHeightsPy",
Twin="PropertyRowHeights",
TwinPointer="PropertyRowHeights",
Include="Mod/Spreadsheet/App/PropertyRowHeights.h",
Namespace="Spreadsheet",
FatherInclude="Base/PersistencePy.h",
FatherNamespace="Base",
Constructor=True,
)
class PropertyRowHeightsPy(Persistence):
class PropertyRowHeights(Persistence):
"""
Internal spreadsheet object
"""

View File

@@ -1,18 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PersistencePy"
Name="PropertyRowHeightsPy"
Twin="PropertyRowHeights"
TwinPointer="PropertyRowHeights"
Include="Mod/Spreadsheet/App/PropertyRowHeights.h"
Namespace="Spreadsheet"
FatherInclude="Base/PersistencePy.h"
FatherNamespace="Base"
Constructor="true">
<Documentation>
<Author Licence="LGPL" Name="Eivind Kvedalen" EMail="eivind@kvedalen.name" />
<UserDocu>Internal spreadsheet object</UserDocu>
</Documentation>
</PythonExport>
</GenerateModel>

View File

@@ -2,20 +2,14 @@ from Base.Metadata import export, sequence_protocol
from Base.Persistence import Persistence
@export(
Father="PersistencePy",
Name="PropertySheetPy",
Twin="PropertySheet",
TwinPointer="PropertySheet",
Include="Mod/Spreadsheet/App/PropertySheet.h",
Namespace="Spreadsheet",
FatherInclude="Base/PersistencePy.h",
FatherNamespace="Base",
Constructor=True,
)
@sequence_protocol(
mp_subscript="true",
)
class PropertySheetPy(Persistence):
class PropertySheet(Persistence):
"""
Internal spreadsheet object
"""

View File

@@ -1,30 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="PersistencePy"
Name="PropertySheetPy"
Twin="PropertySheet"
TwinPointer="PropertySheet"
Include="Mod/Spreadsheet/App/PropertySheet.h"
Namespace="Spreadsheet"
FatherInclude="Base/PersistencePy.h"
FatherNamespace="Base"
Constructor="true">
<Documentation>
<Author Licence="LGPL" Name="Eivind Kvedalen" EMail="eivind@kvedalen.name" />
<UserDocu>Internal spreadsheet object</UserDocu>
</Documentation>
<Sequence
sq_length="false"
sq_concat="false"
sq_repeat="false"
sq_item="false"
mp_subscript="true"
sq_ass_item="false"
mp_ass_subscript="false"
sq_contains="false"
sq_inplace_concat="false"
sq_inplace_repeat="false">
</Sequence>
</PythonExport>
</GenerateModel>

View File

@@ -5,17 +5,11 @@ from Base.Metadata import export
from App.DocumentObject import DocumentObject
@export(
Father="DocumentObjectPy",
Name="SheetPy",
Twin="Sheet",
TwinPointer="Sheet",
Include="Mod/Spreadsheet/App/Sheet.h",
Namespace="Spreadsheet",
FatherInclude="App/DocumentObjectPy.h",
FatherNamespace="App",
Constructor=True,
)
class SheetPy(DocumentObject):
class Sheet(DocumentObject):
"""
With this object you can manipulate spreadsheets
"""

View File

@@ -1,231 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="DocumentObjectPy"
Name="SheetPy"
Twin="Sheet"
TwinPointer="Sheet"
Include="Mod/Spreadsheet/App/Sheet.h"
Namespace="Spreadsheet"
FatherInclude="App/DocumentObjectPy.h"
FatherNamespace="App"
Constructor="true">
<Documentation>
<Author Licence="LGPL" Name="Eivind Kvedalen" EMail="eivind@kvedalen.name" />
<UserDocu>With this object you can manipulate spreadsheets</UserDocu>
</Documentation>
<Methode Name="set">
<Documentation>
<UserDocu>Set data into a cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="get">
<Documentation>
<UserDocu>Get evaluated cell contents</UserDocu>
</Documentation>
</Methode>
<Methode Name="getContents">
<Documentation>
<UserDocu>Get cell contents</UserDocu>
</Documentation>
</Methode>
<Methode Name="clear">
<Documentation>
<UserDocu>Clear a cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="clearAll">
<Documentation>
<UserDocu>Clear all cells in the spreadsheet</UserDocu>
</Documentation>
</Methode>
<Methode Name="importFile">
<Documentation>
<UserDocu>Import file into spreadsheet</UserDocu>
</Documentation>
</Methode>
<Methode Name="exportFile">
<Documentation>
<UserDocu>Export file from spreadsheet</UserDocu>
</Documentation>
</Methode>
<Methode Name="mergeCells">
<Documentation>
<UserDocu>Merge given cell area into one cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="splitCell">
<Documentation>
<UserDocu>Split a previously merged cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="insertColumns">
<Documentation>
<UserDocu>Insert a given number of columns into the spreadsheet.</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeColumns">
<Documentation>
<UserDocu>Remove a given number of columns from the spreadsheet.</UserDocu>
</Documentation>
</Methode>
<Methode Name="insertRows">
<Documentation>
<UserDocu>Insert a given number of rows into the spreadsheet.</UserDocu>
</Documentation>
</Methode>
<Methode Name="removeRows">
<Documentation>
<UserDocu>Remove a given number of rows from the spreadsheet.</UserDocu>
</Documentation>
</Methode>
<Methode Name="setAlignment">
<Documentation>
<UserDocu>Set alignment of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="getAlignment">
<Documentation>
<UserDocu>Get alignment of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="setStyle">
<Documentation>
<UserDocu>Set style of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="getStyle">
<Documentation>
<UserDocu>Get style of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="setDisplayUnit">
<Documentation>
<UserDocu>Set display unit for cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="setAlias">
<Documentation>
<UserDocu>Set alias for cell address</UserDocu>
</Documentation>
</Methode>
<Methode Name="getAlias">
<Documentation>
<UserDocu>Get alias for cell address</UserDocu>
</Documentation>
</Methode>
<Methode Name="getCellFromAlias">
<Documentation>
<UserDocu>Get cell address given an alias</UserDocu>
</Documentation>
</Methode>
<Methode Name="getDisplayUnit">
<Documentation>
<UserDocu>Get display unit for cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="setForeground">
<Documentation>
<UserDocu>Set foreground color of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="getForeground">
<Documentation>
<UserDocu>Get foreground color of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="setBackground">
<Documentation>
<UserDocu>Set background color of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="getBackground">
<Documentation>
<UserDocu>Get background color of the cell</UserDocu>
</Documentation>
</Methode>
<Methode Name="setColumnWidth">
<Documentation>
<UserDocu>Set given spreadsheet column to given width</UserDocu>
</Documentation>
</Methode>
<Methode Name="getColumnWidth">
<Documentation>
<UserDocu>Get given spreadsheet column width</UserDocu>
</Documentation>
</Methode>
<Methode Name="setRowHeight">
<Documentation>
<UserDocu>Set given spreadsheet row to given height</UserDocu>
</Documentation>
</Methode>
<Methode Name="getRowHeight">
<Documentation>
<UserDocu>Get given spreadsheet row height</UserDocu>
</Documentation>
</Methode>
<Methode Name="touchCells">
<Documentation>
<UserDocu>touchCells(from, to=None): touch cells in the given range</UserDocu>
</Documentation>
</Methode>
<Methode Name="recomputeCells">
<Documentation>
<UserDocu>
recomputeCells(from, to=None)
Manually recompute cells in the given range with the given order without
following dependency order.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getUsedCells">
<Documentation>
<UserDocu>
getUsedCells()
Get a list of the names of all cells that are marked as used. These cells may
or may not have a non-empty string content.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getNonEmptyCells">
<Documentation>
<UserDocu>
getNonEmptyCells()
Get a list of the names of all cells with data in them.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getUsedRange">
<Documentation>
<UserDocu>
getUsedRange()
Get a the total range of the used cells in a sheet, as a pair of strings
representing the lowest row and column that are used, and the highest row and
column that are used (inclusive). Note that the actual first and last cell
of the block are not necessarily used.
</UserDocu>
</Documentation>
</Methode>
<Methode Name="getNonEmptyRange">
<Documentation>
<UserDocu>
getNonEmptyRange()
Get a the total range of the used cells in a sheet, as a pair of cell addresses
representing the lowest row and column that contain data, and the highest row and
column that contain data (inclusive). Note that the actual first and last cell
of the block do not necessarily contain anything.
</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>

View File

@@ -3,12 +3,11 @@ include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
)
generate_from_xml(ViewProviderSpreadsheetPy)
generate_from_py_(ViewProviderSpreadsheetPy)
generate_from_py(ViewProviderSpreadsheet)
# The XML files
set(SpreadsheetGui_XML_SRCS
ViewProviderSpreadsheetPy.xml
ViewProviderSpreadsheet.pyi
)
set(SpreadsheetGui_LIBS

View File

@@ -5,16 +5,12 @@ from Base.Metadata import export
from Gui.ViewProviderDocumentObject import ViewProviderDocumentObject
@export(
Father="ViewProviderDocumentObjectPy",
Name="ViewProviderSpreadsheetPy",
Twin="ViewProviderSheet",
TwinPointer="ViewProviderSheet",
Include="Mod/Spreadsheet/Gui/ViewProviderSpreadsheet.h",
Namespace="SpreadsheetGui",
FatherInclude="Gui/ViewProviderDocumentObjectPy.h",
FatherNamespace="Gui",
)
class ViewProviderSpreadsheetPy(ViewProviderDocumentObject):
class ViewProviderSpreadsheet(ViewProviderDocumentObject):
"""
ViewProviderSheet class
"""

View File

@@ -1,46 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<GenerateModel xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="generateMetaModel_Module.xsd">
<PythonExport
Father="ViewProviderDocumentObjectPy"
Name="ViewProviderSpreadsheetPy"
Twin="ViewProviderSheet"
TwinPointer="ViewProviderSheet"
Include="Mod/Spreadsheet/Gui/ViewProviderSpreadsheet.h"
Namespace="SpreadsheetGui"
FatherInclude="Gui/ViewProviderDocumentObjectPy.h"
FatherNamespace="Gui"
Constructor="false"
Delete="false">
<Documentation>
<Author Licence="LGPL" Name="Jose Luis Cercos Pita" EMail="jlcercos@gmail.com" />
<UserDocu>ViewProviderSheet class</UserDocu>
</Documentation>
<Methode Name="getView">
<Documentation>
<UserDocu>Get access to the sheet view</UserDocu>
</Documentation>
</Methode>
<Methode Name="showSheetMdi">
<Documentation>
<UserDocu>
Create (if necessary) and switch to the Spreadsheet MDI.
showSheetMdi()
Returns: None
</UserDocu>
</Documentation>
</Methode>
<Methode Name="exportAsFile">
<Documentation>
<UserDocu>
Export the sheet as a file.
exportAsFile()
Returns: None
</UserDocu>
</Documentation>
</Methode>
</PythonExport>
</GenerateModel>