mirror of
https://github.com/ModOrganizer2/modorganizer-plugin_python.git
synced 2026-07-27 14:03:33 -07:00
Compare commits
14
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b989e9f97 | ||
|
|
b7edde6fa0 | ||
|
|
589325d91b | ||
|
|
994018a491 | ||
|
|
7c8fafc196 | ||
|
|
29c66c621d | ||
|
|
7b5f01b49d | ||
|
|
a738cef190 | ||
|
|
2bf3ba0984 | ||
|
|
b76c4a1869 | ||
|
|
ae8b6a39b0 | ||
|
|
2dc9463951 | ||
|
|
1d4a4b485d | ||
|
|
d5838c7560 |
@@ -8,9 +8,7 @@
|
||||
TARGET = proxyPython
|
||||
TEMPLATE = lib
|
||||
|
||||
contains(QT_VERSION, "^5.*") {
|
||||
QT += widgets
|
||||
}
|
||||
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
|
||||
|
||||
CONFIG += plugins
|
||||
CONFIG += dll
|
||||
@@ -38,14 +36,14 @@ RC_FILE += \
|
||||
|
||||
include(../plugin_template.pri)
|
||||
|
||||
INCLUDEPATH += "../../pythonRunner" "$(BOOSTPATH)"
|
||||
INCLUDEPATH += "../../pythonRunner" "$${BOOSTPATH}"
|
||||
|
||||
WINPWD = $$PWD
|
||||
WINPWD ~= s,/,$$QMAKE_DIR_SEP,g
|
||||
|
||||
//QMAKE_POST_LINK += SET VS90COMNTOOLS=%VS100COMNTOOLS% $$escape_expand(\\n)
|
||||
#QMAKE_POST_LINK += SET VS90COMNTOOLS=%VS100COMNTOOLS% $$escape_expand(\\n)
|
||||
|
||||
|
||||
//QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\sip.pyd $$quote($$DSTDIR)\\plugins\\data\\ $$escape_expand(\\n)
|
||||
//QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\PyQt4\\QtCore.pyd $$quote($$DSTDIR)\\plugins\\data\\PyQt4\\ $$escape_expand(\\n)
|
||||
//QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\PyQt4\\QtGui.pyd $$quote($$DSTDIR)\\plugins\\data\\PyQt4\\ $$escape_expand(\\n)
|
||||
#QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\sip.pyd $$quote($$DSTDIR)\\plugins\\data\\ $$escape_expand(\\n)
|
||||
#QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\PyQt4\\QtCore.pyd $$quote($$DSTDIR)\\plugins\\data\\PyQt4\\ $$escape_expand(\\n)
|
||||
#QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\PyQt4\\QtGui.pyd $$quote($$DSTDIR)\\plugins\\data\\PyQt4\\ $$escape_expand(\\n)
|
||||
|
||||
@@ -163,7 +163,7 @@ bool ProxyPython::init(IOrganizer *moInfo)
|
||||
|
||||
QString ProxyPython::name() const
|
||||
{
|
||||
return tr("Python Proxy");
|
||||
return "Python Proxy";
|
||||
}
|
||||
|
||||
QString ProxyPython::author() const
|
||||
|
||||
@@ -28,7 +28,7 @@ along with python proxy plugin. If not, see <http://www.gnu.org/licenses/>.
|
||||
#include <pythonrunner.h>
|
||||
|
||||
|
||||
class ProxyPython : public QObject, MOBase::IPluginProxy, MOBase::IPluginDiagnose
|
||||
class ProxyPython : public QObject, public MOBase::IPluginProxy, public MOBase::IPluginDiagnose
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginProxy MOBase::IPluginDiagnose)
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <boost/python.hpp>
|
||||
#endif
|
||||
#include <QString>
|
||||
#include <utility.h>
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#define HAVE_ROUND
|
||||
//#define HAVE_ROUND
|
||||
#include "proxypluginwrappers.h"
|
||||
#include <utility.h>
|
||||
#include "error.h"
|
||||
@@ -27,63 +27,63 @@ bool IPluginToolWrapper::init(MOBase::IOrganizer *moInfo)
|
||||
QString IPluginToolWrapper::name() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("name")();
|
||||
return this->get_override("name")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QString IPluginToolWrapper::author() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("author")();
|
||||
return this->get_override("author")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QString IPluginToolWrapper::description() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("description")();
|
||||
return this->get_override("description")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
MOBase::VersionInfo IPluginToolWrapper::version() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("version")();
|
||||
return this->get_override("version")().as<MOBase::VersionInfo>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
bool IPluginToolWrapper::isActive() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("isActive")();
|
||||
return this->get_override("isActive")().as<bool>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QList<MOBase::PluginSetting> IPluginToolWrapper::settings() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("settings")();
|
||||
return this->get_override("settings")().as<QList<MOBase::PluginSetting>>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QString IPluginToolWrapper::displayName() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("displayName")();
|
||||
return this->get_override("displayName")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QString IPluginToolWrapper::tooltip() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("tooltip")();
|
||||
return this->get_override("tooltip")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QIcon IPluginToolWrapper::icon() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("icon")();
|
||||
return this->get_override("icon")().as<QIcon>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
@@ -118,21 +118,21 @@ bool IPluginInstallerCustomWrapper::init(MOBase::IOrganizer *moInfo)
|
||||
QString IPluginInstallerCustomWrapper::name() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("name")();
|
||||
return this->get_override("name")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QString IPluginInstallerCustomWrapper::author() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("author")();
|
||||
return this->get_override("author")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
QString IPluginInstallerCustomWrapper::description() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("description")();
|
||||
return this->get_override("description")().as<QString>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
@@ -153,7 +153,7 @@ bool IPluginInstallerCustomWrapper::isActive() const
|
||||
QList<MOBase::PluginSetting> IPluginInstallerCustomWrapper::settings() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("settings")();
|
||||
return this->get_override("settings")().as<QList<MOBase::PluginSetting>>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,7 @@ bool IPluginInstallerCustomWrapper::isArchiveSupported(const QString &archiveNam
|
||||
std::set<QString> IPluginInstallerCustomWrapper::supportedExtensions() const
|
||||
{
|
||||
try {
|
||||
return this->get_override("supportedExtensions")();
|
||||
return this->get_override("supportedExtensions")().as<std::set<QString>>();
|
||||
} PYCATCH;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <iplugintool.h>
|
||||
#include <iplugininstallersimple.h>
|
||||
#include <iplugininstallercustom.h>
|
||||
#include <iplugindiagnose.h>
|
||||
|
||||
#ifndef Q_MOC_RUN
|
||||
#include <boost/python.hpp>
|
||||
|
||||
+18
-13
@@ -13,7 +13,13 @@ CONFIG += warn_on
|
||||
DEFINES += PYTHONRUNNER_LIBRARY
|
||||
|
||||
# suppress a few warnings caused by boost vs vc++ paranoia
|
||||
DEFINES += _SCL_SECURE_NO_WARNINGS
|
||||
DEFINES += _SCL_SECURE_NO_WARNINGS -DHAVE_ROUND
|
||||
|
||||
|
||||
!include(../LocalPaths.pri) {
|
||||
message("paths to required libraries need to be set up in LocalPaths.pri")
|
||||
}
|
||||
|
||||
|
||||
SOURCES += pythonrunner.cpp \
|
||||
gilock.cpp \
|
||||
@@ -28,29 +34,28 @@ HEADERS += pythonrunner.h \
|
||||
pythonpluginwrapper.h \
|
||||
proxypluginwrappers.h
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
LIBS += -L$$OUT_PWD/../uibase/debug
|
||||
} else {
|
||||
LIBS += -L$$OUT_PWD/../uibase/release
|
||||
QMAKE_CXXFLAGS += /Zi
|
||||
QMAKE_LFLAGS += /DEBUG
|
||||
}
|
||||
|
||||
INCLUDEPATH += "$${BOOSTPATH}" "$${PYTHONPATH}/include" "$${PYTHONPATH}/Lib/site-packages/PyQt5/include" ../uibase
|
||||
LIBS += -L"$${PYTHONPATH}/libs" -L"$${BOOSTPATH}/stage/lib"
|
||||
LIBS += -lpython27
|
||||
LIBS += -luibase
|
||||
|
||||
CONFIG(debug, debug|release) {
|
||||
SRCDIR = $$OUT_PWD/debug
|
||||
DSTDIR = $$PWD/../../outputd
|
||||
LIBS += -L$$OUT_PWD/../uibase/debug
|
||||
} else {
|
||||
SRCDIR = $$OUT_PWD/release
|
||||
DSTDIR = $$PWD/../../output
|
||||
LIBS += -L$$OUT_PWD/../uibase/release
|
||||
QMAKE_CXXFLAGS += /Zi
|
||||
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"
|
||||
LIBS += -L"$$(PYTHONPATH)/libs" -L"$(BOOSTPATH)/stage/lib"
|
||||
LIBS += -lpython27
|
||||
|
||||
INCLUDEPATH += ../uibase
|
||||
LIBS += -luibase
|
||||
|
||||
QMAKE_POST_LINK += xcopy /y /I $$quote($$SRCDIR\\$${TARGET}*.pdb) $$quote($$DSTDIR)\\plugins $$escape_expand(\\n)
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#pragma warning( disable : 4100 )
|
||||
#pragma warning( disable : 4996 )
|
||||
|
||||
#include <boost/python.hpp>
|
||||
#include <iplugininstaller.h>
|
||||
#include "uibasewrappers.h"
|
||||
#include "pythonpluginwrapper.h"
|
||||
@@ -726,6 +725,7 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
.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("waitForApplication", bpy::pure_virtual(&IOrganizer::waitForApplication), bpy::return_value_policy<bpy::return_by_value>())
|
||||
.def("onAboutToRun", bpy::pure_virtual(&IOrganizer::onAboutToRun))
|
||||
.def("onModInstalled", bpy::pure_virtual(&IOrganizer::onModInstalled))
|
||||
.def("refreshModList", bpy::pure_virtual(&IOrganizer::refreshModList))
|
||||
@@ -805,13 +805,16 @@ BOOST_PYTHON_MODULE(mobase)
|
||||
.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("masters", bpy::pure_virtual(&MOBase::IPluginList::masters))
|
||||
.def("origin", bpy::pure_virtual(&MOBase::IPluginList::origin))
|
||||
.def("onRefreshed", bpy::pure_virtual(&MOBase::IPluginList::onRefreshed))
|
||||
.def("onPluginMoved", bpy::pure_virtual(&MOBase::IPluginList::onPluginMoved))
|
||||
;
|
||||
|
||||
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("displayName", bpy::pure_virtual(&MOBase::IModList::displayName))
|
||||
.def("state", bpy::pure_virtual(&MOBase::IModList::state))
|
||||
.def("priority", bpy::pure_virtual(&MOBase::IModList::priority))
|
||||
.def("setPriority", bpy::pure_virtual(&MOBase::IModList::setPriority))
|
||||
|
||||
@@ -203,6 +203,7 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOr
|
||||
virtual QString profileName() const { return this->get_override("profileName")(); }
|
||||
virtual QString profilePath() const { return this->get_override("profilePath")(); }
|
||||
virtual QString downloadsPath() const { return this->get_override("downloadsPath")(); }
|
||||
virtual QString overwritePath() const { return this->get_override("overwritePath")(); }
|
||||
virtual MOBase::VersionInfo appVersion() const { return this->get_override("appVersion")(); }
|
||||
virtual MOBase::IModInterface *getMod(const QString &name) { return this->get_override("getMod")(name); }
|
||||
virtual MOBase::IModInterface *createMod(MOBase::GuessedValue<QString> &name) { return this->get_override("createMod")(name); }
|
||||
@@ -220,8 +221,10 @@ struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOr
|
||||
virtual QString resolvePath(const QString &fileName) const { return this->get_override("resolvePath")(fileName); }
|
||||
virtual QStringList listDirectories(const QString &directoryName) const { return this->get_override("listDirectories")(directoryName); }
|
||||
virtual QStringList findFiles(const QString &path, const std::function<bool(const QString&)> &filter) const { return this->get_override("findFiles")(path, filter); }
|
||||
virtual QStringList getFileOrigins(const QString &fileName) const { return this->get_override("getFileOrigin")(fileName); }
|
||||
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 bool waitForApplication(HANDLE handle, LPDWORD exitCode = NULL) const { return this->get_override("waitForApplication")(handle, exitCode); }
|
||||
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); }
|
||||
@@ -265,6 +268,7 @@ struct IModInterfaceWrapper: MOBase::IModInterface, boost::python::wrapper<MOBas
|
||||
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 setInstallationFile(const QString &fileName) { this->get_override("setInstallationFile")(fileName); }
|
||||
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")(); }
|
||||
@@ -276,15 +280,18 @@ struct IPluginListWrapper: MOBase::IPluginList, boost::python::wrapper<MOBase::I
|
||||
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 QStringList masters(const QString &name) const { return this->get_override("masters")(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); }
|
||||
virtual bool onPluginMoved(const std::function<void (const QString &, int, int)> &callback) { return this->get_override("onPluginMoved")(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 QString displayName(const QString &internalName) const { return this->get_override("displayName")(internalName); }
|
||||
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); }
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user