Compare commits

..
Author SHA1 Message Date
Tom Tanner 25ac05622a Small fix to shut up messages about long boost names 2015-08-20 19:53:39 +01:00
Tannin f29d9ac993 added plugin interface to add/remove/list categories to/from/of mods 2015-06-10 22:09:32 +02:00
Tom Tanner d8f49b3906 Update scons build 2015-05-28 20:42:15 +01:00
Tannin 25d9ad16c2 python runner is now bundled with MO as a separate file instead of embedded in the plugin 2015-05-24 18:44:57 +02:00
Tannin a5901d7975 extended plugin interface. Plugins can now activate/deactivate mods, install mods
suggesting a name and retrieve a list of all installed mods
2015-05-17 14:30:14 +02:00
Tannin a7b81418a5 fixes to make MO compile with mingw (also fixes some warnings generated by mingw) 2015-05-16 18:44:07 +02:00
Tannin 560e1ce0c7 Merge 2015-05-09 21:46:40 +02:00
Tannin 6edbec745d plugin can now have multiple states 2015-03-31 18:35:12 +02:00
Tom Tanner d6edcf4fa0 Adding an icon to nxmhandler so that it looks pretty in firefox 2015-03-28 10:39:40 +00:00
Tannin 50a725a1b4 Merge in changes by Tom Tanner 2015-03-27 18:24:37 +01:00
Tom Tanner a1fdb54471 Add in all the necessary stuff for scons 2015-03-25 22:35:53 +00:00
Tom Tanner e602014dda Fix a meory leak with modules that error during loading
More Sconscript stuff
2015-03-22 10:49:15 +00:00
Tom Tanner 90df417a8c Fixed Scons build for existing bits.
Changed pynedit.pro to fetch from 'standard' install location
Changed saveas code to use organizer report rather than uibase - this way it's
not dependant on the vagaries of the include path, and works the same as the
rest of the organiser directory
2015-03-20 10:34:30 +00:00
Tom Tanner cb9a7fcd2d Merge with branch1.2 2015-03-18 17:40:29 +00:00
Tom Tanner 9d2264aff8 Refactoring and cleanup. 2015-03-18 14:16:04 +00:00
Tom Tanner 0aeeb9365f Every plugin now built 2015-03-17 16:31:15 +00:00
Tom Tanner 3967d64437 Cleanup 2015-03-16 08:35:14 +00:00
Tom Tanner a7e881869e Yet more scons stuff. Now builds everything but the plugins, and installs all the dlls 2015-03-15 10:58:21 +00:00
Tom Tanner 3f66d206e8 More sconscripts set up 2015-03-14 14:59:52 +00:00
Tannin 9d48b75388 python proxy plugin should no longer throw a fit if another process locks the unpacked pythonrunner 2015-02-25 18:13:17 +01:00
Tannin 841b923751 better error handling in python runner extraction 2015-01-29 19:28:58 +01:00
Tannin 23fd430605 extended the game-plugin interface 2015-01-29 19:26:42 +01:00
Tannin 1a89e42c0f Merge with branch1.2 2015-01-24 19:34:12 +01:00
Tannin 42afc90c8d cleanup (mostly removing unused includes) 2015-01-22 19:44:38 +01:00
Tannin 9b989e9f97 bugfix: translations for some plugins weren't loaded 2015-01-11 11:14:58 +01:00
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
Tannin d5838c7560 - added pseudo-categories to filter for mo-managed vs. unmanaged mods
- deleted mods are now moved to the recycle bin instead of being deleted permanently
- reduced modinfo dialog for foreign mods
- foreign mods are now displayed with a pseudo-category
- added a signal when a plugin is moved
- bugfix: refreshing of directory structure for mods with bsas didn't work correctly when enabling a mod and on changing display of foreign mods
- bugfix: one mod in the list was assigned the same priority on the directory structure as the data directory
- bugfix: conflicts tab in the mod info dialog offered the hide option for files in bsas
2014-06-16 21:49:57 +02:00
Tannin 9cbf374166 - loot client now only updates the masterlist once per MO session
- new event to notify plugins of changed mod priority
- overwrite now shows up in the "checked" category instead of "unchecked"
- display of "foreign" mods can now be limited to only official content
- bugfix: bsa extraction dialog showed up even if the plugin was disabled
- bugfix: after detection of foreign mods the priority of the overwrite folder could get messed up
- bugfix: when displaying only the context menu for the mod list as a whole, the menu didn't disappear
- bugfix: MO crashed when trying to download via the integrated browser
2014-06-08 15:10:08 +02:00
Tannin f71bfff0e6 Merge 2014-05-28 14:23:11 +02:00
Tannin 8aa2ab4eac small bugfixes 2014-05-28 14:14:28 +02:00
Tannin 46a0ce9e38 - files in bsas are now only displayed in the data tab if they are managed by mo
- number of problems detected by MO is now displayed as a badge on the icon
- rephrased the explanation text on the Archives tab. unchecked plugin-loaded bsas no longer prompt a warning
- bsa extraction is now handled in a plugin
- added a way for plugins to react to mod installation
- re-enabled the automatic fix for asset order problems
- bugfix: In some cases when a download wasn't started successfully the download urls weren't stored in the meta file so no resume was possible
- bugfix: MO tried to resume downloads when it didn't have and download urls
- bugfix: downloads couldn't be paused if the download was already broken on the network layer
- bugfix: download managear did not recognize a file as downloaded if the download completed before signals were hooked up
- bugfix: in-place file replacement was re-broken
2014-05-25 15:39:45 +02:00
Tannin 15e635741c - mod list context menu split into two menus (one for whole list, one for selected mods)
- added option to combine category filters using "or"
- added context menu option for deselecting category filters
- slightly changed ui on the category filters
- added a sample plugin for cpp that can be built without building the rest of MO
- simple installer can now be configured to run without any user interaction
- extended interface for python plugins
- iorganizer implementation moved out of the main window
- nexus requests from plugins will now be identified in the user agent
- bugfix: shortcuts created from MO used the wrong working directory
- bugfix: deactivation of bsas didn't stick
- bugfix: file hiding mechanism wasn't active
- bugfix: executables linked on the toolbar couldn't be removed if the executable was removed first
- bugfix: the endorsement-filter couldn't be combined with other filters
- bugfix: python interface to repository bridge was broken
2014-05-13 21:20:44 +02:00
Tannin f56c605479 - bugfix: endless loop in detection of mod order problems 2014-05-04 16:13:35 +02:00
Tannin 617c76e9f8 - main window now has a small view displaying log messages
- mod list will now be highlighted when grouping is active is active
- download tooltip now supports bbcode markup in the description
- bbcode translator will now translate some named colors
- algorithm for detection of mod order problems is now more sophisticated
- exposed more functionality to python plugins
- updated to qt 4.8.6 dlls
- bugfix: plugin list wasn't
- bugfix: state changes in mod list wasn't always reported
- bugfix: loot client will now create necessary directory
- bugfix: NCC sometimes used wrong source path for extracting
- bugfix: removed noisy debug message
2014-05-04 14:50:01 +02:00
Tannin 96081888f1 Merge with branch1.1 2014-04-05 15:36:42 +02:00
Tannin af5958b0af some fixes towards qt5 compatibility 2014-03-16 20:04:57 +01:00
Tannin b33293e49a - bugfix: elevation dialog didn't offer a "yes" option
- bugfix: python plugins crashed the application when trying to create a nexus bridge
- bugfix: python plugins couldn't register for failed requests correctly
2014-01-29 21:06:55 +01:00
Tannin dc3b60e578 - bugfix: accessing profile without loading one when starting an app through the commandline
- bugfix: locked-dialog was disabled
2014-01-27 21:31:10 +01:00
Tannin d591bc017a Merge with default 2013-12-07 16:55:19 +01:00
Tannin aad5864192 minor text changes 2013-12-07 14:23:51 +01:00
Tannin 7deee938d3 - bugfix: installFile for mods was not a relative path if the downloads directory was non-default
- bugfix: crash after removing the last profile in the list (ordered alphabetically)
- improved subdirs ordering to ensure pythonrunner is compiled before pythonproxy
- translation files for plugins are now generated
- set some texts as un-translatable where it made no sense
- staging script now re-builds MO completely before packaging
- updated qt libraries for packaging to 4.8.5
- added python to the package
2013-11-22 17:45:34 +01:00
Tannin 5d51b2bcc6 added some files missing from the previous commit 2013-11-18 22:03:23 +01:00
Tannin 0566a968e8 - archive.dll now supports querying the crc value of files
- esptk now determines if a esp is a dummy (without records)
- hook.dll no longer creates a log file if noone wrote to it
- nexus id and installtime columns are now hidden by default
- modlist can now be refreshed without saving first (so plugins can replace the modlist.txt as a whole)
- plugins can now query more details about virtualised files
- added style options "plastique" and "cleanlooks"
- "overwrite" is no longer listed with a creation time
- a warning will now be displayed if the user has too many plugins active
- a warning will now be displayed if mods with scripts have an installation order that doesn't match the corresponding esp load order
- nmm importer now has select all/deselect all buttons
- nmm importer no longer tries to unpack missing files from archives (won't work anyway)
- initial support for importing from nmm 0.5 alpha
- removed some broken warning suppresions
- python runner now works with bundled python
- extended qbs build system (still fails to build the main gui application)
- implemented a nsis-based installer
2013-11-18 20:17:14 +01:00
Tannin 14fc674d72 - diagnosis plugins can now request to be re-evaluated
- main application now contains means for plugins to react on some changes (to be extended)
- plugins can now retrieve more information about a mod
- user-agent sent to nexus now automatically contains the current MO version
- included updated russian translation
- problems dialog now refreshes itself after a fix was applied
- fixed new esp/asset ordering diagnosis. May be fully functional now
- bugfix: restoring locked load order could leave MO in an endless loop (not sure if this fix is correct yet)
- bugfix: plugin list was not visually updated after some changes
- bugfix: nmm importer threw away mod ordering
2013-11-06 18:35:27 +01:00
Tannin b7cbdaad1e - added a new diagnosis to detect potential problems in regards to esp vs. asset ordering (not fully functional yet)
- new plugin interfaces to the mod list
- plugins can now query the origin (mod) of a esp/esm
- bugfix: potential access to profile before one was activated
- bugfix: regression in previous (not-yet-released) commit prevented changes to bsa list from being saved
2013-11-01 14:59:25 +01:00
Tannin 25cdcdd2fe - plugin (esp/esm) list is now exposed to plugins (read-only functionality right now)
- integrated fomod installer now supports file dependencies
- bugfix: integrated fomod installer crashed if the installer had no optiosn´´ns
2013-10-16 23:04:03 +02:00
Tannin f06a6d4e55 - added new plugin to test if fnis needs to be run
- some functionality to the plugin interface to enable them to search for files&directories in the virtual FS (rudimentary atm)
- functionality for plugins to react to application being started from MO
- broken ESPs are no longer reported as popup windows but only in the log file
- bugfix: plugins couldn't store persistent data if they had no user-editable settings
2013-10-11 23:03:49 +02:00
Tannin ceab36e5f0 - download progress is now visible in task bar
- esp-tooltip now lists all masters, highlighting the missing ones
- python plugin will now report a problem if the path contains a semicolon
- leak detection now (somewaht) works around the fact that we don't always get a stack trace
- bugfix: mod meta-file is now reliably created if it was missing
- bugfix: parser for nxm-links didn't handle numbers in the mod name
- bugfix: small memory leak
2013-09-28 21:13:57 +02:00
Tannin e158038cfc - esp reader now handles invalid files more gracefully
- files moved will now also be treated as "deleted" in the old location so a newly created file with that same name is not created in overwrite
- introduced a mechanism by which MO can recognize if it crashed before when attempting to load a plugin. That plugin can be blacklisted so it doesn't get loaded again
- plugins can now programaticaly change their settings
- plugins can now store data persistently without exposing that data as settings
- requesting an unset-setting from a plugin is no longer treated as a bug
- clarified warning message for when files are in overwrite directory
- the proxyPython plugin will now discover if python initialization crashed MO on a previous session and give the user a chance to fix it or disable the plugin
- bugfix: GetModuleFileName modified the buffer past the zero termination. While this doesn't violate the API documentation it is different from the regular windows implementation
- bugfix: proxy plugins couldn't access the parent widget
- bugfix: when moving a file from overwrite to a mod the in-memory file structure wasn't updated
- bugfix: name input dialog for profiles allowed names that weren't valid directory names
- bugfix: profile dialog wasn't able to delete profiles if the name started or ended in whitespaces
- bugfix: The name-cells for plugin settings could be changed (without effect)
- removed a few obsolete files from the repository
2013-09-21 19:25:33 +02:00
Tannin d4c424911a - bugfix: testing for missing masters at the wrong time seems to have caused crashes
- bugfix: mod list is now written to a temporary file first. Only on success is the original file overwritten
- bugfix: moving a mod priority to just above the overwrite could cause a crash or error message
- bugfix: versions with a release candidate number weren't sorted correctly (woops)
- bugfix: staging script didn't include archive.dll and dlls.manifest
- installation time on overwrite no longer updates constantly
2013-09-16 22:32:42 +02:00
Tannin fee774db45 - added support for mod page plugins
- re-introduced the integrated browser
- added a plugin to download from the tes alliance page
- the download list now contains the file description
- nexus interface now stores cookies persistently to reduce number of required log-ins
2013-09-15 15:20:00 +02:00
Tannin b9c2a18f86 updated versions 2013-09-05 21:14:08 +02:00
Tannin 224627515a - bugfix: automatically removes a file from old NCC release that was interfering with the current version
- bugfix: fomod installer didn't find fomod files in nested folder
- bugfix: python proxy will now not even try to initialize python if python_dir contains no python.
This is necessary because the python interpreter crashes the application if the path is invalid
2013-09-05 21:04:20 +02:00
Tannin 6d99b33c61 - separated python proxy into two dlls. One is a wrapper without external
dependencies that fulfills the plugin interface. The other contains the actual python
functionality. This way the outer dll can always be loaded and report issues.
- The build process embeds the second dll into the first, this way only one dll has to be shipped
2013-09-01 18:36:43 +02:00
26 changed files with 2336 additions and 960 deletions
-52
View File
@@ -1,52 +0,0 @@
%Import QtCore/QtCoremod.sip
%Import QtGui/QtGuimod.sip
namespace MOBase
{
class ModRepositoryFileInfo
{
%TypeHeaderCode
#include <imodrepositorybridge.h>
%End
public:
ModRepositoryFileInfo();
ModRepositoryFileInfo(const QString &data);
~ModRepositoryFileInfo();
QString toString() const;
};
class IModRepositoryBridge : QObject
{
%TypeHeaderCode
#include <imodrepositorybridge.h>
%End
public:
virtual void requestDescription(int modID, QVariant userData) = 0;
virtual void requestFiles(int modID, QVariant userData) = 0;
virtual void requestFileInfo(int modID, int fileID, QVariant userData) = 0;
virtual void requestDownloadURL(int modID, int fileID, QVariant userData) = 0;
virtual void requestToggleEndorsement(int modID, bool endorse, QVariant userData) = 0;
signals:
void descriptionAvailable(int modID, QVariant userData, QVariant resultData);
void filesAvailable(int modID, QVariant userData, const QList<MOBase::ModRepositoryFileInfo> &resultData);
void fileInfoAvailable(int modID, int fileID, QVariant userData, QVariant resultData);
void downloadURLsAvailable(int modID, int fileID, QVariant userData, QVariant resultData);
void endorsementToggled(int modID, QVariant userData, QVariant resultData);
void requestFailed(int modID, QVariant userData, const QString &errorMessage);
};
};
+32
View File
@@ -0,0 +1,32 @@
import os
Import('qt_env')
env = qt_env.Clone()
env.AppendUnique(CPPDEFINES = [
'PROXYPYTHON_LIBRARY',
# suppress a few warnings caused by boost vs vc++ paranoia
'_SCL_SECURE_NO_WARNINGS'
])
env.AppendUnique(CPPPATH = [
'${BOOSTPATH}',
'..\\..\\pythonRunner'
])
env.AppendUnique(LIBS = 'shell32')
runner = env.File(os.path.join('..', '..', 'pythonRunner', 'pythonRunner.dll'))
runner_env = env.Clone()
runner_env.AppendUnique(CPPDEFINES = 'SCONS_BUILD')
runner_env.AppendUnique(CPPPATH = runner.dir)
# There's a whole load of unused C++ files in here.
lib = env.SharedLibrary('proxyPython', [ 'proxypython.cpp' ])
env.InstallModule(lib)
res = env['QT_USED_MODULES']
Return('res')
+11
View File
@@ -0,0 +1,11 @@
#include "resource.h"
#ifdef SCONS_BUILD
IDR_LOADER_DLL BINARY MOVEABLE PURE pythonRunner.dll
#else
#ifdef _DEBUG
IDR_LOADER_DLL BINARY MOVEABLE PURE "..\\..\\pythonRunner\\debug\\pythonRunner.dll"
#else // _DEBUG
IDR_LOADER_DLL BINARY MOVEABLE PURE "..\\..\\pythonRunner\\release\\pythonRunner.dll"
#endif // _DEBUG
#endif
-3
View File
@@ -1,3 +0,0 @@
%Module interfaces
%Include INexusBridge.sip
+15 -28
View File
@@ -8,13 +8,10 @@
TARGET = proxyPython
TEMPLATE = lib
contains(QT_VERSION, "^5.*") {
QT += widgets
}
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
CONFIG += plugins
CONFIG += dll
CONFIG += warn_on
CONFIG(release, debug|release) {
QMAKE_CXXFLAGS += /Zi
@@ -23,39 +20,29 @@ CONFIG(release, debug|release) {
DEFINES += PROXYPYTHON_LIBRARY
INCLUDEPATH += "$(BOOSTPATH)" "$$(PYTHONPATH)/include" "$$(PYTHONPATH)/Lib/site-packages/PyQt4/include"
# INCLUDEPATH += "$$(SIPPATH)/siplib"
SOURCES += proxypython.cpp \
proxypluginwrappers.cpp \
error.cpp \
gilock.cpp
# suppress a few warnings caused by boost vs vc++ paranoia
DEFINES += _SCL_SECURE_NO_WARNINGS
SOURCES += proxypython.cpp
HEADERS += proxypython.h \
proxypluginwrappers.h \
uibasewrappers.h \
error.h \
gilock.h
resource.h
LIBS += -L"$$(PYTHONPATH)/libs" -L"$(BOOSTPATH)/stage/lib" -lpython27
OTHER_FILES += \
proxypython.json \
SConscript
RC_FILE +=
include(../plugin_template.pri)
OTHER_FILES += \
INexusBridge.sip \
interfaces.sip \
setup.py \
setup.cfg \
proxypython.json
INCLUDEPATH += "../../pythonRunner" "$${BOOSTPATH}"
WINPWD = $$PWD
WINPWD ~= s,/,$$QMAKE_DIR_SEP,g
#QMAKE_POST_LINK += SET VS90COMNTOOLS=%VS100COMNTOOLS% $$escape_expand(\\n)
SIPPATH=""
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\\ $$escape_expand(\\n)
QMAKE_POST_LINK += copy $$(PYTHONPATH)\\lib\\site-packages\\PyQt4\\QtGui.pyd $$quote($$DSTDIR)\\plugins\\data\\ $$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)
+208 -672
View File
File diff suppressed because it is too large Load Diff
+42 -16
View File
@@ -1,3 +1,22 @@
/*
Copyright (C) 2013 Sebastian Herbord. All rights reserved.
This file is part of python proxy plugin for MO
python proxy plugin is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Python proxy plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with python proxy plugin. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef PROXYPYTHON_H
#define PROXYPYTHON_H
@@ -6,13 +25,10 @@
#include <iplugindiagnose.h>
#include <map>
#include <Windows.h>
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#endif
#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)
@@ -22,6 +38,7 @@ class ProxyPython : public QObject, MOBase::IPluginProxy, MOBase::IPluginDiagnos
public:
ProxyPython();
~ProxyPython();
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
@@ -50,20 +67,29 @@ public: // IPluginDiagnose
private:
bool initPython();
bool isPythonInstalled() const;
bool isPythonVersionSupported() const;
private:
const MOBase::IOrganizer *m_MOInfo;
std::map<QString, boost::python::object> m_PythonObjects;
static const unsigned int PROBLEM_PYTHONMISSING = 1;
static const unsigned int PROBLEM_PYTHONWRONGVERSION = 2;
static const unsigned int PROBLEM_WRONGPYTHONPATH = 3;
static const unsigned int PROBLEM_INITFAIL = 4;
static const unsigned int PROBLEM_PYTHONDETECTION = 5;
static const unsigned int PROBLEM_SEMICOLON = 6;
static const char *s_DownloadPythonURL;
char *m_PythonHome;
MOBase::IOrganizer *m_MOInfo;
QString m_TempRunnerFile;
HMODULE m_RunnerLib;
IPythonRunner *m_Runner;
enum {
FAIL_NONE,
FAIL_SEMICOLON,
FAIL_NOTINIT,
FAIL_MISSINGDEPENDENCIES,
FAIL_INITFAIL,
FAIL_WRONGPYTHONPATH,
FAIL_PYTHONDETECTION,
FAIL_OTHER
} m_LoadFailure;
};
+6
View File
@@ -0,0 +1,6 @@
#ifndef RESOURCE_H
#define RESOURCE_H
#define IDR_LOADER_DLL 100
#endif // RESOURCE_H
-2
View File
@@ -1,2 +0,0 @@
[build_ext]
sip-opts = -e -g -I $$(PYTHONPATH)/Lib/site-packages/PyQt4/sip/PyQt4
-27
View File
@@ -1,27 +0,0 @@
from distutils.core import setup, Extension
import sipdistutils
import os, sys
path = os.path.dirname(sys.argv[0])
if len(path) > 0:
os.chdir(path)
os.environ['PATH'] += r";C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC"
print(os.environ['PATH'])
os.environ['VS90COMNTOOLS'] = os.environ['VS100COMNTOOLS']
setup(
name = 'interfaces',
versione = '1.0',
ext_modules=[
Extension("interfaces", [ "interfaces.sip" ],
include_dirs=[ r"C:\QtSDK\Desktop\Qt\4.8.4\include",
r"C:\QtSDK\Desktop\Qt\4.8.4\include\QtCore",
path + r"\..\..\uibase" ],
library_dirs=[ r"C:\QtSDK\Desktop\Qt\4.8.4\lib" ],
libraries=[ "QtCore4" ]
),
],
cmdclass = {'build_ext': sipdistutils.build_ext}
)
-159
View File
@@ -1,159 +0,0 @@
#ifndef UIBASEWRAPPERS_H
#define UIBASEWRAPPERS_H
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#endif
#include <QString>
#include <imoinfo.h>
#include <igameinfo.h>
#include <imodrepositorybridge.h>
#include "error.h"
#include "gilock.h"
extern MOBase::IOrganizer *s_Organizer;
using MOBase::ModRepositoryFileInfo;
/**
* @brief Wrapper class for the bridge to a mod repository. Awkward: This may be
* unnecessary but I didn't manage to figure out how to correctly connect python
* code to C++ signals
*/
class ModRepositoryBridgeWrapper : public QObject
{
Q_OBJECT
public:
ModRepositoryBridgeWrapper()
: m_Wrapped(s_Organizer->createNexusBridge())
{
}
ModRepositoryBridgeWrapper(MOBase::IModRepositoryBridge *wrapped)
: m_Wrapped(wrapped)
{
}
~ModRepositoryBridgeWrapper()
{
delete m_Wrapped;
}
void requestDescription(int modID, QVariant userData)
{ m_Wrapped->requestDescription(modID, userData); }
void requestFiles(int modID, QVariant userData)
{ m_Wrapped->requestFiles(modID, userData); }
void requestFileInfo(int modID, int fileID, QVariant 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)
{ m_Wrapped->requestToggleEndorsement(modID, endorse, userData); }
void onFilesAvailable(boost::python::object callback) {
m_FilesAvailableHandler = callback;
connect(m_Wrapped, SIGNAL(filesAvailable(int,QVariant,const QList<ModRepositoryFileInfo>&)),
this, SLOT(filesAvailable(int,QVariant,const QList<ModRepositoryFileInfo>&)),
Qt::UniqueConnection);
}
void onRequestFailed(boost::python::object callback) {
m_FailedHandler = callback;
connect(m_Wrapped, SIGNAL(requestFailed(int,QVariant,QString)),
this, SLOT(requestFailed(int,QVariant,QString)),
Qt::UniqueConnection);
}
private:
Q_DISABLE_COPY(ModRepositoryBridgeWrapper)
private slots:
void filesAvailable(int modID, QVariant userData, const QList<ModRepositoryFileInfo> &resultData)
{
if (m_FilesAvailableHandler.is_none()) {
qCritical("no handler connected");
return;
}
// try {
GILock lock;
m_FilesAvailableHandler(modID, userData, resultData);
// } catch (const boost::python::error_already_set&) {
// qDebug("error");
//reportPythonError();
// }
}
void requestFailed(int modID, QVariant userData, const QString &errorMessage)
{
try {
GILock lock;
m_FailedHandler(modID, userData, errorMessage);
} catch (const boost::python::error_already_set&) {
reportPythonError();
}
}
private:
MOBase::IModRepositoryBridge *m_Wrapped;
boost::python::object m_FilesAvailableHandler;
boost::python::object m_FailedHandler;
};
struct IOrganizerWrapper: MOBase::IOrganizer, boost::python::wrapper<MOBase::IOrganizer>
{
virtual MOBase::IGameInfo &gameInfo() const {
MOBase::IGameInfo *result = this->get_override("gameInfo")();
return *result;
}
virtual MOBase::IModRepositoryBridge *createNexusBridge() const {
return this->get_override("createNexusBridge")();
}
/*
static ModRepositoryBridgeWrapper newNexusBridge(IOrganizerWrapper *self) {
return ModRepositoryBridgeWrapper(self->createNexusBridge());
}*/
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 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); }
virtual bool removeMod(MOBase::IModInterface *mod) { return this->get_override("removeMod")(mod); }
virtual void modDataChanged(MOBase::IModInterface *mod) { this->get_override("modDataChanged")(mod); }
virtual QVariant pluginSetting(const QString &pluginName, const QString &key) const { return this->get_override("pluginSetting")(pluginName, key); }
virtual QString pluginDataPath() const { return this->get_override("pluginDataPath")(); }
virtual void installMod(const QString &fileName) { this->get_override("installMod")(fileName); }
virtual MOBase::IDownloadManager *downloadManager() { return this->get_override("downloadManager")(); }
virtual QString resolvePath(const QString &fileName) const { return this->get_override("resolvePath")(fileName); }
};
struct IDownloadManagerWrapper: MOBase::IDownloadManager, boost::python::wrapper<MOBase::IDownloadManager>
{
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 QString downloadPath(int id) { return this->get_override("downloadPath")(id); }
private:
boost::python::object m_DownloadCompleteHandler;
};
struct IGameInfoWrapper: MOBase::IGameInfo, boost::python::wrapper<MOBase::IGameInfo>
{
virtual Type type() const { return this->get_override("type")(); }
virtual QString path() const { return this->get_override("path")(); }
virtual QString binaryName() const { return this->get_override("binaryName")(); }
};
#endif // UIBASEWRAPPERS_H
+63
View File
@@ -0,0 +1,63 @@
Import('qt_env')
env = qt_env.Clone()
env.EnableQtModules('Core', 'Gui')
env.AppendUnique(CPPDEFINES = 'PYTHONRUNNER_LIBRARY')
# suppress a few warnings caused by boost vs vc++ paranoia
# NB HAVE_ROUND causes a warning because it's defined in pythonrunner.cpp
env.AppendUnique(CPPDEFINES = [
'_SCL_SECURE_NO_WARNINGS',
'HAVE_ROUND'
])
# Boost produces very long names with msvc truncates. Doesn't seem to cause
# problems.
env.AppendUnique(CPPFLAGS = [ '-wd4503' ])
# QMAKE_CXXFLAGS += /Zi
# QMAKE_LFLAGS += /DEBUG
env.RequireLibraries('uibase')
# AppendUnique appears not to work with QT4
env['CPPPATH'] += [
'${BOOSTPATH}',
'${PYTHONPATH}\\include',
]
env.AppendUnique(LIBS = [
'python27', # Could be done better
])
env.AppendUnique(LIBPATH = [
'${PYTHONPATH}/libs', # Could be done better
])
# We have to 'persuade' moc to generate certain other targets and inject them
# into the list of cpps
targets = env.AddExtraMoc(env.Glob('*.h'))
# pythontoolwrapper doesnt compile and isn't in the project file
cpp_files = [
x for x in Glob('*.cpp') if x.name != 'pythontoolwrapper.cpp'
]
lib = env.SharedLibrary('pythonRunner', cpp_files + targets)
env.InstallModule(lib, 'plugins/data')
# However...
# we do need boost-python and pythonvv.dll and pythonvv.zip (though the last
# isn't needed to just bring up the module)
#env.Pseudo('install')
#env.Depends('install',
# (env.Install('${INSTALL_PATH}', 'pyCfg.py'),
# env.Install(os.path.join('${INSTALL_PATH}', 'data'),
# ( ui, rc, 'settings.json' )),
# ))
res = env['QT_USED_MODULES']
Return('res')
@@ -1,5 +1,6 @@
#include "utility.h"
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#endif
#include <QString>
#include <utility.h>
+212
View File
@@ -0,0 +1,212 @@
#include "proxypluginwrappers.h"
#include <utility.h>
#include "error.h"
#include "gilock.h"
namespace bpy = boost::python;
using namespace MOBase;
#define PYCATCH catch (const bpy::error_already_set &) { reportPythonError(); throw MyException("unhandled exception"); }\
catch (...) { throw MyException("An unknown exception was thrown in python code"); }
/////////////////////////////
/// IPluginTool Wrapper
bool IPluginToolWrapper::init(MOBase::IOrganizer *moInfo)
{
try {
return this->get_override("init")(bpy::ptr(moInfo));
} PYCATCH;
}
QString IPluginToolWrapper::name() const
{
try {
return this->get_override("name")().as<QString>();
} PYCATCH;
}
QString IPluginToolWrapper::author() const
{
try {
return this->get_override("author")().as<QString>();
} PYCATCH;
}
QString IPluginToolWrapper::description() const
{
try {
return this->get_override("description")().as<QString>();
} PYCATCH;
}
MOBase::VersionInfo IPluginToolWrapper::version() const
{
try {
return this->get_override("version")().as<MOBase::VersionInfo>();
} PYCATCH;
}
bool IPluginToolWrapper::isActive() const
{
try {
return this->get_override("isActive")().as<bool>();
} PYCATCH;
}
QList<MOBase::PluginSetting> IPluginToolWrapper::settings() const
{
try {
return this->get_override("settings")().as<QList<MOBase::PluginSetting>>();
} PYCATCH;
}
QString IPluginToolWrapper::displayName() const
{
try {
return this->get_override("displayName")().as<QString>();
} PYCATCH;
}
QString IPluginToolWrapper::tooltip() const
{
try {
return this->get_override("tooltip")().as<QString>();
} PYCATCH;
}
QIcon IPluginToolWrapper::icon() const
{
try {
return this->get_override("icon")().as<QIcon>();
} PYCATCH;
}
void IPluginToolWrapper::setParentWidget(QWidget *parent)
{
try {
this->get_override("setParentWidget")(parent);
} PYCATCH;
}
void IPluginToolWrapper::display() const
{
try {
GILock lock;
this->get_override("display")();
} PYCATCH;
}
/// end IPluginTool Wrapper
/////////////////////////////////////
/// IPluginInstallerCustom Wrapper
bool IPluginInstallerCustomWrapper::init(MOBase::IOrganizer *moInfo)
{
try {
return this->get_override("init")(bpy::ptr(moInfo));
} PYCATCH;
}
QString IPluginInstallerCustomWrapper::name() const
{
try {
return this->get_override("name")().as<QString>();
} PYCATCH;
}
QString IPluginInstallerCustomWrapper::author() const
{
try {
return this->get_override("author")().as<QString>();
} PYCATCH;
}
QString IPluginInstallerCustomWrapper::description() const
{
try {
return this->get_override("description")().as<QString>();
} PYCATCH;
}
MOBase::VersionInfo IPluginInstallerCustomWrapper::version() const
{
try {
return this->get_override("version")();
} PYCATCH;
}
bool IPluginInstallerCustomWrapper::isActive() const
{
try {
return this->get_override("isActive")();
} PYCATCH;
}
QList<MOBase::PluginSetting> IPluginInstallerCustomWrapper::settings() const
{
try {
return this->get_override("settings")().as<QList<MOBase::PluginSetting>>();
} PYCATCH;
}
unsigned int IPluginInstallerCustomWrapper::priority() const
{
try {
return this->get_override("priority")();
} PYCATCH;
}
bool IPluginInstallerCustomWrapper::isManualInstaller() const
{
try {
return this->get_override("isManualInstaller")();
} PYCATCH;
}
bool IPluginInstallerCustomWrapper::isArchiveSupported(const DirectoryTree &) const
{
try {
//return this->get_override("isArchiveSupported")(tree);
return false;
} PYCATCH;
}
bool IPluginInstallerCustomWrapper::isArchiveSupported(const QString &archiveName) const
{
try {
return this->get_override("isArchiveSupported")(archiveName);
} PYCATCH;
}
std::set<QString> IPluginInstallerCustomWrapper::supportedExtensions() const
{
try {
return this->get_override("supportedExtensions")().as<std::set<QString>>();
} PYCATCH;
}
IPluginInstaller::EInstallResult IPluginInstallerCustomWrapper::install(GuessedValue<QString> &modName, const QString &archiveName,
const QString &version, int modID)
{
try {
return this->get_override("install")(modName, archiveName, version, modID);
} PYCATCH;
}
void IPluginInstallerCustomWrapper::setParentWidget(QWidget *parent)
{
try {
this->get_override("setParentWidget")(parent);
} PYCATCH;
}
+79
View File
@@ -0,0 +1,79 @@
#ifndef PROXYPLUGINWRAPPERS_H
#define PROXYPLUGINWRAPPERS_H
#include <iplugintool.h>
#include <iplugininstallersimple.h>
#include <iplugininstallercustom.h>
#ifndef Q_MOC_RUN
#include <boost/python.hpp>
#endif
class IPluginWrapper : public boost::python::wrapper<MOBase::IPlugin>
{
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
};
class IPluginToolWrapper: public MOBase::IPluginTool, public boost::python::wrapper<MOBase::IPluginTool>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginTool)
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
virtual QString displayName() const;
virtual QString tooltip() const;
virtual QIcon icon() const;
virtual void setParentWidget(QWidget *parent);
public slots:
virtual void display() const;
};
class IPluginInstallerCustomWrapper: public MOBase::IPluginInstallerCustom, public boost::python::wrapper<MOBase::IPluginInstallerCustom>
{
Q_OBJECT
Q_INTERFACES(MOBase::IPlugin MOBase::IPluginInstaller MOBase::IPluginInstallerCustom)
public:
virtual bool init(MOBase::IOrganizer *moInfo);
virtual QString name() const;
virtual QString author() const;
virtual QString description() const;
virtual MOBase::VersionInfo version() const;
virtual bool isActive() const;
virtual QList<MOBase::PluginSetting> settings() const;
virtual unsigned int priority() const;
virtual bool isManualInstaller() const;
virtual bool isArchiveSupported(const MOBase::DirectoryTree &tree) const;
virtual bool isArchiveSupported(const QString &archiveName) const;
virtual std::set<QString> supportedExtensions() const;
virtual EInstallResult install(MOBase::GuessedValue<QString> &modName, const QString &archiveName,
const QString &version, int modID);
virtual void setParentWidget(QWidget *parent);
};
#endif // PROXYPLUGINWRAPPERS_H
+64
View File
@@ -0,0 +1,64 @@
#-------------------------------------------------
#
# Project created by QtCreator 2013-09-01T15:55:01
#
#-------------------------------------------------
TARGET = pythonRunner
TEMPLATE = lib
CONFIG += dll
CONFIG += warn_on
DEFINES += PYTHONRUNNER_LIBRARY
# suppress a few warnings caused by boost vs vc++ paranoia
DEFINES += _SCL_SECURE_NO_WARNINGS HAVE_ROUND NOMINMAX
!include(../LocalPaths.pri) {
message("paths to required libraries need to be set up in LocalPaths.pri")
}
SOURCES += pythonrunner.cpp \
gilock.cpp \
error.cpp \
pythonpluginwrapper.cpp \
proxypluginwrappers.cpp
HEADERS += pythonrunner.h \
gilock.h \
error.h \
uibasewrappers.h \
pythonpluginwrapper.h \
proxypluginwrappers.h
CONFIG(debug, debug|release) {
LIBS += -L$$OUT_PWD/../uibase/debug
} else {
LIBS += -L$$OUT_PWD/../uibase/release
msvc:QMAKE_CXXFLAGS += /Zi
msvc: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
} else {
SRCDIR = $$OUT_PWD/release
DSTDIR = $$PWD/../../output
}
SRCDIR ~= s,/,$$QMAKE_DIR_SEP,g
DSTDIR ~= s,/,$$QMAKE_DIR_SEP,g
QMAKE_POST_LINK += xcopy /y /s /i $$quote($$SRCDIR\\$${TARGET}*.dll) $$quote($$DSTDIR)\\plugins\\data $$escape_expand(\\n)
QMAKE_POST_LINK += xcopy /y /I $$quote($$SRCDIR\\$${TARGET}*.pdb) $$quote($$DSTDIR)\\plugins $$escape_expand(\\n)
OTHER_FILES += \
SConscript
+111
View File
@@ -0,0 +1,111 @@
#include "pythonpluginwrapper.h"
using boost::python::extract;
using boost::python::handle_exception;
PythonPluginWrapper::PythonPluginWrapper(const boost::python::object &initFunction,
const boost::python::object &nameFunction,
const boost::python::object &authorFunction,
const boost::python::object &descriptionFunction,
const boost::python::object &versionFunction,
const boost::python::object &isActiveFunction,
const boost::python::object &settingsFunction)
: m_InitFunction(initFunction)
, m_NameFunction(nameFunction)
, m_AuthorFunction(authorFunction)
, m_DescriptionFunction(descriptionFunction)
, m_VersionFunction(versionFunction)
, m_IsActiveFunction(isActiveFunction)
, m_SettingsFunction(settingsFunction)
{
}
void PythonPluginWrapper::reportPythonError() const
{
if (PyErr_Occurred()) {
PyErr_Print();
} else {
qCritical("An unexpected C++ exception was thrown in python code");
}
}
bool PythonPluginWrapper::init(MOBase::IOrganizer *moInfo)
{
try {
return boost::python::extract<bool>(m_InitFunction(boost::python::ptr(moInfo)));
} catch (const boost::python::error_already_set&) {
reportPythonError();
return false;
}
}
QString PythonPluginWrapper::name() const
{
try {
return boost::python::extract<QString>(m_NameFunction());
} catch (const boost::python::error_already_set&) {
reportPythonError();
return QString();
}
}
QString PythonPluginWrapper::author() const
{
try {
return boost::python::extract<QString>(m_AuthorFunction());
} catch (const boost::python::error_already_set&) {
reportPythonError();
return QString();
}
}
QString PythonPluginWrapper::description() const
{
try {
return boost::python::extract<QString>(m_DescriptionFunction());
} catch (const boost::python::error_already_set&) {
reportPythonError();
return QString();
}
}
MOBase::VersionInfo PythonPluginWrapper::version() const
{
try {
return boost::python::extract<MOBase::VersionInfo>(m_VersionFunction());
} catch (const boost::python::error_already_set&) {
reportPythonError();
return MOBase::VersionInfo();
}
}
bool PythonPluginWrapper::isActive() const
{
try {
return boost::python::extract<bool>(m_IsActiveFunction());
} catch (const boost::python::error_already_set&) {
reportPythonError();
return false;
}
}
QList<MOBase::PluginSetting> PythonPluginWrapper::settings() const
{
QList<MOBase::PluginSetting> result;
try {
boost::python::object l = m_SettingsFunction();
if (!l.is_none()) {
for (int i = 0; i < boost::python::len(l); ++i) {
result.append(extract<MOBase::PluginSetting>(l[i]));
}
}
} catch (const boost::python::error_already_set&) {
reportPythonError();
}
return result;
}

Some files were not shown because too many files have changed in this diff Show More