Squashed commit of the following:

commit 89eb699e69c05dda0ebecf4aa22acc85386ede8f
Author: looooo <sppedflyer@gmail.com>
Date:   Wed Apr 27 21:43:16 2016 +0200

    added close function

commit 2acc25adbc9df47194934ef4db18383919248c7d
Author: looooo <sppedflyer@gmail.com>
Date:   Wed Apr 27 21:12:18 2016 +0200

    some additions to the split-view-bindings

commit ec366d154a96a71c7716900f4de1c109a9160df8
Author: looooo <sppedflyer@gmail.com>
Date:   Sun Apr 24 20:55:26 2016 +0200

    SplitView: Antia-Aliasing, getViewer, handlinging of deletion
    added anti-aliasing for the SplitView3DInventor class
    added method getViewer to the AbstractSplitView
    delete python-object when c++ object gets deleted

commit 7225cd836b0001d302c9e14328b5eb7dd489cdb1
Author: looooo <sppedflyer@gmail.com>
Date:   Sun Apr 24 15:28:57 2016 +0200

    added function Gui.createViewer([int])->Viewer/SplitViewer
This commit is contained in:
wmayer
2016-05-01 15:46:53 +02:00
parent e50950f070
commit e331bdbc5d
6 changed files with 217 additions and 21 deletions

View File

@@ -48,6 +48,7 @@
#include "PythonEditor.h"
#include "SoFCDB.h"
#include "View3DInventor.h"
#include "SplitView3DInventor.h"
#include "ViewProvider.h"
#include "WidgetFactory.h"
#include "Workbench.h"
@@ -169,6 +170,9 @@ PyMethodDef Application::Methods[] = {
{"showPreferences", (PyCFunction) Application::sShowPreferences,1,
"showPreferences([string,int]) -> None\n\n"
"Shows the preferences window. If string and int are provided, the given page index in the given group is shown."},
{"createViewer", (PyCFunction) Application::sCreateViewer,1,
"createViewer([int]) -> View3DInventor/SplitView3DInventor\n\n"
"shows and returns a viewer. If the integer argument is given and > 1: -> splitViewer"},
{NULL, NULL} /* Sentinel */
};
@@ -1109,3 +1113,29 @@ PyObject* Application::sShowPreferences(PyObject * /*self*/, PyObject *args,PyOb
Py_INCREF(Py_None);
return Py_None;
}
PyObject* Application::sCreateViewer(PyObject * /*self*/, PyObject *args,PyObject * /*kwd*/)
{
int num_of_views = 1;
// if one argument (int) is given
if (PyArg_ParseTuple(args, "|i", &num_of_views))
{
if (num_of_views < 0)
return NULL;
else if (num_of_views==1)
{
View3DInventor* viewer = new View3DInventor(0, 0);
Gui::getMainWindow()->addWindow(viewer);
return viewer->getPyObject();
}
else
{
SplitView3DInventor* viewer = new SplitView3DInventor(num_of_views, 0, 0);
Gui::getMainWindow()->addWindow(viewer);
return viewer->getPyObject();
}
}
return Py_None;
}