Skip to content

Commit

Permalink
Merge cd3bf6f into bcacc48
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Dec 3, 2019
2 parents bcacc48 + cd3bf6f commit ff9a2dd
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 15 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ var jsonData = { "versions": [
}
],
"changes": [
{ "change": "<strong>General:</strong> added (initial) support for <a href=\"https://python.org/\">Python</a> (see issue <a href=\"https://github.com/opencor/opencor/issues/1255\">#1255</a>). Replaced our use of <a href=\"https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/PackageMakerUserGuide/Introduction/Introduction.html\">PackageMaker</a> with that of productbuild on <a href=\"https://en.wikipedia.org/wiki/MacOS\">macOS</a> (see issue <a href=\"https://github.com/opencor/opencor/issues/2210\">#2210</a>)." },
{ "change": "<strong>General:</strong> added (initial) support for <a href=\"https://python.org/\">Python</a> (see issue <a href=\"https://github.com/opencor/opencor/issues/1255\">#1255</a>). Replaced our use of <a href=\"https://developer.apple.com/library/archive/documentation/DeveloperTools/Conceptual/PackageMakerUserGuide/Introduction/Introduction.html\">PackageMaker</a> with that of productbuild on <a href=\"https://en.wikipedia.org/wiki/MacOS\">macOS</a> (see issue <a href=\"https://github.com/opencor/opencor/issues/2210\">#2210</a>). A selectable plugin cannot be needed by another plugin (see issue <a href=\"https://github.com/opencor/opencor/issues/2247\">#2247</a>)." },
{ "change": "<strong>Python support:</strong> now update the environment variable <code>PATH</code> using <code>\\</code> rather than <code>/</code> on Windows (see issue <a href=\"https://github.com/opencor/opencor/issues/2219\">#2219</a>). Merged our duplicated code (see issue <a href=\"https://github.com/opencor/opencor/issues/2225\">#2225</a>). Don't make our JupyterKernel and PythonShell plugins selectable (see issue <a href=\"https://github.com/opencor/opencor/issues/2245\">#2245</a>)." },
{ "change": "<strong>CellML support:</strong> fixed an issue with the CellML API wrongly allowing code generation for non-runnable models (see issue <a href=\"https://github.com/opencor/opencor/issues/2240\">#2240</a>)." },
{ "change": "<strong>SED-ML support:</strong> added support left and right triangle symbols (see issue <a href=\"https://github.com/opencor/opencor/issues/2173\">#2173</a>)." },
Expand Down
1 change: 1 addition & 0 deletions doc/whatIsNew.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ var jsonData = { "versions": [
{ "name": "General",
"entries": [
{ "type": "improved", "description": "Rendering of the <a href=\"https://en.wikipedia.org/wiki/Graphical_user_interface\">GUI</a>." },
{ "type": "improved", "description": "Plugin framework." },
{ "type": "added", "description": "Support for <a href=\"https://python.org/\">Python</a>." }
]
},
Expand Down
8 changes: 6 additions & 2 deletions i18n/OpenCOR_fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,12 @@
<translation>l&apos;extension prétend être l&apos;extension de base, mais elle ne l&apos;est pas.</translation>
</message>
<message>
<source>the plugin should be the core plugin, but it does not support the core interface.</source>
<translation>l&apos;extension devrait être l&apos;extension de base, mais elle ne supporte pas l&apos;interface de base.</translation>
<source>the plugin claims to be the core plugin, but it does not support the core interface.</source>
<translation>l&apos;extension prétend être l&apos;extension de base, mais elle ne supporte pas l&apos;interface de base.</translation>
</message>
<message>
<source>the plugin claims to be selectable, but it is needed.</source>
<translation>l&apos;extension prétend être sélectionnable, mais elle est nécessaire.</translation>
</message>
<message>
<source>the plugin supports the CLI interface, but it does not claim to be CLI-capable.</source>
Expand Down
6 changes: 5 additions & 1 deletion src/misc/cliapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,11 @@ void CliApplication::status() const

break;
case Plugin::Status::InvalidCorePlugin:
pluginInfo += "the plugin should be the core plugin, but it does not support the core interface.";
pluginInfo += "the plugin claims to be the core plugin, but it does not support the core interface.";

break;
case Plugin::Status::NeededSelectablePlugin:
pluginInfo += "the plugin claims to be selectable, but it is needed.";

break;
case Plugin::Status::NotCliPluginNoCliSupport:
Expand Down
23 changes: 15 additions & 8 deletions src/plugins/plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,19 @@ namespace OpenCOR {
//==============================================================================

Plugin::Plugin(const QString &pFileName, PluginInfo *pInfo,
const QString &pErrorMessage, bool pLoad,
const QString &pErrorMessage, bool pLoad, bool pNeeded,
PluginManager *pPluginManager) :
mName(name(pFileName)),
mInfo(pInfo),
mErrorMessage(pErrorMessage)
{
if (pInfo != nullptr) {
// We are dealing with a plugin, so try to load it, but only if the user
// wants
// We are dealing with a plugin, so try to load it (if needed), but
// before that make sure that it is not both needed and selectable

if (pLoad) {
if (pNeeded && pInfo->isSelectable()) {
mStatus = Status::NeededSelectablePlugin;
} else if (pLoad) {
// Make sure that the plugin's dependencies, if any, are loaded
// before loading the plugin itself
// Note: normally, we would only do this on Windows systems since,
Expand Down Expand Up @@ -265,11 +267,16 @@ Plugin::Plugin(const QString &pFileName, PluginInfo *pInfo,
// since we know it will only work for a plugin that uses an old
// version of PluginInfo...

mStatus = (Plugin::info(pFileName) != nullptr)?Status::OldPlugin:Status::NotPlugin;
if (Plugin::info(pFileName) != nullptr) {
// We are dealing with a plugin, but one that uses an old version of
// PluginInfo

if (mStatus == Status::NotPlugin) {
// Apparently, we are not dealing with a plugin, so load it so that
// we can retrieve its corresponding error
mStatus = Status::OldPlugin;
} else {
// We are not dealing with a plugin, so load it so that we can
// retrieve its corresponding error

mStatus = Status::NotPlugin;

QPluginLoader pluginLoader(pFileName);

Expand Down
3 changes: 2 additions & 1 deletion src/plugins/plugin.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,14 @@ class Plugin : public QObject
OldPlugin,
NotCorePlugin,
InvalidCorePlugin,
NeededSelectablePlugin,
NotCliPluginNoCliSupport,
NotCliPluginNoCliInterface,
MissingOrInvalidDependencies
};

explicit Plugin(const QString &pFileName, PluginInfo *pInfo,
const QString &pErrorMessage, bool pLoad,
const QString &pErrorMessage, bool pLoad, bool pNeeded,
PluginManager *pPluginManager);
~Plugin() override;

Expand Down
3 changes: 2 additions & 1 deletion src/plugins/pluginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ PluginManager::PluginManager(bool pGuiMode) :
auto plugin = new Plugin(pluginFileName,
pluginsInfo.value(pluginName),
pluginsError.value(pluginName),
plugins.contains(pluginName), this);
plugins.contains(pluginName),
neededPlugins.contains(pluginName), this);

// Keep track of the plugin and of the Core plugin, in particular, if it
// is loaded
Expand Down
4 changes: 3 additions & 1 deletion src/pluginsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,9 @@ QString PluginsDialog::statusDescription(Plugin *pPlugin) const
case Plugin::Status::NotCorePlugin:
return tr("the plugin claims to be the core plugin, but it is not.");
case Plugin::Status::InvalidCorePlugin:
return tr("the plugin should be the core plugin, but it does not support the core interface.");
return tr("the plugin claims to be the core plugin, but it does not support the core interface.");
case Plugin::Status::NeededSelectablePlugin:
return tr("the plugin claims to be selectable, but it is needed.");
case Plugin::Status::NotCliPluginNoCliSupport:
return tr("the plugin supports the CLI interface, but it does not claim to be CLI-capable.");
case Plugin::Status::NotCliPluginNoCliInterface:
Expand Down

0 comments on commit ff9a2dd

Please sign in to comment.