Expose CutterApplication to Python and add accessor

This commit is contained in:
Florian Märkl 2020-01-24 15:23:59 +01:00
parent 14f830dd81
commit 47e92a373f
No known key found for this signature in database
GPG Key ID: 125BC8A5A6A1E857
3 changed files with 12 additions and 0 deletions

View File

@ -7,6 +7,7 @@
#include "../core/Cutter.h"
#include "../common/Configuration.h"
#include "../core/MainWindow.h"
#include "../CutterApplication.h"
#include "../widgets/CutterDockWidget.h"
#include "../plugins/CutterPlugin.h"

View File

@ -13,6 +13,9 @@
<object-type name="MainWindow" >
<enum-type name="MenuType" />
</object-type>
<object-type name="CutterApplication">
<modify-function signature="CutterApplication(int &amp;, char **)" remove="all"/>
</object-type>
<object-type name="BasicBlockHighlighter" />
<object-type name="CutterDockWidget" />

View File

@ -6,6 +6,14 @@ try:
def core():
return CutterCore.instance()
def app():
# see https://forums.autodesk.com/t5/3ds-max-programming/qapplication-instance-returns-qcoreapplication-instance/td-p/9035295
import shiboken2
from PySide2 import QtCore
coreapp = QtCore.QCoreApplication.instance()
ptr = shiboken2.getCppPointer(coreapp)[0]
return shiboken2.wrapInstance(ptr, CutterApplication)
except ImportError:
pass