Skip to content

Commit

Permalink
fix: load python plugins correctly
Browse files Browse the repository at this point in the history
a deprecated preprocessor define was preventing python plugins from loading
  • Loading branch information
hello-adam committed Mar 16, 2021
1 parent 5f5ec94 commit 505acae
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
8 changes: 0 additions & 8 deletions src/hobbits-gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,8 @@
#include "parametereditordialog.h"
#include "batcheditor.h"

#ifdef HAS_EMBEDDED_PYTHON
#include "pythonpluginconfig.h"
#include "simpleparametereditor.h"
#endif

const int MAINWINDOW_STATE_VERSION = 1;

Expand Down Expand Up @@ -516,7 +514,6 @@ void MainWindow::loadPlugins()
msg.exec();
}

#ifdef HAS_EMBEDDED_PYTHON
warnings.clear();
for (QString pluginPath : pluginPaths) {
warnings.append(PythonPluginConfig::loadPythonPlugins(pluginPath, m_pluginManager, [](QSharedPointer<ParameterDelegate> delegate, QSize size) {
Expand All @@ -532,7 +529,6 @@ void MainWindow::loadPlugins()
msg.setDefaultButton(QMessageBox::Ok);
msg.exec();
}
#endif


QSet<QString> queued;
Expand Down Expand Up @@ -952,19 +948,15 @@ void MainWindow::pluginActionProgress(QUuid id, int progress)
m_pluginProgress.value(id)->progressBar->setValue(progress);
}

#ifdef HAS_EMBEDDED_PYTHON
#include "hobbitspython.h"
#endif

void MainWindow::on_action_About_triggered()
{
QString coreLibVersion = HobbitsCoreConfig::VERSION;
QString guiVersion = HobbitsGuiConfig::VERSION;

QString info = QString("Hobbits GUI Version: %1\nHobbits Core Version: %2").arg(guiVersion).arg(coreLibVersion);
#ifdef HAS_EMBEDDED_PYTHON
info += QString("\nIntegrated Python: %1").arg(HobbitsPythonConfig::PYTHON_VERSION);
#endif

QMessageBox msg;
msg.setWindowTitle("About Hobbits");
Expand Down
9 changes: 2 additions & 7 deletions src/hobbits-runner/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@

#include <QTimer>

#ifdef HAS_EMBEDDED_PYTHON
#include "hobbitspython.h"
#include "hobbitspythonconfig.h"
#include "pythonpluginconfig.h"
#endif

int main(int argc, char *argv[])
{
Expand All @@ -27,9 +26,7 @@ int main(int argc, char *argv[])
QGuiApplication::setApplicationVersion(HobbitsRunnerConfig::VERSION);

QString description = "Command-line interface for bitstream analysis and processing";
#ifdef HAS_EMBEDDED_PYTHON
description += QString("(built with embedded python support from %1)").arg(HobbitsPython::pythonVersion());
#endif
description += QString("(built with embedded python support from %1)").arg(HobbitsPythonConfig::PYTHON_VERSION);

QCommandLineParser parser;
parser.setApplicationDescription(description);
Expand Down Expand Up @@ -146,15 +143,13 @@ int main(int argc, char *argv[])
warnings.append(pluginManager->loadPlugins(pluginPath));
}

#ifdef HAS_EMBEDDED_PYTHON
for (QString pluginPath : pluginPaths) {
warnings.append(PythonPluginConfig::loadPythonPlugins(pluginPath, pluginManager, [](QSharedPointer<ParameterDelegate> delegate, QSize size) {
Q_UNUSED(size)
Q_UNUSED(delegate)
return nullptr;
}));
}
#endif


for (auto warning : warnings) {
Expand Down

0 comments on commit 505acae

Please sign in to comment.