mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Compare commits
12
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9cbf374166 | ||
|
|
f71bfff0e6 | ||
|
|
8aa2ab4eac | ||
|
|
46a0ce9e38 | ||
|
|
15e635741c | ||
|
|
f56c605479 | ||
|
|
617c76e9f8 | ||
|
|
96081888f1 | ||
|
|
af5958b0af | ||
|
|
b33293e49a | ||
|
|
dc3b60e578 | ||
|
|
fee774db45 |
@@ -178,7 +178,7 @@ QString ProxyPython::description() const
|
|||||||
|
|
||||||
VersionInfo ProxyPython::version() const
|
VersionInfo ProxyPython::version() const
|
||||||
{
|
{
|
||||||
return VersionInfo(1, 2, 0, VersionInfo::RELEASE_FINAL);
|
return VersionInfo(1, 3, 1, VersionInfo::RELEASE_FINAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ProxyPython::isActive() const
|
bool ProxyPython::isActive() const
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
#define HAVE_ROUND
|
||||||
#include "proxypluginwrappers.h"
|
#include "proxypluginwrappers.h"
|
||||||
#include <boost/python.hpp>
|
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "gilock.h"
|
#include "gilock.h"
|
||||||
|
|||||||
@@ -31,17 +31,26 @@ HEADERS += pythonrunner.h \
|
|||||||
|
|
||||||
|
|
||||||
CONFIG(debug, debug|release) {
|
CONFIG(debug, debug|release) {
|
||||||
|
SRCDIR = $$OUT_PWD/debug
|
||||||
|
DSTDIR = $$PWD/../../outputd
|
||||||
LIBS += -L$$OUT_PWD/../uibase/debug
|
LIBS += -L$$OUT_PWD/../uibase/debug
|
||||||
} else {
|
} else {
|
||||||
|
SRCDIR = $$OUT_PWD/release
|
||||||
|
DSTDIR = $$PWD/../../output
|
||||||
LIBS += -L$$OUT_PWD/../uibase/release
|
LIBS += -L$$OUT_PWD/../uibase/release
|
||||||
QMAKE_CXXFLAGS += /Zi
|
QMAKE_CXXFLAGS += /Zi
|
||||||
QMAKE_LFLAGS += /DEBUG
|
QMAKE_LFLAGS += /DEBUG
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SRCDIR ~= s,/,$$QMAKE_DIR_SEP,g
|
||||||
|
DSTDIR ~= s,/,$$QMAKE_DIR_SEP,g
|
||||||
|
|
||||||
INCLUDEPATH += "$(BOOSTPATH)" "$$(PYTHONPATH)/include" "$$(PYTHONPATH)/Lib/site-packages/PyQt4/include"
|
INCLUDEPATH += "$(BOOSTPATH)" "$$(PYTHONPATH)/include" "$$(PYTHONPATH)/Lib/site-packages/PyQt4/include"
|
||||||
LIBS += -L"$$(PYTHONPATH)/libs" -L"$(BOOSTPATH)/stage/lib"
|
LIBS += -L"$$(PYTHONPATH)/libs" -L"$(BOOSTPATH)/stage/lib"
|
||||||
LIBS += -lpython27
|
LIBS += -lpython27
|
||||||
|
|
||||||
INCLUDEPATH += ../uibase
|
INCLUDEPATH += ../uibase
|
||||||
LIBS += -luibase
|
LIBS += -luibase
|
||||||
|
|
||||||
|
QMAKE_POST_LINK += xcopy /y /I $$quote($$SRCDIR\\$${TARGET}*.pdb) $$quote($$DSTDIR)\\plugins $$escape_expand(\\n)
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ QList<MOBase::PluginSetting> PythonPluginWrapper::settings() const
|
|||||||
try {
|
try {
|
||||||
boost::python::object l = m_SettingsFunction();
|
boost::python::object l = m_SettingsFunction();
|
||||||
if (!l.is_none()) {
|
if (!l.is_none()) {
|
||||||
// boost::python::list l = extract<boost::python::list>(temp);
|
|
||||||
for (int i = 0; i < boost::python::len(l); ++i) {
|
for (int i = 0; i < boost::python::len(l); ++i) {
|
||||||
result.append(extract<MOBase::PluginSetting>(l[i]));
|
result.append(extract<MOBase::PluginSetting>(l[i]));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ public:
|
|||||||
virtual QList<MOBase::PluginSetting> settings() const;
|
virtual QList<MOBase::PluginSetting> settings() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
void reportPythonError() const;
|
void reportPythonError() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
+239
-38
@@ -1,3 +1,5 @@
|
|||||||
|
#define HAVE_ROUND
|
||||||
|
|
||||||
#include "pythonrunner.h"
|
#include "pythonrunner.h"
|
||||||
|
|
||||||
#pragma warning( disable : 4100 )
|
#pragma warning( disable : 4100 )
|
||||||
@@ -46,8 +48,9 @@ private:
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
IPythonRunner *CreatePythonRunner(const MOBase::IOrganizer *moInfo, const QString &pythonDir)
|
IPythonRunner *CreatePythonRunner(MOBase::IOrganizer *moInfo, const QString &pythonDir)
|
||||||
{
|
{
|
||||||
|
s_Organizer = moInfo;
|
||||||
PythonRunner *result = new PythonRunner(moInfo);
|
PythonRunner *result = new PythonRunner(moInfo);
|
||||||
if (result->initPython(pythonDir)) {
|
if (result->initPython(pythonDir)) {
|
||||||
return result;
|
return result;
|
||||||
@@ -85,6 +88,15 @@ struct QString_to_python_str
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
struct QFlags_to_int
|
||||||
|
{
|
||||||
|
static PyObject *convert(const QFlags<T> &flags) {
|
||||||
|
return bpy::incref(bpy::object(static_cast<int>(flags)).ptr());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
struct QString_from_python_str
|
struct QString_from_python_str
|
||||||
{
|
{
|
||||||
QString_from_python_str() {
|
QString_from_python_str() {
|
||||||
@@ -110,7 +122,6 @@ struct QString_from_python_str
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct GuessedValue_converters
|
struct GuessedValue_converters
|
||||||
{
|
{
|
||||||
@@ -140,7 +151,6 @@ struct GuessedValue_converters
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void construct(PyObject *objPtr, bpy::converter::rvalue_from_python_stage1_data* data) {
|
static void construct(PyObject *objPtr, bpy::converter::rvalue_from_python_stage1_data* data) {
|
||||||
void *storage = ((bpy::converter::rvalue_from_python_storage<GuessedValue<T> >*)data)->storage.bytes;
|
void *storage = ((bpy::converter::rvalue_from_python_storage<GuessedValue<T> >*)data)->storage.bytes;
|
||||||
GuessedValue<T> *result = new (storage) GuessedValue<T>();
|
GuessedValue<T> *result = new (storage) GuessedValue<T>();
|
||||||
@@ -169,6 +179,7 @@ struct QVariant_to_python_obj
|
|||||||
static PyObject *convert(const QVariant &var) {
|
static PyObject *convert(const QVariant &var) {
|
||||||
switch (var.type()) {
|
switch (var.type()) {
|
||||||
case QVariant::Int: return PyLong_FromLong(var.toInt());
|
case QVariant::Int: return PyLong_FromLong(var.toInt());
|
||||||
|
case QVariant::UInt: return PyLong_FromUnsignedLong(var.toUInt());
|
||||||
case QVariant::Bool: return PyBool_FromLong(var.toBool());
|
case QVariant::Bool: return PyBool_FromLong(var.toBool());
|
||||||
case QVariant::String: return bpy::incref(bpy::object(var.toString().toUtf8().constData()).ptr());
|
case QVariant::String: return bpy::incref(bpy::object(var.toString().toUtf8().constData()).ptr());
|
||||||
case QVariant::List: {
|
case QVariant::List: {
|
||||||
@@ -179,8 +190,18 @@ struct QVariant_to_python_obj
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
} break;
|
} break;
|
||||||
|
case QVariant::Map: {
|
||||||
|
QVariantMap map = var.toMap();
|
||||||
|
PyObject *result = PyDict_New();
|
||||||
|
QMapIterator<QString, QVariant> iter(map);
|
||||||
|
while (iter.hasNext()) {
|
||||||
|
iter.next();
|
||||||
|
PyDict_SetItem(result, convert(iter.key()), convert(iter.value()));
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
} break;
|
||||||
default: {
|
default: {
|
||||||
PyErr_SetString(PyExc_TypeError, "type unsupported");
|
PyErr_Format(PyExc_TypeError, "type unsupported: %d", var.type());
|
||||||
throw bpy::error_already_set();
|
throw bpy::error_already_set();
|
||||||
} break;
|
} break;
|
||||||
}
|
}
|
||||||
@@ -257,6 +278,7 @@ struct QVariant_from_python_obj
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct QList_to_python_list
|
struct QList_to_python_list
|
||||||
{
|
{
|
||||||
@@ -347,9 +369,21 @@ static const sipAPIDef *sipAPI()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
struct IModRepositoryBridge_to_python
|
||||||
|
{
|
||||||
|
static PyObject *convert(IModRepositoryBridge *bridge)
|
||||||
|
{
|
||||||
|
ModRepositoryBridgeWrapper wrapper(bridge);
|
||||||
|
|
||||||
|
return bpy::incref(bpy::object(wrapper).ptr());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
template <typename T> struct MetaData;
|
template <typename T> struct MetaData;
|
||||||
|
|
||||||
template <> struct MetaData<IModRepositoryBridge> { static const char *className() { return "MOBase::INexusBridge"; } };
|
template <> struct MetaData<IModRepositoryBridge> { static const char *className() { return "QObject"; } };
|
||||||
template <> struct MetaData<IDownloadManager> { static const char *className() { return "QObject"; } };
|
template <> struct MetaData<IDownloadManager> { static const char *className() { return "QObject"; } };
|
||||||
template <> struct MetaData<QObject> { static const char *className() { return "QObject"; } };
|
template <> struct MetaData<QObject> { static const char *className() { return "QObject"; } };
|
||||||
template <> struct MetaData<QWidget> { static const char *className() { return "QWidget"; } };
|
template <> struct MetaData<QWidget> { static const char *className() { return "QWidget"; } };
|
||||||
@@ -364,7 +398,6 @@ PyObject *toPyQt(T *objPtr)
|
|||||||
qDebug("no input object");
|
qDebug("no input object");
|
||||||
return bpy::incref(Py_None);
|
return bpy::incref(Py_None);
|
||||||
}
|
}
|
||||||
|
|
||||||
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
|
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
|
||||||
|
|
||||||
if (type == NULL) {
|
if (type == NULL) {
|
||||||
@@ -380,6 +413,7 @@ PyObject *toPyQt(T *objPtr)
|
|||||||
return bpy::incref(sipObj);
|
return bpy::incref(sipObj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct QClass_converters
|
struct QClass_converters
|
||||||
{
|
{
|
||||||
@@ -507,6 +541,101 @@ struct QInterface_converters
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
int getArgCount(PyObject *object) {
|
||||||
|
int result = 0;
|
||||||
|
PyObject *funcCode = PyObject_GetAttrString(object, "func_code");
|
||||||
|
if (funcCode) {
|
||||||
|
PyObject *argCount = PyObject_GetAttrString(funcCode, "co_argcount");
|
||||||
|
if(argCount) {
|
||||||
|
result = PyInt_AsLong(argCount);
|
||||||
|
Py_DECREF(argCount);
|
||||||
|
}
|
||||||
|
Py_DECREF(funcCode);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct Functor0_converter
|
||||||
|
{
|
||||||
|
|
||||||
|
struct FunctorWrapper
|
||||||
|
{
|
||||||
|
FunctorWrapper(boost::python::object callable) : m_Callable(callable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()() {
|
||||||
|
GILock lock;
|
||||||
|
m_Callable();
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::python::object m_Callable;
|
||||||
|
};
|
||||||
|
|
||||||
|
Functor0_converter()
|
||||||
|
{
|
||||||
|
bpy::converter::registry::push_back(&convertible, &construct, bpy::type_id<std::function<void()>>());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *convertible(PyObject *object)
|
||||||
|
{
|
||||||
|
if (!PyCallable_Check(object)
|
||||||
|
|| (getArgCount(object) != 0)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void construct(PyObject *object, bpy::converter::rvalue_from_python_stage1_data *data)
|
||||||
|
{
|
||||||
|
bpy::object callable(bpy::handle<>(bpy::borrowed(object)));
|
||||||
|
void *storage = ((bpy::converter::rvalue_from_python_storage<std::function<void()>>*)data)->storage.bytes;
|
||||||
|
new (storage) std::function<void()>(FunctorWrapper(callable));
|
||||||
|
data->convertible = storage;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
template <typename PAR1, typename PAR2>
|
||||||
|
struct Functor2_converter
|
||||||
|
{
|
||||||
|
|
||||||
|
struct FunctorWrapper
|
||||||
|
{
|
||||||
|
FunctorWrapper(boost::python::object callable) : m_Callable(callable) {
|
||||||
|
}
|
||||||
|
|
||||||
|
void operator()(const PAR1 ¶m1, const PAR2 ¶m2) {
|
||||||
|
GILock lock;
|
||||||
|
m_Callable(param1, param2);
|
||||||
|
}
|
||||||
|
|
||||||
|
boost::python::object m_Callable;
|
||||||
|
};
|
||||||
|
|
||||||
|
Functor2_converter()
|
||||||
|
{
|
||||||
|
bpy::converter::registry::push_back(&convertible, &construct, bpy::type_id<std::function<void(PAR1, PAR2)>>());
|
||||||
|
}
|
||||||
|
|
||||||
|
static void *convertible(PyObject *object)
|
||||||
|
{
|
||||||
|
if (!PyCallable_Check(object)
|
||||||
|
|| (getArgCount(object) != 2)) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
return object;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void construct(PyObject *object, bpy::converter::rvalue_from_python_stage1_data *data)
|
||||||
|
{
|
||||||
|
bpy::object callable(bpy::handle<>(bpy::borrowed(object)));
|
||||||
|
void *storage = ((bpy::converter::rvalue_from_python_storage<std::function<void(PAR1, PAR2)>>*)data)->storage.bytes;
|
||||||
|
new (storage) std::function<void(PAR1, PAR2)>(FunctorWrapper(callable));
|
||||||
|
data->convertible = storage;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(updateWithQuality, MOBase::GuessedValue<QString>::update, 2, 2)
|
BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(updateWithQuality, MOBase::GuessedValue<QString>::update, 2, 2)
|
||||||
|
|
||||||
|
|
||||||
@@ -519,13 +648,12 @@ BOOST_PYTHON_MODULE(mobase)
|
|||||||
bpy::to_python_converter<QString, QString_to_python_str>();
|
bpy::to_python_converter<QString, QString_to_python_str>();
|
||||||
QString_from_python_str();
|
QString_from_python_str();
|
||||||
|
|
||||||
QClass_converters<QObject>();
|
//QClass_converters<QObject>();
|
||||||
QClass_converters<QWidget>();
|
QClass_converters<QWidget>();
|
||||||
//QClass_converters<QVariant>();
|
|
||||||
QClass_converters<QIcon>();
|
QClass_converters<QIcon>();
|
||||||
QInterface_converters<IModRepositoryBridge>();
|
|
||||||
QInterface_converters<IDownloadManager>();
|
QInterface_converters<IDownloadManager>();
|
||||||
|
|
||||||
|
|
||||||
bpy::def("toPyQt", &toPyQt<IModRepositoryBridge>);
|
bpy::def("toPyQt", &toPyQt<IModRepositoryBridge>);
|
||||||
bpy::def("toPyQt", &toPyQt<IDownloadManager>);
|
bpy::def("toPyQt", &toPyQt<IDownloadManager>);
|
||||||
|
|
||||||
@@ -534,70 +662,119 @@ BOOST_PYTHON_MODULE(mobase)
|
|||||||
.value("candidate", MOBase::VersionInfo::RELEASE_CANDIDATE)
|
.value("candidate", MOBase::VersionInfo::RELEASE_CANDIDATE)
|
||||||
.value("beta", MOBase::VersionInfo::RELEASE_BETA)
|
.value("beta", MOBase::VersionInfo::RELEASE_BETA)
|
||||||
.value("alpha", MOBase::VersionInfo::RELEASE_ALPHA)
|
.value("alpha", MOBase::VersionInfo::RELEASE_ALPHA)
|
||||||
.value("prealpha", MOBase::VersionInfo::RELEASE_PREALPHA);
|
.value("prealpha", MOBase::VersionInfo::RELEASE_PREALPHA)
|
||||||
|
;
|
||||||
|
|
||||||
|
bpy::enum_<MOBase::VersionInfo::VersionScheme>("VersionScheme")
|
||||||
|
.value("discover", MOBase::VersionInfo::SCHEME_DISCOVER)
|
||||||
|
.value("regular", MOBase::VersionInfo::SCHEME_REGULAR)
|
||||||
|
.value("decimalmark", MOBase::VersionInfo::SCHEME_DECIMALMARK)
|
||||||
|
.value("numbersandletters", MOBase::VersionInfo::SCHEME_NUMBERSANDLETTERS)
|
||||||
|
.value("date", MOBase::VersionInfo::SCHEME_DATE)
|
||||||
|
;
|
||||||
|
|
||||||
bpy::enum_<MOBase::IPluginInstaller::EInstallResult>("InstallResult")
|
bpy::enum_<MOBase::IPluginInstaller::EInstallResult>("InstallResult")
|
||||||
.value("success", MOBase::IPluginInstaller::RESULT_SUCCESS)
|
.value("success", MOBase::IPluginInstaller::RESULT_SUCCESS)
|
||||||
.value("failed", MOBase::IPluginInstaller::RESULT_FAILED)
|
.value("failed", MOBase::IPluginInstaller::RESULT_FAILED)
|
||||||
.value("canceled", MOBase::IPluginInstaller::RESULT_CANCELED)
|
.value("canceled", MOBase::IPluginInstaller::RESULT_CANCELED)
|
||||||
.value("manualRequested", MOBase::IPluginInstaller::RESULT_MANUALREQUESTED)
|
.value("manualRequested", MOBase::IPluginInstaller::RESULT_MANUALREQUESTED)
|
||||||
.value("notAttempted", MOBase::IPluginInstaller::RESULT_NOTATTEMPTED);
|
.value("notAttempted", MOBase::IPluginInstaller::RESULT_NOTATTEMPTED)
|
||||||
|
;
|
||||||
|
|
||||||
bpy::enum_<MOBase::IGameInfo::Type>("GameType")
|
bpy::enum_<MOBase::IGameInfo::Type>("GameType")
|
||||||
.value("oblivion", MOBase::IGameInfo::TYPE_OBLIVION)
|
.value("oblivion", MOBase::IGameInfo::TYPE_OBLIVION)
|
||||||
.value("fallout3", MOBase::IGameInfo::TYPE_FALLOUT3)
|
.value("fallout3", MOBase::IGameInfo::TYPE_FALLOUT3)
|
||||||
.value("falloutnv", MOBase::IGameInfo::TYPE_FALLOUTNV)
|
.value("falloutnv", MOBase::IGameInfo::TYPE_FALLOUTNV)
|
||||||
.value("skyrim", MOBase::IGameInfo::TYPE_SKYRIM);
|
.value("skyrim", MOBase::IGameInfo::TYPE_SKYRIM)
|
||||||
|
;
|
||||||
|
|
||||||
bpy::class_<MOBase::VersionInfo>("VersionInfo")
|
bpy::class_<VersionInfo>("VersionInfo")
|
||||||
.def(bpy::init<int, int, int, MOBase::VersionInfo::ReleaseType>())
|
.def(bpy::init<QString>())
|
||||||
.def("parse", &MOBase::VersionInfo::parse)
|
.def(bpy::init<QString, VersionInfo::VersionScheme>())
|
||||||
.def("canonicalString", &MOBase::VersionInfo::canonicalString);
|
.def(bpy::init<int, int, int>())
|
||||||
|
.def(bpy::init<int, int, int, VersionInfo::ReleaseType>())
|
||||||
|
.def("parse", &VersionInfo::parse)
|
||||||
|
.def("canonicalString", &VersionInfo::canonicalString)
|
||||||
|
;
|
||||||
|
|
||||||
bpy::class_<MOBase::PluginSetting>("PluginSetting", bpy::init<const QString&, const QString&, const QVariant&>());
|
bpy::class_<PluginSetting>("PluginSetting", bpy::init<const QString&, const QString&, const QVariant&>());
|
||||||
|
|
||||||
bpy::class_<IGameInfoWrapper, boost::noncopyable>("GameInfo")
|
bpy::class_<IGameInfoWrapper, boost::noncopyable>("GameInfo")
|
||||||
.def("type", bpy::pure_virtual(&MOBase::IGameInfo::type))
|
.def("type", bpy::pure_virtual(&IGameInfo::type))
|
||||||
.def("path", bpy::pure_virtual(&MOBase::IGameInfo::path))
|
.def("path", bpy::pure_virtual(&IGameInfo::path))
|
||||||
.def("binaryName", bpy::pure_virtual(&MOBase::IGameInfo::binaryName));
|
.def("binaryName", bpy::pure_virtual(&IGameInfo::binaryName))
|
||||||
|
;
|
||||||
|
|
||||||
bpy::class_<IOrganizerWrapper, boost::noncopyable>("IOrganizer")
|
bpy::class_<IOrganizerWrapper, boost::noncopyable>("IOrganizer")
|
||||||
.def("gameInfo", bpy::pure_virtual(&MOBase::IOrganizer::gameInfo), bpy::return_value_policy<bpy::reference_existing_object>())
|
.def("gameInfo", bpy::pure_virtual(&IOrganizer::gameInfo), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
//.def("createNexusBridge", bpy::pure_virtual(&MOBase::IOrganizer::createNexusBridge), bpy::return_value_policy<bpy::reference_existing_object>())
|
.def("createNexusBridge", bpy::pure_virtual(&IOrganizer::createNexusBridge), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
.def("profileName", bpy::pure_virtual(&MOBase::IOrganizer::profileName))
|
.def("profileName", bpy::pure_virtual(&IOrganizer::profileName))
|
||||||
.def("profilePath", bpy::pure_virtual(&MOBase::IOrganizer::profilePath))
|
.def("profilePath", bpy::pure_virtual(&IOrganizer::profilePath))
|
||||||
.def("downloadsPath", bpy::pure_virtual(&MOBase::IOrganizer::downloadsPath))
|
.def("downloadsPath", bpy::pure_virtual(&IOrganizer::downloadsPath))
|
||||||
.def("appVersion", bpy::pure_virtual(&MOBase::IOrganizer::appVersion))
|
.def("appVersion", bpy::pure_virtual(&IOrganizer::appVersion))
|
||||||
.def("getMod", bpy::pure_virtual(&MOBase::IOrganizer::getMod), bpy::return_value_policy<bpy::reference_existing_object>())
|
.def("getMod", bpy::pure_virtual(&IOrganizer::getMod), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
.def("createMod", bpy::pure_virtual(&MOBase::IOrganizer::createMod), bpy::return_value_policy<bpy::reference_existing_object>())
|
.def("createMod", bpy::pure_virtual(&IOrganizer::createMod), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
.def("removeMod", bpy::pure_virtual(&MOBase::IOrganizer::removeMod))
|
.def("removeMod", bpy::pure_virtual(&IOrganizer::removeMod))
|
||||||
.def("modDataChanged", bpy::pure_virtual(&MOBase::IOrganizer::modDataChanged))
|
.def("modDataChanged", bpy::pure_virtual(&IOrganizer::modDataChanged))
|
||||||
.def("pluginSetting", bpy::pure_virtual(&IOrganizer::pluginSetting))
|
.def("pluginSetting", bpy::pure_virtual(&IOrganizer::pluginSetting))
|
||||||
.def("setPluginSetting", bpy::pure_virtual(&IOrganizer::pluginSetting))
|
.def("setPluginSetting", bpy::pure_virtual(&IOrganizer::pluginSetting))
|
||||||
.def("persistent", bpy::pure_virtual(&IOrganizer::persistent))
|
.def("persistent", bpy::pure_virtual(&IOrganizer::persistent))
|
||||||
.def("setPersistent", bpy::pure_virtual(&IOrganizer::setPersistent))
|
.def("setPersistent", bpy::pure_virtual(&IOrganizer::setPersistent))
|
||||||
.def("pluginDataPath", bpy::pure_virtual(&IOrganizer::pluginDataPath))
|
.def("pluginDataPath", bpy::pure_virtual(&IOrganizer::pluginDataPath))
|
||||||
.def("installMod", bpy::pure_virtual(&IOrganizer::installMod))
|
.def("installMod", bpy::pure_virtual(&IOrganizer::installMod), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
.def("downloadManager", bpy::pure_virtual(&IOrganizer::downloadManager), bpy::return_value_policy<bpy::reference_existing_object>())
|
.def("downloadManager", bpy::pure_virtual(&IOrganizer::downloadManager), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
.def("pluginList", bpy::pure_virtual(&IOrganizer::pluginList), bpy::return_value_policy<bpy::reference_existing_object>())
|
.def("pluginList", bpy::pure_virtual(&IOrganizer::pluginList), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
|
.def("modList", bpy::pure_virtual(&IOrganizer::modList), bpy::return_value_policy<bpy::reference_existing_object>())
|
||||||
.def("startApplication", bpy::pure_virtual(&IOrganizer::startApplication), bpy::return_value_policy<bpy::return_by_value>())
|
.def("startApplication", bpy::pure_virtual(&IOrganizer::startApplication), bpy::return_value_policy<bpy::return_by_value>())
|
||||||
.def("onAboutToRun", bpy::pure_virtual(&IOrganizer::onAboutToRun))
|
.def("onAboutToRun", bpy::pure_virtual(&IOrganizer::onAboutToRun))
|
||||||
|
.def("onModInstalled", bpy::pure_virtual(&IOrganizer::onModInstalled))
|
||||||
.def("refreshModList", bpy::pure_virtual(&IOrganizer::refreshModList))
|
.def("refreshModList", bpy::pure_virtual(&IOrganizer::refreshModList))
|
||||||
;
|
;
|
||||||
|
|
||||||
bpy::class_<ModRepositoryBridgeWrapper, boost::noncopyable>("ModRepositoryBridge")
|
bpy::class_<ModRepositoryBridgeWrapper, boost::noncopyable>("ModRepositoryBridge")
|
||||||
|
.def(bpy::init<IModRepositoryBridge*>())
|
||||||
.def("requestDescription", &ModRepositoryBridgeWrapper::requestDescription)
|
.def("requestDescription", &ModRepositoryBridgeWrapper::requestDescription)
|
||||||
.def("requestFiles", &ModRepositoryBridgeWrapper::requestFiles)
|
.def("requestFiles", &ModRepositoryBridgeWrapper::requestFiles)
|
||||||
.def("requestFileInfo", &ModRepositoryBridgeWrapper::requestFileInfo)
|
.def("requestFileInfo", &ModRepositoryBridgeWrapper::requestFileInfo)
|
||||||
.def("requestDownloadURL", &ModRepositoryBridgeWrapper::requestDownloadURL)
|
|
||||||
.def("requestToggleEndorsement", &ModRepositoryBridgeWrapper::requestToggleEndorsement)
|
.def("requestToggleEndorsement", &ModRepositoryBridgeWrapper::requestToggleEndorsement)
|
||||||
.def("onFilesAvailable", &ModRepositoryBridgeWrapper::onFilesAvailable)
|
.def("onFilesAvailable", &ModRepositoryBridgeWrapper::onFilesAvailable)
|
||||||
.def("onRequestFailed", &ModRepositoryBridgeWrapper::onRequestFailed);
|
.def("onFileInfoAvailable", &ModRepositoryBridgeWrapper::onFileInfoAvailable)
|
||||||
|
.def("onDescriptionAvailable", &ModRepositoryBridgeWrapper::onDescriptionAvailable)
|
||||||
|
.def("onEndorsementToggled", &ModRepositoryBridgeWrapper::onEndorsementToggled)
|
||||||
|
.def("onRequestFailed", &ModRepositoryBridgeWrapper::onRequestFailed)
|
||||||
|
;
|
||||||
|
|
||||||
|
bpy::class_<IModRepositoryBridgeWrapper, boost::noncopyable>("IModRepositoryBridge")
|
||||||
|
.def("requestDescription", bpy::pure_virtual(&IModRepositoryBridge::requestDescription))
|
||||||
|
.def("requestFiles", bpy::pure_virtual(&IModRepositoryBridge::requestFiles))
|
||||||
|
.def("requestFileInfo", bpy::pure_virtual(&IModRepositoryBridge::requestFileInfo))
|
||||||
|
.def("requestDownloadURL", bpy::pure_virtual(&IModRepositoryBridge::requestDownloadURL))
|
||||||
|
.def("requestToggleEndorsement", bpy::pure_virtual(&IModRepositoryBridge::requestToggleEndorsement))
|
||||||
|
;
|
||||||
|
|
||||||
bpy::class_<IDownloadManagerWrapper, boost::noncopyable>("IDownloadManager")
|
bpy::class_<IDownloadManagerWrapper, boost::noncopyable>("IDownloadManager")
|
||||||
.def("startDownloadURLs", bpy::pure_virtual(&IDownloadManager::startDownloadURLs))
|
.def("startDownloadURLs", bpy::pure_virtual(&IDownloadManager::startDownloadURLs))
|
||||||
.def("startDownloadNexusFile", bpy::pure_virtual(&IDownloadManager::startDownloadNexusFile))
|
.def("startDownloadNexusFile", bpy::pure_virtual(&IDownloadManager::startDownloadNexusFile))
|
||||||
.def("downloadPath", bpy::pure_virtual(&IDownloadManager::downloadPath));
|
.def("downloadPath", bpy::pure_virtual(&IDownloadManager::downloadPath))
|
||||||
|
;
|
||||||
|
|
||||||
|
bpy::class_<IInstallationManagerWrapper, boost::noncopyable>("IInstallationManager")
|
||||||
|
.def("extractFile", bpy::pure_virtual(&IInstallationManager::extractFile))
|
||||||
|
.def("extractFiles", bpy::pure_virtual(&IInstallationManager::extractFiles))
|
||||||
|
.def("installArchive", bpy::pure_virtual(&IInstallationManager::installArchive))
|
||||||
|
;
|
||||||
|
|
||||||
|
bpy::class_<IModInterfaceWrapper, boost::noncopyable>("IModInterface")
|
||||||
|
.def("name", bpy::pure_virtual(&IModInterface::name))
|
||||||
|
.def("absolutePath", bpy::pure_virtual(&IModInterface::absolutePath))
|
||||||
|
.def("setVersion", bpy::pure_virtual(&IModInterface::setVersion))
|
||||||
|
.def("setNewestVersion", bpy::pure_virtual(&IModInterface::setNewestVersion))
|
||||||
|
.def("setIsEndorsed", bpy::pure_virtual(&IModInterface::setIsEndorsed))
|
||||||
|
.def("setNexusID", bpy::pure_virtual(&IModInterface::setNexusID))
|
||||||
|
.def("addNexusCategory", bpy::pure_virtual(&IModInterface::addNexusCategory))
|
||||||
|
.def("setName", bpy::pure_virtual(&IModInterface::setName))
|
||||||
|
.def("remove", bpy::pure_virtual(&IModInterface::remove))
|
||||||
|
;
|
||||||
|
|
||||||
bpy::enum_<MOBase::EGuessQuality>("GuessQuality")
|
bpy::enum_<MOBase::EGuessQuality>("GuessQuality")
|
||||||
.value("invalid", MOBase::GUESS_INVALID)
|
.value("invalid", MOBase::GUESS_INVALID)
|
||||||
@@ -605,18 +782,42 @@ BOOST_PYTHON_MODULE(mobase)
|
|||||||
.value("good", MOBase::GUESS_GOOD)
|
.value("good", MOBase::GUESS_GOOD)
|
||||||
.value("meta", MOBase::GUESS_META)
|
.value("meta", MOBase::GUESS_META)
|
||||||
.value("preset", MOBase::GUESS_PRESET)
|
.value("preset", MOBase::GUESS_PRESET)
|
||||||
.value("user", MOBase::GUESS_USER);
|
.value("user", MOBase::GUESS_USER)
|
||||||
|
;
|
||||||
|
|
||||||
bpy::class_<MOBase::GuessedValue<QString>, boost::noncopyable>("GuessedString")
|
bpy::class_<MOBase::GuessedValue<QString>, boost::noncopyable>("GuessedString")
|
||||||
.def("update",
|
.def("update",
|
||||||
static_cast<GuessedValue<QString> &(GuessedValue<QString>::*)(const QString&, EGuessQuality)>(&GuessedValue<QString>::update),
|
static_cast<GuessedValue<QString> &(GuessedValue<QString>::*)(const QString&, EGuessQuality)>(&GuessedValue<QString>::update),
|
||||||
bpy::return_value_policy<bpy::reference_existing_object>(), updateWithQuality())
|
bpy::return_value_policy<bpy::reference_existing_object>(), updateWithQuality())
|
||||||
.def("variants", &MOBase::GuessedValue<QString>::variants, bpy::return_value_policy<bpy::copy_const_reference>());
|
.def("variants", &MOBase::GuessedValue<QString>::variants, bpy::return_value_policy<bpy::copy_const_reference>())
|
||||||
|
;
|
||||||
|
|
||||||
bpy::class_<IPluginToolWrapper, boost::noncopyable>("IPluginTool")
|
bpy::class_<IPluginToolWrapper, boost::noncopyable>("IPluginTool")
|
||||||
.def("setParentWidget", bpy::pure_virtual(&MOBase::IPluginTool::setParentWidget));
|
.def("setParentWidget", bpy::pure_virtual(&MOBase::IPluginTool::setParentWidget))
|
||||||
|
;
|
||||||
bpy::class_<IPluginInstallerCustomWrapper, boost::noncopyable>("IPluginInstallerCustom")
|
bpy::class_<IPluginInstallerCustomWrapper, boost::noncopyable>("IPluginInstallerCustom")
|
||||||
.def("setParentWidget", bpy::pure_virtual(&MOBase::IPluginInstallerCustom::setParentWidget));
|
.def("setParentWidget", bpy::pure_virtual(&MOBase::IPluginInstallerCustom::setParentWidget))
|
||||||
|
;
|
||||||
|
|
||||||
|
Functor0_converter(); // converter for the onRefreshed-callback
|
||||||
|
bpy::class_<IPluginListWrapper, boost::noncopyable>("IPluginList")
|
||||||
|
.def("state", bpy::pure_virtual(&MOBase::IPluginList::state))
|
||||||
|
.def("priority", bpy::pure_virtual(&MOBase::IPluginList::priority))
|
||||||
|
.def("loadOrder", bpy::pure_virtual(&MOBase::IPluginList::loadOrder))
|
||||||
|
.def("isMaster", bpy::pure_virtual(&MOBase::IPluginList::isMaster))
|
||||||
|
.def("origin", bpy::pure_virtual(&MOBase::IPluginList::origin))
|
||||||
|
.def("onRefreshed", bpy::pure_virtual(&MOBase::IPluginList::onRefreshed))
|
||||||
|
;
|
||||||
|
|
||||||
|
bpy::to_python_converter<IModList::ModStates, QFlags_to_int<IModList::ModState>>();
|
||||||
|
Functor2_converter<const QString&, IModList::ModStates>(); // converter for the onModStateChanged-callback
|
||||||
|
bpy::class_<IModListWrapper, boost::noncopyable>("IModList")
|
||||||
|
.def("state", bpy::pure_virtual(&MOBase::IModList::state))
|
||||||
|
.def("priority", bpy::pure_virtual(&MOBase::IModList::priority))
|
||||||
|
.def("setPriority", bpy::pure_virtual(&MOBase::IModList::setPriority))
|
||||||
|
.def("onModStateChanged", bpy::pure_virtual(&MOBase::IModList::onModStateChanged))
|
||||||
|
.def("onModMoved", bpy::pure_virtual(&MOBase::IModList::onModMoved))
|
||||||
|
;
|
||||||
|
|
||||||
GuessedValue_converters<QString>();
|
GuessedValue_converters<QString>();
|
||||||
|
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ public:
|
|||||||
#define PYDLLEXPORT Q_DECL_IMPORT
|
#define PYDLLEXPORT Q_DECL_IMPORT
|
||||||
#endif // PYTHONRUNNER_LIBRARY
|
#endif // PYTHONRUNNER_LIBRARY
|
||||||
|
|
||||||
extern "C" PYDLLEXPORT IPythonRunner *CreatePythonRunner(const MOBase::IOrganizer *moInfo, const QString &pythonDir);
|
extern "C" PYDLLEXPORT IPythonRunner *CreatePythonRunner(MOBase::IOrganizer *moInfo, const QString &pythonDir);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+146
-20
@@ -3,7 +3,9 @@
|
|||||||
|
|
||||||
|
|
||||||
#ifndef Q_MOC_RUN
|
#ifndef Q_MOC_RUN
|
||||||
|
#pragma warning (push, 0)
|
||||||
#include <boost/python.hpp>
|
#include <boost/python.hpp>
|
||||||
|
#pragma warning (pop)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <QString>
|
#include <QString>
|
||||||
@@ -11,6 +13,8 @@
|
|||||||
#include <imoinfo.h>
|
#include <imoinfo.h>
|
||||||
#include <igameinfo.h>
|
#include <igameinfo.h>
|
||||||
#include <imodrepositorybridge.h>
|
#include <imodrepositorybridge.h>
|
||||||
|
#include <imodinterface.h>
|
||||||
|
#include <iinstallationmanager.h>
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
#include "gilock.h"
|
#include "gilock.h"
|
||||||
|
|
||||||
@@ -51,8 +55,6 @@ public:
|
|||||||
{ m_Wrapped->requestFiles(modID, userData); }
|
{ m_Wrapped->requestFiles(modID, userData); }
|
||||||
void requestFileInfo(int modID, int fileID, QVariant userData)
|
void requestFileInfo(int modID, int fileID, QVariant userData)
|
||||||
{ m_Wrapped->requestFileInfo(modID, fileID, userData); }
|
{ m_Wrapped->requestFileInfo(modID, fileID, userData); }
|
||||||
void requestDownloadURL(int modID, int fileID, QVariant userData)
|
|
||||||
{ m_Wrapped->requestDownloadURL(modID, fileID, userData); }
|
|
||||||
void requestToggleEndorsement(int modID, bool endorse, QVariant userData)
|
void requestToggleEndorsement(int modID, bool endorse, QVariant userData)
|
||||||
{ m_Wrapped->requestToggleEndorsement(modID, endorse, userData); }
|
{ m_Wrapped->requestToggleEndorsement(modID, endorse, userData); }
|
||||||
|
|
||||||
@@ -63,10 +65,31 @@ public:
|
|||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void onDescriptionAvailable(boost::python::object callback) {
|
||||||
|
m_DescriptionAvailableHandler = callback;
|
||||||
|
connect(m_Wrapped, SIGNAL(descriptionAvailable(int,QVariant,QVariant)),
|
||||||
|
this, SLOT(descriptionAvailable(int,QVariant,QVariant)),
|
||||||
|
Qt::UniqueConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onFileInfoAvailable(boost::python::object callback) {
|
||||||
|
m_FileInfoHandler = callback;
|
||||||
|
connect(m_Wrapped, SIGNAL(fileInfoAvailable(int,int,QVariant,QVariant)),
|
||||||
|
this, SLOT(fileInfoAvailable(int,int,QVariant,QVariant)),
|
||||||
|
Qt::UniqueConnection);
|
||||||
|
}
|
||||||
|
|
||||||
|
void onEndorsementToggled(boost::python::object callback) {
|
||||||
|
m_EndorsementToggledHandler = callback;
|
||||||
|
connect(m_Wrapped, SIGNAL(endorsementToggled(int,QVariant,QVariant)),
|
||||||
|
this, SLOT(endorsementToggled(int,QVariant,QVariant)),
|
||||||
|
Qt::UniqueConnection);
|
||||||
|
}
|
||||||
|
|
||||||
void onRequestFailed(boost::python::object callback) {
|
void onRequestFailed(boost::python::object callback) {
|
||||||
m_FailedHandler = callback;
|
m_FailedHandler = callback;
|
||||||
connect(m_Wrapped, SIGNAL(requestFailed(int,QVariant,QString)),
|
connect(m_Wrapped, SIGNAL(requestFailed(int,int,QVariant,QString)),
|
||||||
this, SLOT(requestFailed(int,QVariant,QString)),
|
this, SLOT(requestFailed(int,int,QVariant,QString)),
|
||||||
Qt::UniqueConnection);
|
Qt::UniqueConnection);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,20 +105,78 @@ private slots:
|
|||||||
qCritical("no handler connected");
|
qCritical("no handler connected");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// try {
|
try {
|
||||||
GILock lock;
|
GILock lock;
|
||||||
m_FilesAvailableHandler(modID, userData, resultData);
|
m_FilesAvailableHandler(modID, userData, resultData);
|
||||||
// } catch (const boost::python::error_already_set&) {
|
} catch (const boost::python::error_already_set&) {
|
||||||
// qDebug("error");
|
reportPythonError();
|
||||||
//reportPythonError();
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void requestFailed(int modID, QVariant userData, const QString &errorMessage)
|
void descriptionAvailable(int modID, QVariant userData, const QVariant resultData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (m_DescriptionAvailableHandler.is_none()) {
|
||||||
|
qCritical("no handler connected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
GILock lock;
|
||||||
|
m_DescriptionAvailableHandler(modID, userData, resultData);
|
||||||
|
} catch (const boost::python::error_already_set&) {
|
||||||
|
reportPythonError();
|
||||||
|
}
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
qCritical("failed to report event: %s", e.what());
|
||||||
|
} catch (...) {
|
||||||
|
qCritical("failed to report event");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void fileInfoAvailable(int modID, int fileID, QVariant userData, const QVariant resultData) {
|
||||||
|
try {
|
||||||
|
if (m_FileInfoHandler.is_none()) {
|
||||||
|
qCritical("no handler connected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
GILock lock;
|
||||||
|
m_FileInfoHandler(modID, fileID, userData, resultData);
|
||||||
|
} catch (const boost::python::error_already_set&) {
|
||||||
|
reportPythonError();
|
||||||
|
}
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
qCritical("failed to report event: %s", e.what());
|
||||||
|
} catch (...) {
|
||||||
|
qCritical("failed to report event");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void endorsementToggled(int modID, QVariant userData, const QVariant resultData)
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
if (m_EndorsementToggledHandler.is_none()) {
|
||||||
|
qCritical("no handler connected");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
GILock lock;
|
||||||
|
m_EndorsementToggledHandler(modID, userData, resultData);
|
||||||
|
} catch (const boost::python::error_already_set&) {
|
||||||
|
reportPythonError();
|
||||||
|
}
|
||||||
|
} catch (const std::exception &e) {
|
||||||
|
qCritical("failed to report event: %s", e.what());
|
||||||
|
} catch (...) {
|
||||||
|
qCritical("failed to report event");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void requestFailed(int modID, int fileID, QVariant userData, const QString &errorMessage)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
GILock lock;
|
GILock lock;
|
||||||
m_FailedHandler(modID, userData, errorMessage);
|
m_FailedHandler(modID, fileID, userData, errorMessage);
|
||||||
} catch (const boost::python::error_already_set&) {
|
} catch (const boost::python::error_already_set&) {
|
||||||
reportPythonError();
|
reportPythonError();
|
||||||
}
|
}
|
||||||
@@ -105,21 +186,20 @@ private:
|
|||||||
|
|
||||||
MOBase::IModRepositoryBridge *m_Wrapped;
|
MOBase::IModRepositoryBridge *m_Wrapped;
|
||||||
boost::python::object m_FilesAvailableHandler;
|
boost::python::object m_FilesAvailableHandler;
|
||||||
|
boost::python::object m_DescriptionAvailableHandler;
|
||||||
|
boost::python::object m_FileInfoHandler;
|
||||||
|
boost::python::object m_EndorsementToggledHandler;
|
||||||
boost::python::object m_FailedHandler;
|
boost::python::object m_FailedHandler;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOrganizer>
|
struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOrganizer>
|
||||||
{
|
{
|
||||||
virtual MOBase::IGameInfo &gameInfo() const {
|
virtual MOBase::IGameInfo &gameInfo() const {
|
||||||
MOBase::IGameInfo *result = this->get_override("gameInfo")();
|
MOBase::IGameInfo *result = this->get_override("gameInfo")();
|
||||||
return *result;
|
return *result;
|
||||||
}
|
}
|
||||||
virtual MOBase::IModRepositoryBridge *createNexusBridge() const {
|
virtual MOBase::IModRepositoryBridge *createNexusBridge() const { return this->get_override("createNexusBridge")(); }
|
||||||
return this->get_override("createNexusBridge")();
|
|
||||||
}
|
|
||||||
|
|
||||||
virtual QString profileName() const { return this->get_override("profileName")(); }
|
virtual QString profileName() const { return this->get_override("profileName")(); }
|
||||||
virtual QString profilePath() const { return this->get_override("profilePath")(); }
|
virtual QString profilePath() const { return this->get_override("profilePath")(); }
|
||||||
virtual QString downloadsPath() const { return this->get_override("downloadsPath")(); }
|
virtual QString downloadsPath() const { return this->get_override("downloadsPath")(); }
|
||||||
@@ -133,7 +213,7 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOr
|
|||||||
virtual QVariant persistent(const QString &pluginName, const QString &key, const QVariant &def = QVariant()) const { return this->get_override("persistent")(pluginName, key, def); }
|
virtual QVariant persistent(const QString &pluginName, const QString &key, const QVariant &def = QVariant()) const { return this->get_override("persistent")(pluginName, key, def); }
|
||||||
virtual void setPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync = true) { this->get_override("setPersistent")(pluginName, key, value, sync); }
|
virtual void setPersistent(const QString &pluginName, const QString &key, const QVariant &value, bool sync = true) { this->get_override("setPersistent")(pluginName, key, value, sync); }
|
||||||
virtual QString pluginDataPath() const { return this->get_override("pluginDataPath")(); }
|
virtual QString pluginDataPath() const { return this->get_override("pluginDataPath")(); }
|
||||||
virtual void installMod(const QString &fileName) { this->get_override("installMod")(fileName); }
|
virtual MOBase::IModInterface *installMod(const QString &fileName) { return this->get_override("installMod")(fileName); }
|
||||||
virtual MOBase::IDownloadManager *downloadManager() { return this->get_override("downloadManager")(); }
|
virtual MOBase::IDownloadManager *downloadManager() { return this->get_override("downloadManager")(); }
|
||||||
virtual MOBase::IPluginList *pluginList() { return this->get_override("pluginList")(); }
|
virtual MOBase::IPluginList *pluginList() { return this->get_override("pluginList")(); }
|
||||||
virtual MOBase::IModList *modList() { return this->get_override("modList")(); }
|
virtual MOBase::IModList *modList() { return this->get_override("modList")(); }
|
||||||
@@ -142,8 +222,9 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOr
|
|||||||
virtual QStringList findFiles(const QString &path, const std::function<bool(const QString&)> &filter) const { return this->get_override("findFiles")(path, filter); }
|
virtual QStringList findFiles(const QString &path, const std::function<bool(const QString&)> &filter) const { return this->get_override("findFiles")(path, filter); }
|
||||||
virtual QList<FileInfo> findFileInfos(const QString &path, const std::function<bool(const FileInfo&)> &filter) const { return this->get_override("findFileInfos")(path, filter); }
|
virtual QList<FileInfo> findFileInfos(const QString &path, const std::function<bool(const FileInfo&)> &filter) const { return this->get_override("findFileInfos")(path, filter); }
|
||||||
virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "", const QString &profile = "") { return this->get_override("startApplication")(executable, args, cwd, profile); }
|
virtual HANDLE startApplication(const QString &executable, const QStringList &args = QStringList(), const QString &cwd = "", const QString &profile = "") { return this->get_override("startApplication")(executable, args, cwd, profile); }
|
||||||
virtual bool onAboutToRun(const std::function<bool(const QString&)> &func) { return this->get_override("onAboutToRun")(func); }
|
|
||||||
virtual void refreshModList(bool saveChanges = true) { this->get_override("refreshModList")(saveChanges); }
|
virtual void refreshModList(bool saveChanges = true) { this->get_override("refreshModList")(saveChanges); }
|
||||||
|
virtual bool onAboutToRun(const std::function<bool(const QString&)> &func) { return this->get_override("onAboutToRun")(func); }
|
||||||
|
virtual bool onModInstalled(const std::function<void(const QString&)> &func) { return this->get_override("onModInstalled")(func); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper<MOBase::IDownloadManager>
|
struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper<MOBase::IDownloadManager>
|
||||||
@@ -151,8 +232,22 @@ struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper
|
|||||||
virtual int startDownloadURLs(const QStringList &urls) { return this->get_override("downloadURLs")(urls); }
|
virtual int startDownloadURLs(const QStringList &urls) { return this->get_override("downloadURLs")(urls); }
|
||||||
virtual int startDownloadNexusFile(int modID, int fileID) { return this->get_override("downloadNexusFile")(modID, fileID); }
|
virtual int startDownloadNexusFile(int modID, int fileID) { return this->get_override("downloadNexusFile")(modID, fileID); }
|
||||||
virtual QString downloadPath(int id) { return this->get_override("downloadPath")(id); }
|
virtual QString downloadPath(int id) { return this->get_override("downloadPath")(id); }
|
||||||
private:
|
};
|
||||||
boost::python::object m_DownloadCompleteHandler;
|
|
||||||
|
struct IModRepositoryBridgeWrapper: MOBase::IModRepositoryBridge, boost::python::wrapper<MOBase::IModRepositoryBridge>
|
||||||
|
{
|
||||||
|
virtual void requestDescription(int modID, QVariant userData) { this->get_override("requestDescription")(modID, userData); }
|
||||||
|
virtual void requestFiles(int modID, QVariant userData) { this->get_override("requestFiles")(modID, userData); }
|
||||||
|
virtual void requestFileInfo(int modID, int fileID, QVariant userData) { this->get_override("requestFileInfo")(modID, fileID, userData); }
|
||||||
|
virtual void requestDownloadURL(int modID, int fileID, QVariant userData) { this->get_override("requestDownloadURL")(modID, fileID, userData); }
|
||||||
|
virtual void requestToggleEndorsement(int modID, bool endorse, QVariant userData) { this->get_override("requestToggleEndorsement")(modID, endorse, userData); }
|
||||||
|
};
|
||||||
|
|
||||||
|
struct IInstallationManagerWrapper: MOBase::IInstallationManager, boost::python::wrapper<MOBase::IInstallationManager>
|
||||||
|
{
|
||||||
|
virtual QString extractFile(const QString &fileName) { return this->get_override("extractFile")(fileName); }
|
||||||
|
virtual QStringList extractFiles(const QStringList &files, bool flatten) { return this->get_override("extractFiles")(files, flatten); }
|
||||||
|
virtual MOBase::IPluginInstaller::EInstallResult installArchive(MOBase::GuessedValue<QString> &modName, const QString &archiveFile) { return this->get_override("installArchive")(modName, archiveFile); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper<MOBase::IGameInfo>
|
struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper<MOBase::IGameInfo>
|
||||||
@@ -162,5 +257,36 @@ struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper<MOBase::IGame
|
|||||||
virtual QString binaryName() const { return this->get_override("binaryName")(); }
|
virtual QString binaryName() const { return this->get_override("binaryName")(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct IModInterfaceWrapper: MOBase::IModInterface, boost::python::wrapper<MOBase::IModInterface>
|
||||||
|
{
|
||||||
|
virtual QString name() const { return this->get_override("name")(); }
|
||||||
|
virtual QString absolutePath() const { return this->get_override("absolutePath")(); }
|
||||||
|
virtual void setVersion(const MOBase::VersionInfo &version) { this->get_override("setVersion")(version); }
|
||||||
|
virtual void setNewestVersion(const MOBase::VersionInfo &version) { this->get_override("setNewestVersion")(version); }
|
||||||
|
virtual void setIsEndorsed(bool endorsed) { this->get_override("setIsEndorsed")(endorsed); }
|
||||||
|
virtual void setNexusID(int nexusID) { this->get_override("setNexusID")(nexusID); }
|
||||||
|
virtual void addNexusCategory(int categoryID) { this->get_override("addNexusCategory")(categoryID); }
|
||||||
|
virtual bool setName(const QString &name) { return this->get_override("setName")(name); }
|
||||||
|
virtual bool remove() { return this->get_override("remove")(); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct IPluginListWrapper: MOBase::IPluginList, boost::python::wrapper<MOBase::IPluginList> {
|
||||||
|
virtual PluginState state(const QString &name) const { return this->get_override("state")(name); }
|
||||||
|
virtual int priority(const QString &name) const { return this->get_override("priority")(name); }
|
||||||
|
virtual int loadOrder(const QString &name) const { return this->get_override("loadOrder")(name); }
|
||||||
|
virtual bool isMaster(const QString &name) const { return this->get_override("isMaster")(name); }
|
||||||
|
virtual QString origin(const QString &name) const { return this->get_override("origin")(name); }
|
||||||
|
virtual bool onRefreshed(const std::function<void ()> &callback) { return this->get_override("onRefreshed")(callback); }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct IModListWrapper: MOBase::IModList, boost::python::wrapper<MOBase::IModList> {
|
||||||
|
virtual ModStates state(const QString &name) const{ return this->get_override("state")(name); }
|
||||||
|
virtual int priority(const QString &name) const{ return this->get_override("priority")(name); }
|
||||||
|
virtual bool setPriority(const QString &name, int newPriority){ return this->get_override("setPriority")(name, newPriority); }
|
||||||
|
virtual bool onModStateChanged(const std::function<void (const QString &, ModStates)> &func) { return this->get_override("onModStateChanged")(func); }
|
||||||
|
virtual bool onModMoved(const std::function<void (const QString &, int, int)> &func) { return this->get_override("onModMoved")(func); }
|
||||||
|
};
|
||||||
|
|
||||||
#endif // UIBASEWRAPPERS_H
|
#endif // UIBASEWRAPPERS_H
|
||||||
|
|||||||
Reference in New Issue
Block a user