Expose the selected cells to Python

This commit is contained in:
Jose Luis Cercos-Pita
2021-11-12 14:39:30 +01:00
committed by Chris Hennes
parent 96512c1e01
commit 16bbe12336
6 changed files with 124 additions and 0 deletions

View File

@@ -36,6 +36,7 @@
#include "ViewProviderSpreadsheet.h"
#include "SpreadsheetView.h"
#include "ViewProviderSpreadsheetPy.h"
#include <Mod/Spreadsheet/App/Sheet.h>
#include <App/Range.h>
@@ -181,3 +182,23 @@ void ViewProviderSheet::updateData(const App::Property* prop)
if (view)
view->updateCell(prop);
}
PyObject *ViewProviderSheet::getPyObject()
{
if (PythonObject.is(Py::_None())){
// ref counter is set to 1
PythonObject = Py::Object(new ViewProviderSpreadsheetPy(this), true);
}
return Py::new_reference_to(PythonObject);
}
// Python feature -----------------------------------------------------------------------
namespace Gui {
/// @cond DOXERR
PROPERTY_SOURCE_TEMPLATE(SpreadsheetGui::ViewProviderSheetPython, SpreadsheetGui::ViewProviderSheet)
/// @endcond
// explicit template instantiation
template class SpreadsheetGuiExport ViewProviderPythonFeatureT<ViewProviderSheet>;
}