Compare commits

...
Author SHA1 Message Date
Tannin c7203bf9de - bugfixes
- moved more functionality to game-plugins
- further decoupled management functionality from the UI
- created another "tutorial" which is only a single page with relevant parts of
  the ui highlighted with info as tooltips
2015-01-06 19:31:53 +01:00
Tannin a7d626c83c Merge 2015-01-04 10:33:37 +01:00
Tannin bbea63e7af - fixes after merge 2015-01-04 10:13:12 +01:00
Tannin 9f607a5fcb Merge with branch1.2 2015-01-03 15:58:52 +01:00
Tannin b7edde6fa0 custom installers can now set the installation file (and the ncc installer now does) 2014-12-14 16:30:23 +01:00
Tannin 589325d91b - NCC installer can now discover files in other mods (thanks Reunion!) and knows the script extender version 2014-12-13 16:47:11 +01:00
Tannin 994018a491 minor fixes 2014-12-04 19:25:07 +01:00
Tannin 868ab93a1f replaced all uses of NULL with nullptr
fixed a few placed where NULL was used as a number or boolean
2014-11-28 11:19:20 +01:00
Tannin 7c8fafc196 several bugfixes from the bugfix-wc that I forgot to backport 2014-11-26 20:21:33 +01:00
Tannin dec620b5b7 - started on a refactoring moving functionality out of the MainWindow class
- started on support for game-plugins
2014-11-21 14:45:30 +01:00
Tannin 29c66c621d - updated staging script to use qt5 and to fetch translations from transifex
- removed call to function unavailable in Windows XP
2014-11-11 23:48:22 +01:00
Tannin 5da6a9d3bd - updated staging script to use qt5 and to fetch translations from transifex
- removed call to function unavailable in Windows XP
2014-11-11 23:48:22 +01:00
Tannin 7b5f01b49d - bsa parser will now cancel in case of a read error. Before, when attempting to parse a broken bsa it could take forever and continuously allocate memory
- better error message when bsa parsing fails
- slightly better support for font colors in bbcode converter
- configurator now also uses pyqt5
- bugfix: bsa hashing function converted backslashes to slashes instead of the other way around. hash calculation is still often wrong on folder names...
2014-11-09 14:01:48 +01:00
Tannin 573be8c6b5 - bsa parser will now cancel in case of a read error. Before, when attempting to parse a broken bsa it could take forever and continuously allocate memory
- better error message when bsa parsing fails
- slightly better support for font colors in bbcode converter
- configurator now also uses pyqt5
- bugfix: bsa hashing function converted backslashes to slashes instead of the other way around. hash calculation is still often wrong on folder names...
2014-11-09 14:01:48 +01:00
Tannin a738cef190 - moved the hook-recursion-protection to tls
- some code cleanup and consolidation
- hook.dll will now report all of its own exceptions
- some more logging during startup
- changed the way urls are encoded for download requests
- now displaying (one of the) process name(s) while waiting for a program to end
- bugfix: spawned processes were forced to leave the job
2014-09-29 20:35:35 +02:00
Tannin 2c661da2da - moved the hook-recursion-protection to tls
- some code cleanup and consolidation
- hook.dll will now report all of its own exceptions
- some more logging during startup
- changed the way urls are encoded for download requests
- now displaying (one of the) process name(s) while waiting for a program to end
- bugfix: spawned processes were forced to leave the job
2014-09-29 20:35:35 +02:00
Tannin 2bf3ba0984 plugins can now query the list of masters for a plugin 2014-09-10 20:37:17 +02:00
Tannin fa09fd7635 plugins can now query the list of masters for a plugin 2014-09-10 20:37:17 +02:00
Tannin b76c4a1869 - re-enabled building of loot_cli and started developing against the new api
- extended set of default categories
- more tolerand bbcode parser
- added a few colors for the bbcode parser
- more fixes to qt5 compatibility
- started work on ability to unloading (and thus re-loading) of plugins
- names of plugins are no longer localizable (because those names are also used to store settings)
- added settings to disable individual diagnosis settings
- path of dependencies is now configured in a .pri file instead of environment variablees
- bugfix: if the modid-input is canceled, the id was saved as -1 and wasn't re-requested from the user
- bugfix: moving files with the SHFileOperation-Api didn't update the vfs correctly (still not perfect but better)
- bugfix: attempt to remove the deleter-file seems to have caused error messages for some users
- bugfix: fixed a couple of cases that might have caused the tutorial to hang
2014-09-08 20:37:23 +02:00
Tannin 84fe2b0307 - re-enabled building of loot_cli and started developing against the new api
- extended set of default categories
- more tolerand bbcode parser
- added a few colors for the bbcode parser
- more fixes to qt5 compatibility
- started work on ability to unloading (and thus re-loading) of plugins
- names of plugins are no longer localizable (because those names are also used to store settings)
- added settings to disable individual diagnosis settings
- path of dependencies is now configured in a .pri file instead of environment variablees
- bugfix: if the modid-input is canceled, the id was saved as -1 and wasn't re-requested from the user
- bugfix: moving files with the SHFileOperation-Api didn't update the vfs correctly (still not perfect but better)
- bugfix: attempt to remove the deleter-file seems to have caused error messages for some users
- bugfix: fixed a couple of cases that might have caused the tutorial to hang
2014-09-08 20:37:23 +02:00
Tannin e7e686c361 - can now filter by mod content
- all files/directories that require write access can now be placed in AppData instead of the MO directory
2014-08-18 23:00:25 +02:00
Tannin ae8b6a39b0 - browser dialog now has a hidden url-field (for testing only)
- loot_cli is no longer part of this project. I will probably create a fork of loot that allows command-line usage instead
- loot integration now works with such a modified loot version
- integrated loot will now also integrate incompatibility messages in the MO UI
- overwrite-markers are now updated as the list order is changed
- fnis checker will now always allow the user to ignore fnis errors
- plugin interface now has a function to wait for handles returned from startApplication (which can be job or process handles)
- bugfix: non-mo mods sharing the name with regular mods now have a different internal name
- bugfix: using hotkeys the vanilla game-plugins could be moved
2014-07-27 18:34:32 +02:00
TheBloke 2dc9463951 pythonRunner.pro - formatting/consistency fixes
Same types of fixes as previous commit; missed this file.
2014-07-08 00:28:06 +01:00
TheBloke 1d4a4b485d .pro files - formatting/consistency fixes
Many small formatting changes to the majority of .pro files
 Consistent style for Qt version checking, using greaterThan(QT_MAJOR_VERSION, 4)
  This seems safest, as would continue to work for a future Qt 6 etc.
  Note that this makes redudundant the commit before this one, to organizer.pro
 Consistent indenting
 Moved some file configuration sections to be together with related sections
 Moved some installation-related sections (e.g. OUTDIR/DSTDIR) to be at the bottom,
  immediately before the related POST_LINK install lines.
 Similarly, in some cases separated out CONFIG(debug,.. checks into separate
  LIB/INCLUDE sections (high in file) and installation directory sections (low
   in file)
2014-07-07 23:32:18 +01:00
8 changed files with 102 additions and 88 deletions
+6 -8
View File
@@ -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)
+16 -15
View File
@@ -37,7 +37,7 @@ const char *ProxyPython::s_DownloadPythonURL = "http://www.python.org/download/r
HMODULE GetOwnModuleHandle()
{
HMODULE hMod = NULL;
HMODULE hMod = nullptr;
GetModuleHandleExW(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT,
reinterpret_cast<LPCWSTR>(&GetOwnModuleHandle), &hMod);
@@ -50,12 +50,12 @@ QString ExtractResource(WORD resourceID, const QString &szFilename)
HMODULE mod = GetOwnModuleHandle();
HRSRC hResource = FindResourceW(mod, MAKEINTRESOURCE(resourceID), L"BINARY");
if (hResource == NULL) {
if (hResource == nullptr) {
throw MyException("embedded dll not available: " + windowsErrorString(::GetLastError()));
}
HGLOBAL hFileResource = LoadResource(mod, hResource);
if (hFileResource == NULL) {
if (hFileResource == nullptr) {
throw MyException("failed to load embedded dll resource: " + windowsErrorString(::GetLastError()));
}
@@ -64,8 +64,8 @@ QString ExtractResource(WORD resourceID, const QString &szFilename)
QString outFile = QDir::tempPath() + "/" + szFilename;
HANDLE hFile = CreateFileW(ToWString(outFile).c_str(), GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
HANDLE hFileMap = CreateFileMapping(hFile, NULL, PAGE_READWRITE, 0, dwSize, NULL);
HANDLE hFile = CreateFileW(outFile.toStdWString().c_str(), GENERIC_READ | GENERIC_WRITE, 0, nullptr, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, nullptr);
HANDLE hFileMap = CreateFileMapping(hFile, nullptr, PAGE_READWRITE, 0, dwSize, nullptr);
LPVOID lpAddress = MapViewOfFile(hFileMap, FILE_MAP_WRITE, 0, 0, 0);
CopyMemory(lpAddress, lpFile, dwSize);
@@ -73,6 +73,7 @@ QString ExtractResource(WORD resourceID, const QString &szFilename)
UnmapViewOfFile(lpAddress);
CloseHandle(hFileMap);
::FlushFileBuffers(hFile);
CloseHandle(hFile);
return outFile;
@@ -80,7 +81,7 @@ QString ExtractResource(WORD resourceID, const QString &szFilename)
ProxyPython::ProxyPython()
: m_MOInfo(NULL), m_Runner(NULL), m_LoadFailure(FAIL_NOTINIT)
: m_MOInfo(nullptr), m_Runner(nullptr), m_LoadFailure(FAIL_NOTINIT)
{
}
@@ -118,9 +119,9 @@ bool ProxyPython::init(IOrganizer *moInfo)
m_TempRunnerFile = ExtractResource(IDR_LOADER_DLL, "__pythonRunner.dll");
m_RunnerLib = ::LoadLibraryW(ToWString(m_TempRunnerFile).c_str());
if (m_RunnerLib != NULL) {
if (m_RunnerLib != nullptr) {
CreatePythonRunner_func CreatePythonRunner = (CreatePythonRunner_func)::GetProcAddress(m_RunnerLib, "CreatePythonRunner");
if (CreatePythonRunner == NULL) {
if (CreatePythonRunner == nullptr) {
throw MyException("embedded dll is invalid: " + windowsErrorString(::GetLastError()));
}
if (m_MOInfo->persistent(name(), "tryInit", false).toBool()) {
@@ -145,7 +146,7 @@ bool ProxyPython::init(IOrganizer *moInfo)
m_Runner = CreatePythonRunner(moInfo, pythonPath);
m_MOInfo->setPersistent(name(), "tryInit", false);
if (m_Runner != NULL) {
if (m_Runner != nullptr) {
m_LoadFailure = FAIL_NONE;
} else {
m_LoadFailure = FAIL_INITFAIL;
@@ -153,7 +154,7 @@ bool ProxyPython::init(IOrganizer *moInfo)
return true;
} else {
DWORD error = ::GetLastError();
qCritical("Failed to load python runner: %s", qPrintable(windowsErrorString(error)));
qCritical("Failed to load python runner (%s): %s", qPrintable(m_TempRunnerFile), qPrintable(windowsErrorString(error)));
if (error == ERROR_MOD_NOT_FOUND) {
m_LoadFailure = FAIL_MISSINGDEPENDENCIES;
}
@@ -163,7 +164,7 @@ bool ProxyPython::init(IOrganizer *moInfo)
QString ProxyPython::name() const
{
return tr("Python Proxy");
return "Python Proxy";
}
QString ProxyPython::author() const
@@ -209,11 +210,11 @@ QStringList ProxyPython::pluginList(const QString &pluginPath) const
QObject *ProxyPython::instantiate(const QString &pluginName)
{
if (m_Runner != NULL) {
if (m_Runner != nullptr) {
QObject *result = m_Runner->instantiate(pluginName);
return result;
} else {
return NULL;
return nullptr;
}
}
@@ -231,7 +232,7 @@ std::vector<unsigned int> ProxyPython::activeProblems() const
result.push_back(PROBLEM_INITFAIL);
} else if (m_LoadFailure == FAIL_SEMICOLON) {
result.push_back(PROBLEM_SEMICOLON);
} else if (m_Runner != NULL) {
} else if (m_Runner != nullptr) {
if (!m_Runner->isPythonInstalled()) {
// don't know how this could happen but wth
result.push_back(PROBLEM_PYTHONMISSING);
@@ -317,7 +318,7 @@ bool ProxyPython::hasGuidedFix(unsigned int key) const
void ProxyPython::startGuidedFix(unsigned int key) const
{
if ((key == PROBLEM_PYTHONMISSING) || (key == PROBLEM_PYTHONWRONGVERSION)) {
::ShellExecuteA(NULL, "open", s_DownloadPythonURL, NULL, NULL, SW_SHOWNORMAL);
::ShellExecuteA(nullptr, "open", s_DownloadPythonURL, nullptr, nullptr, SW_SHOWNORMAL);
}
}
+2
View File
@@ -1,4 +1,6 @@
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#endif
#include <QString>
#include <utility.h>
+14 -15
View File
@@ -1,4 +1,3 @@
#define HAVE_ROUND
#include "proxypluginwrappers.h"
#include <utility.h>
#include "error.h"
@@ -27,63 +26,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 +117,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 +152,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 +188,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;
}
-1
View File
@@ -5,7 +5,6 @@
#include <iplugintool.h>
#include <iplugininstallersimple.h>
#include <iplugininstallercustom.h>
#include <iplugindiagnose.h>
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
+17 -13
View File
@@ -13,7 +13,12 @@ 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 HAVE_ROUND
!include(../LocalPaths.pri) {
message("paths to required libraries need to be set up in LocalPaths.pri")
}
SOURCES += pythonrunner.cpp \
gilock.cpp \
@@ -28,29 +33,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)
+37 -33
View File
@@ -1,11 +1,8 @@
#define HAVE_ROUND
#include "pythonrunner.h"
#pragma warning( disable : 4100 )
#pragma warning( disable : 4996 )
#include <boost/python.hpp>
#include <iplugininstaller.h>
#include "uibasewrappers.h"
#include "pythonpluginwrapper.h"
@@ -23,7 +20,7 @@
#endif
MOBase::IOrganizer *s_Organizer = NULL;
MOBase::IOrganizer *s_Organizer = nullptr;
@@ -56,7 +53,7 @@ IPythonRunner *CreatePythonRunner(MOBase::IOrganizer *moInfo, const QString &pyt
return result;
} else {
delete result;
return NULL;
return nullptr;
}
}
@@ -104,13 +101,13 @@ struct QString_from_python_str
}
static void *convertible(PyObject *objPtr) {
return PyString_Check(objPtr) ? objPtr : NULL;
return PyString_Check(objPtr) ? objPtr : nullptr;
}
static void construct(PyObject *objPtr, bpy::converter::rvalue_from_python_stage1_data *data) {
// Extract the character data from the python string
const char* value = PyString_AsString(objPtr);
assert(value != NULL);
assert(value != nullptr);
// allocate storage
void *storage = ((bpy::converter::rvalue_from_python_storage<QString>*)data)->storage.bytes;
@@ -147,7 +144,7 @@ struct GuessedValue_converters
if PyList_Check(objPtr) {
return objPtr;
} else {
return NULL;
return nullptr;
}
}
@@ -218,7 +215,7 @@ struct QVariant_from_python_obj
static void *convertible(PyObject *objPtr) {
if (!PyString_Check(objPtr) && !PyInt_Check(objPtr) &&
!PyBool_Check(objPtr) && !PyList_Check(objPtr)) {
return NULL;
return nullptr;
}
return objPtr;
}
@@ -311,7 +308,7 @@ struct QList_from_python_obj
static void* convertible(PyObject *objPtr) {
if (PyList_Check(objPtr)) return objPtr;
return NULL;
return nullptr;
}
static void construct(PyObject *objPtr, bpy::converter::rvalue_from_python_stage1_data *data) {
@@ -340,7 +337,7 @@ struct stdset_from_python_list
static void* convertible(PyObject *objPtr) {
if (PyList_Check(objPtr)) return objPtr;
return NULL;
return nullptr;
}
static void construct(PyObject *objPtr, bpy::converter::rvalue_from_python_stage1_data *data) {
@@ -360,8 +357,8 @@ struct stdset_from_python_list
static const sipAPIDef *sipAPI()
{
static const sipAPIDef *sipApi = NULL;
if (sipApi == NULL) {
static const sipAPIDef *sipApi = nullptr;
if (sipApi == nullptr) {
sipApi = (const sipAPIDef *)PyCapsule_Import("sip._C_API", 0);
}
@@ -394,19 +391,19 @@ template <> struct MetaData<QVariant> { static const char *className() { return
template <typename T>
PyObject *toPyQt(T *objPtr)
{
if (objPtr == NULL) {
if (objPtr == nullptr) {
qDebug("no input object");
return bpy::incref(Py_None);
}
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
if (type == NULL) {
if (type == nullptr) {
qDebug("failed to determine type: %s", MetaData<T>::className());
return bpy::incref(Py_None);
}
PyObject *sipObj = sipAPI()->api_convert_from_type(objPtr, type, 0);
if (sipObj == NULL) {
if (sipObj == nullptr) {
qDebug("failed to convert");
return bpy::incref(Py_None);
}
@@ -421,12 +418,12 @@ struct QClass_converters
{
static PyObject *convert(const T &object) {
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
if (type == NULL) {
if (type == nullptr) {
return bpy::incref(Py_None);
}
PyObject *sipObj = sipAPI()->api_convert_from_type((void*)(&object), type, 0);
if (sipObj == NULL) {
if (sipObj == nullptr) {
return bpy::incref(Py_None);
}
@@ -434,17 +431,17 @@ struct QClass_converters
}
static PyObject *convert(T *object) {
if (object == NULL) {
if (object == nullptr) {
return bpy::incref(Py_None);
}
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
if (type == NULL) {
if (type == nullptr) {
return bpy::incref(Py_None);
}
PyObject *sipObj = sipAPI()->api_convert_from_type(object, type, 0);
if (sipObj == NULL) {
if (sipObj == nullptr) {
return bpy::incref(Py_None);
}
@@ -485,12 +482,12 @@ struct QInterface_converters
{
static PyObject *convert(const T &object) {
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
if (type == NULL) {
if (type == nullptr) {
return bpy::incref(Py_None);
}
PyObject *sipObj = sipAPI()->api_convert_from_type((void*)(&object), type, 0);
if (sipObj == NULL) {
if (sipObj == nullptr) {
return bpy::incref(Py_None);
}
@@ -498,17 +495,17 @@ struct QInterface_converters
}
static PyObject *convert(T *object) {
if (object == NULL) {
if (object == nullptr) {
return bpy::incref(Py_None);
}
const sipTypeDef *type = sipAPI()->api_find_type(MetaData<T>::className());
if (type == NULL) {
if (type == nullptr) {
return bpy::incref(Py_None);
}
PyObject *sipObj = sipAPI()->api_convert_from_type(object, type, 0);
if (sipObj == NULL) {
if (sipObj == nullptr) {
return bpy::incref(Py_None);
}
@@ -580,7 +577,7 @@ struct Functor0_converter
{
if (!PyCallable_Check(object)
|| (getArgCount(object) != 0)) {
return NULL;
return nullptr;
}
return object;
}
@@ -621,7 +618,7 @@ struct Functor2_converter
{
if (!PyCallable_Check(object)
|| (getArgCount(object) != 2)) {
return NULL;
return nullptr;
}
return object;
}
@@ -726,7 +723,9 @@ 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("onFinishedRun", bpy::pure_virtual(&IOrganizer::onFinishedRun))
.def("onModInstalled", bpy::pure_virtual(&IOrganizer::onModInstalled))
.def("refreshModList", bpy::pure_virtual(&IOrganizer::refreshModList))
;
@@ -805,6 +804,7 @@ 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))
@@ -813,6 +813,7 @@ BOOST_PYTHON_MODULE(mobase)
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))
@@ -838,7 +839,7 @@ PythonRunner::PythonRunner(const MOBase::IOrganizer *moInfo)
m_PythonHome = new char[MAX_PATH + 1];
}
static char* argv0 = "ModOrganizer.exe";
static const char *argv0 = "ModOrganizer.exe";
bool PythonRunner::initPython(const QString &pythonPath)
@@ -852,7 +853,10 @@ bool PythonRunner::initPython(const QString &pythonPath)
Py_SetPythonHome(m_PythonHome);
}
Py_SetProgramName(argv0);
char argBuffer[MAX_PATH];
strcpy(argBuffer, argv0);
Py_SetProgramName(argBuffer);
PyImport_AppendInittab("mobase", &initmobase);
Py_OptimizeFlag = 2;
Py_NoSiteFlag = 1;
@@ -862,7 +866,7 @@ bool PythonRunner::initPython(const QString &pythonPath)
return false;
}
PySys_SetArgv(0, &argv0);
PySys_SetArgv(0, (char**)&argBuffer);
bpy::object mainModule = bpy::import("__main__");
bpy::object mainNamespace = mainModule.attr("__dict__");
@@ -934,7 +938,7 @@ QObject *PythonRunner::instantiate(const QString &pluginName)
std::string temp = ToString(pluginName);
if (handled_exec_file(temp.c_str(), moduleNamespace)) {
reportPythonError();
return NULL;
return nullptr;
}
m_PythonObjects[pluginName] = moduleNamespace["createPlugin"]();
@@ -945,7 +949,7 @@ QObject *PythonRunner::instantiate(const QString &pluginName)
qWarning("failed to run python script \"%s\"", qPrintable(pluginName));
reportPythonError();
}
return NULL;
return nullptr;
}
bool PythonRunner::isPythonInstalled() const
+10 -3
View File
@@ -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,10 +221,13 @@ 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("getFileOrigins")(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 = nullptr) 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 onFinishedRun(const std::function<void(const QString&, unsigned int)> &func) { return this->get_override("onFinishedRun")(func); }
virtual bool onModInstalled(const std::function<void(const QString&)> &func) { return this->get_override("onModInstalled")(func); }
};
@@ -265,6 +269,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,6 +281,7 @@ 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); }
@@ -283,9 +289,10 @@ struct IPluginListWrapper: MOBase::IPluginList, boost::python::wrapper<MOBase::I
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); }
};