Gui: Change signature in some Python Selection module functions
This commit is contained in:
@@ -2038,27 +2038,25 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args)
|
||||
PyObject *clearPreselect = Py_True;
|
||||
char *objname;
|
||||
char *docname;
|
||||
char* subname=0;
|
||||
float x=0,y=0,z=0;
|
||||
char* subname = nullptr;
|
||||
float x = 0, y = 0, z = 0;
|
||||
if (PyArg_ParseTuple(args, "ss|sfffO!", &docname, &objname ,
|
||||
&subname,&x,&y,&z,&PyBool_Type,&clearPreselect))
|
||||
{
|
||||
&subname,&x,&y,&z,&PyBool_Type,&clearPreselect)) {
|
||||
Selection().addSelection(docname,objname,subname,x,y,z,0,PyObject_IsTrue(clearPreselect));
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
|
||||
PyErr_Clear();
|
||||
PyObject *object;
|
||||
subname = 0;
|
||||
x=0,y=0,z=0;
|
||||
subname = nullptr;
|
||||
x = 0, y = 0, z = 0;
|
||||
if (PyArg_ParseTuple(args, "O!|sfffO!", &(App::DocumentObjectPy::Type),&object,
|
||||
&subname,&x,&y,&z,&PyBool_Type,&clearPreselect))
|
||||
{
|
||||
&subname,&x,&y,&z,&PyBool_Type,&clearPreselect)) {
|
||||
App::DocumentObjectPy* docObjPy = static_cast<App::DocumentObjectPy*>(object);
|
||||
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
|
||||
if (!docObj || !docObj->getNameInDocument()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Selection().addSelection(docObj->getDocument()->getName(),
|
||||
@@ -2076,7 +2074,7 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args)
|
||||
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
|
||||
if (!docObj || !docObj->getNameInDocument()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -2098,25 +2096,29 @@ PyObject *SelectionSingleton::sAddSelection(PyObject * /*self*/, PyObject *args)
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_ValueError, "type must be 'DocumentObject[,subname[,x,y,z]]' or 'DocumentObject, list or tuple of subnames'");
|
||||
return 0;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sUpdateSelection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *show;
|
||||
PyObject *object;
|
||||
char* subname=0;
|
||||
if(!PyArg_ParseTuple(args, "OO!|s", &show,&(App::DocumentObjectPy::Type),&object,&subname))
|
||||
return 0;
|
||||
char* subname=nullptr;
|
||||
if(!PyArg_ParseTuple(args, "O!O!|s", &PyBool_Type, &show, &(App::DocumentObjectPy::Type),
|
||||
&object, &subname))
|
||||
return nullptr;
|
||||
|
||||
App::DocumentObjectPy* docObjPy = static_cast<App::DocumentObjectPy*>(object);
|
||||
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
|
||||
if (!docObj || !docObj->getNameInDocument()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Selection().updateSelection(PyObject_IsTrue(show),
|
||||
docObj->getDocument()->getName(), docObj->getNameInDocument(), subname);
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
@@ -2124,24 +2126,24 @@ PyObject *SelectionSingleton::sUpdateSelection(PyObject * /*self*/, PyObject *ar
|
||||
PyObject *SelectionSingleton::sRemoveSelection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
SelectionLogDisabler disabler(true);
|
||||
char *docname,*objname;
|
||||
char* subname=0;
|
||||
char *docname, *objname;
|
||||
char* subname = nullptr;
|
||||
if(PyArg_ParseTuple(args, "ss|s", &docname,&objname,&subname)) {
|
||||
Selection().rmvSelection(docname,objname,subname);
|
||||
Py_Return;
|
||||
}
|
||||
PyErr_Clear();
|
||||
|
||||
PyErr_Clear();
|
||||
PyObject *object;
|
||||
subname = 0;
|
||||
subname = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "O!|s", &(App::DocumentObjectPy::Type),&object,&subname))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
App::DocumentObjectPy* docObjPy = static_cast<App::DocumentObjectPy*>(object);
|
||||
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
|
||||
if (!docObj || !docObj->getNameInDocument()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Selection().rmvSelection(docObj->getDocument()->getName(),
|
||||
@@ -2155,48 +2157,52 @@ PyObject *SelectionSingleton::sClearSelection(PyObject * /*self*/, PyObject *arg
|
||||
{
|
||||
SelectionLogDisabler disabler(true);
|
||||
PyObject *clearPreSelect = Py_True;
|
||||
char *documentName=0;
|
||||
char *documentName = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &clearPreSelect)) {
|
||||
PyErr_Clear();
|
||||
if (!PyArg_ParseTuple(args, "|sO!", &documentName, &PyBool_Type, &clearPreSelect))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
Selection().clearSelection(documentName,PyObject_IsTrue(clearPreSelect));
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sIsSelected(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *object;
|
||||
char* subname=0;
|
||||
char* subname = nullptr;
|
||||
PyObject *resolve = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "O!|sO", &(App::DocumentObjectPy::Type), &object, &subname,&resolve))
|
||||
return NULL;
|
||||
if (!PyArg_ParseTuple(args, "O!|sO!", &(App::DocumentObjectPy::Type), &object,
|
||||
&subname, &PyBool_Type, &resolve))
|
||||
return nullptr;
|
||||
|
||||
App::DocumentObjectPy* docObj = static_cast<App::DocumentObjectPy*>(object);
|
||||
bool ok = Selection().isSelected(docObj->getDocumentObjectPtr(), subname,PyObject_IsTrue(resolve));
|
||||
|
||||
return Py_BuildValue("O", (ok ? Py_True : Py_False));
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sCountObjectsOfType(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char* objecttype;
|
||||
char* document=0;
|
||||
char* document = nullptr;
|
||||
int resolve = 1;
|
||||
if (!PyArg_ParseTuple(args, "s|si", &objecttype, &document,&resolve))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
unsigned int count = Selection().countObjectsOfType(objecttype, document, resolve);
|
||||
|
||||
return PyLong_FromLong(count);
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetSelection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char *documentName=0;
|
||||
char *documentName = nullptr;
|
||||
int resolve = 1;
|
||||
PyObject *single=Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|siO", &documentName,&resolve,&single)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
PyObject *single = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|siO!", &documentName, &resolve, &PyBool_Type, &single))
|
||||
return nullptr;
|
||||
|
||||
std::vector<SelectionSingleton::SelObj> sel;
|
||||
sel = Selection().getSelection(documentName,resolve,PyObject_IsTrue(single));
|
||||
@@ -2216,26 +2222,27 @@ PyObject *SelectionSingleton::sGetSelection(PyObject * /*self*/, PyObject *args)
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sEnablePickedList(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *enable = Py_True;
|
||||
if (!PyArg_ParseTuple(args, "|O", &enable)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, "|O!", &PyBool_Type, &enable))
|
||||
return nullptr;
|
||||
|
||||
Selection().enablePickedList(PyObject_IsTrue(enable));
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sSetPreselection(PyObject * /*self*/, PyObject *args, PyObject *kwd)
|
||||
{
|
||||
PyObject *object;
|
||||
char* subname=0;
|
||||
float x=0,y=0,z=0;
|
||||
int type=1;
|
||||
char* subname = nullptr;
|
||||
float x = 0, y = 0, z = 0;
|
||||
int type = 1;
|
||||
static char *kwlist[] = {"obj","subname","x","y","z","tp",0};
|
||||
if (PyArg_ParseTupleAndKeywords(args, kwd, "O!|sfffi", kwlist,
|
||||
&(App::DocumentObjectPy::Type),&object,&subname,&x,&y,&z,&type)) {
|
||||
@@ -2243,7 +2250,7 @@ PyObject *SelectionSingleton::sSetPreselection(PyObject * /*self*/, PyObject *ar
|
||||
App::DocumentObject* docObj = docObjPy->getDocumentObjectPtr();
|
||||
if (!docObj || !docObj->getNameInDocument()) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, "Cannot check invalid object");
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Selection().setPreselect(docObj->getDocument()->getName(),
|
||||
@@ -2253,33 +2260,36 @@ PyObject *SelectionSingleton::sSetPreselection(PyObject * /*self*/, PyObject *ar
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_ValueError, "type must be 'DocumentObject[,subname[,x,y,z]]'");
|
||||
return 0;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetPreselection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
const SelectionChanges& sel = Selection().getPreselection();
|
||||
SelectionObject obj(sel);
|
||||
|
||||
return obj.getPyObject();
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sRemPreselection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
Selection().rmvPreselect();
|
||||
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetCompleteSelection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
int resolve = 1;
|
||||
if (!PyArg_ParseTuple(args, "|i",&resolve)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, "|i",&resolve))
|
||||
return nullptr;
|
||||
|
||||
std::vector<SelectionSingleton::SelObj> sel;
|
||||
sel = Selection().getCompleteSelection(resolve);
|
||||
@@ -2292,17 +2302,17 @@ PyObject *SelectionSingleton::sGetCompleteSelection(PyObject * /*self*/, PyObjec
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetSelectionEx(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char *documentName=0;
|
||||
int resolve=1;
|
||||
char *documentName = nullptr;
|
||||
int resolve = 1;
|
||||
PyObject *single = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|siO", &documentName,&resolve,&single)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, "|siO!", &documentName, &resolve, &PyBool_Type, &single))
|
||||
return nullptr;
|
||||
|
||||
std::vector<SelectionObject> sel;
|
||||
sel = Selection().getSelectionEx(documentName,
|
||||
@@ -2316,15 +2326,15 @@ PyObject *SelectionSingleton::sGetSelectionEx(PyObject * /*self*/, PyObject *arg
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetPickedList(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char *documentName=0;
|
||||
if (!PyArg_ParseTuple(args, "|s", &documentName)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
char *documentName = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "|s", &documentName))
|
||||
return nullptr;
|
||||
|
||||
std::vector<SelectionObject> sel;
|
||||
sel = Selection().getPickedListEx(documentName);
|
||||
@@ -2337,17 +2347,16 @@ PyObject *SelectionSingleton::sGetPickedList(PyObject * /*self*/, PyObject *args
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetSelectionObject(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char *docName, *objName, *subName;
|
||||
PyObject* tuple=0;
|
||||
if (!PyArg_ParseTuple(args, "sss|O!", &docName, &objName, &subName,
|
||||
&PyTuple_Type, &tuple))
|
||||
return NULL;
|
||||
PyObject* tuple = nullptr;
|
||||
if (!PyArg_ParseTuple(args, "sss|O!", &docName, &objName, &subName, &PyTuple_Type, &tuple))
|
||||
return nullptr;
|
||||
|
||||
try {
|
||||
SelectionObject selObj;
|
||||
@@ -2368,11 +2377,11 @@ PyObject *SelectionSingleton::sGetSelectionObject(PyObject * /*self*/, PyObject
|
||||
return selObj.getPyObject();
|
||||
}
|
||||
catch (const Py::Exception&) {
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
PyErr_SetString(Base::BaseExceptionFreeCADError, e.what());
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2380,34 +2389,39 @@ PyObject *SelectionSingleton::sAddSelObserver(PyObject * /*self*/, PyObject *arg
|
||||
{
|
||||
PyObject* o;
|
||||
int resolve = 1;
|
||||
if (!PyArg_ParseTuple(args, "O|i",&o,&resolve))
|
||||
return NULL;
|
||||
if (!PyArg_ParseTuple(args, "O|i", &o, &resolve))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
SelectionObserverPython::addObserver(Py::Object(o),resolve);
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sRemSelObserver(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject* o;
|
||||
if (!PyArg_ParseTuple(args, "O",&o))
|
||||
return NULL;
|
||||
if (!PyArg_ParseTuple(args, "O", &o))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
SelectionObserverPython::removeObserver(Py::Object(o));
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sAddSelectionGate(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char* filter;
|
||||
int resolve = 1;
|
||||
if (PyArg_ParseTuple(args, "s|i",&filter,&resolve)) {
|
||||
if (PyArg_ParseTuple(args, "s|i", &filter, &resolve)) {
|
||||
PY_TRY {
|
||||
Selection().addSelectionGate(new SelectionFilterGate(filter),resolve);
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
@@ -2417,7 +2431,8 @@ PyObject *SelectionSingleton::sAddSelectionGate(PyObject * /*self*/, PyObject *a
|
||||
Selection().addSelectionGate(new SelectionFilterGatePython(
|
||||
static_cast<SelectionFilterPy*>(filterPy)),resolve);
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyErr_Clear();
|
||||
@@ -2426,68 +2441,70 @@ PyObject *SelectionSingleton::sAddSelectionGate(PyObject * /*self*/, PyObject *a
|
||||
PY_TRY {
|
||||
Selection().addSelectionGate(new SelectionGatePython(Py::Object(gate, false)),resolve);
|
||||
Py_Return;
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyErr_SetString(PyExc_ValueError, "Argument is neither string nor SelectionFiler nor SelectionGate");
|
||||
return 0;
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sRemoveSelectionGate(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return NULL;
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
Selection().rmvSelectionGate();
|
||||
} PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sSetVisible(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *visible = Py_None;
|
||||
if (!PyArg_ParseTuple(args, "|O",&visible))
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, "|O", &visible))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
int vis;
|
||||
VisibleState vis;
|
||||
if(visible == Py_None) {
|
||||
vis = -1;
|
||||
vis = VisToggle;
|
||||
}
|
||||
else if(PyLong_Check(visible)) {
|
||||
vis = PyLong_AsLong(visible);
|
||||
else if (PyBool_Check(visible)) {
|
||||
vis = PyObject_IsTrue(visible) ? VisShow : VisHide;
|
||||
}
|
||||
else {
|
||||
vis = PyObject_IsTrue(visible)?1:0;
|
||||
PyErr_SetString(PyExc_ValueError, "Argument is neither None nor Bool");
|
||||
return nullptr;
|
||||
}
|
||||
if(vis<0)
|
||||
Selection().setVisible(VisToggle);
|
||||
else
|
||||
Selection().setVisible(vis==0?VisHide:VisShow);
|
||||
} PY_CATCH;
|
||||
|
||||
Py_Return;
|
||||
Selection().setVisible(vis);
|
||||
Py_Return;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sPushSelStack(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
PyObject *clear = Py_True;
|
||||
PyObject *overwrite = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|OO",&clear,&overwrite))
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, "|O!O!", &PyBool_Type, &clear, &PyBool_Type, &overwrite))
|
||||
return nullptr;
|
||||
|
||||
Selection().selStackPush(PyObject_IsTrue(clear), PyObject_IsTrue(overwrite));
|
||||
|
||||
Selection().selStackPush(PyObject_IsTrue(clear),PyObject_IsTrue(overwrite));
|
||||
Py_Return;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sHasSelection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
const char *doc = 0;
|
||||
const char *doc = nullptr;
|
||||
PyObject *resolve = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|sO",&doc,&resolve))
|
||||
return NULL; // NULL triggers exception
|
||||
if (!PyArg_ParseTuple(args, "|sO!", &doc, &PyBool_Type, &resolve))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
bool ret;
|
||||
@@ -2495,35 +2512,39 @@ PyObject *SelectionSingleton::sHasSelection(PyObject * /*self*/, PyObject *args)
|
||||
ret = Selection().hasSelection(doc,PyObject_IsTrue(resolve));
|
||||
else
|
||||
ret = Selection().hasSelection();
|
||||
|
||||
return Py::new_reference_to(Py::Boolean(ret));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sHasSubSelection(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
const char *doc = 0;
|
||||
const char *doc = nullptr;
|
||||
PyObject *subElement = Py_False;
|
||||
if (!PyArg_ParseTuple(args, "|sO!",&doc,&PyBool_Type,&subElement))
|
||||
return NULL; // NULL triggers exception
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
return Py::new_reference_to(
|
||||
Py::Boolean(Selection().hasSubSelection(doc,PyObject_IsTrue(subElement))));
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
PyObject *SelectionSingleton::sGetSelectionFromStack(PyObject * /*self*/, PyObject *args)
|
||||
{
|
||||
char *documentName=0;
|
||||
int resolve=1;
|
||||
int index=0;
|
||||
if (!PyArg_ParseTuple(args, "|sii", &documentName,&resolve,&index)) // convert args: Python->C
|
||||
return NULL; // NULL triggers exception
|
||||
char *documentName = nullptr;
|
||||
int resolve = 1;
|
||||
int index = 0;
|
||||
if (!PyArg_ParseTuple(args, "|sii", &documentName, &resolve, &index))
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
Py::List list;
|
||||
for(auto &sel : Selection().selStackGet(documentName, resolve, index))
|
||||
list.append(Py::asObject(sel.getPyObject()));
|
||||
return Py::new_reference_to(list);
|
||||
} PY_CATCH;
|
||||
}
|
||||
PY_CATCH;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user