From e38b6effa76f8886e23f3a0e108c5a9b3adbbf23 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 15:56:48 +1300 Subject: [PATCH 01/10] Simulation support: don't require all our solvers to be installed (#2234). --- .../support/SimulationSupport/src/simulationsupportplugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/support/SimulationSupport/src/simulationsupportplugin.cpp b/src/plugins/support/SimulationSupport/src/simulationsupportplugin.cpp index 78bf907404..ff60b82527 100644 --- a/src/plugins/support/SimulationSupport/src/simulationsupportplugin.cpp +++ b/src/plugins/support/SimulationSupport/src/simulationsupportplugin.cpp @@ -41,7 +41,7 @@ PLUGININFO_FUNC SimulationSupportPluginInfo() descriptions.insert("fr", QString::fromUtf8("une extension pour supporter des simulations.")); return new PluginInfo(PluginInfo::Category::Support, false, false, - QStringList() << "COMBINESupport" << "CVODESolver" << "DataStore" << "ForwardEulerSolver" << "FourthOrderRungeKuttaSolver" << "HeunSolver" << "KINSOLSolver" << "SecondOrderRungeKuttaSolver", + QStringList() << "COMBINESupport" << "DataStore", descriptions); } From 5c967de7deaaeb71079a82dadb59865ddb51ea1a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 17:22:52 +1300 Subject: [PATCH 02/10] Some minor cleaning up. --- .../FileBrowserWindow/src/filebrowserwindowwidget.cpp | 4 ++-- .../src/simulationexperimentviewsimulationwidget.cpp | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/organisation/FileBrowserWindow/src/filebrowserwindowwidget.cpp b/src/plugins/organisation/FileBrowserWindow/src/filebrowserwindowwidget.cpp index 35bf1b1550..42cbfc99bb 100644 --- a/src/plugins/organisation/FileBrowserWindow/src/filebrowserwindowwidget.cpp +++ b/src/plugins/organisation/FileBrowserWindow/src/filebrowserwindowwidget.cpp @@ -346,8 +346,8 @@ void FileBrowserWindowWidget::goToOtherItem(QStringList &pItems, // Go to the previous/next item and move the last item from our list of // items to our list of other items - // First, we must stop keeping track of the change of item otherwise it's - // going to mess things up + // First, we must stop tracking the change of item otherwise it's going to + // mess things up disconnect(selectionModel(), &QItemSelectionModel::currentChanged, this, &FileBrowserWindowWidget::itemChanged); diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index be54eabaa4..56ca1d7f69 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -890,8 +890,8 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloadingView) // CellML file)... mContentsWidget->setUpdatesEnabled(false); - // Stop keeping track of certain things (so that updatePlot() doesn't - // get called unnecessarily) + // Stop tracking certain things (so that updatePlot() doesn't get called + // unnecessarily) // Note: see the corresponding code towards the end of this method... SimulationExperimentViewInformationWidget *informationWidget = mContentsWidget->informationWidget(); @@ -3003,7 +3003,7 @@ void SimulationExperimentViewSimulationWidget::simulationDone(qint64 pElapsedTim mContentsWidget->informationWidget()->parametersWidget()->updateParameters(mSimulation->currentPoint()); - // Stop keeping track of our simulation progress + // Stop tracking our simulation progress mProgress = -1; } @@ -3021,8 +3021,7 @@ void SimulationExperimentViewSimulationWidget::resetProgressBar() void SimulationExperimentViewSimulationWidget::resetFileTabIcon() { - // Stop tracking our simulation progress and let people know that our file - // tab icon should be reset + // Let people know that our file tab icon should be reset static const QIcon NoIcon = QIcon(); From 24abad8c6bae61a5d97f917ec5060795cddd2407 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 17:23:51 +1300 Subject: [PATCH 03/10] Simulation Experiment view: reverted commit af84fb6 and properly fixed the issue we had. Indeed, it definitely didn't fix our problem while we do (should!) now. --- .../src/simulationexperimentviewsimulationwidget.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index 56ca1d7f69..b435cb2cc5 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -902,7 +902,7 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloadingView) // Reset our progress - mProgress = 0; + mProgress = -1; // Clean up our output, if needed @@ -3003,9 +3003,11 @@ void SimulationExperimentViewSimulationWidget::simulationDone(qint64 pElapsedTim mContentsWidget->informationWidget()->parametersWidget()->updateParameters(mSimulation->currentPoint()); - // Stop tracking our simulation progress + // Stop tracking our simulation progress and reset our file tab icon mProgress = -1; + + resetFileTabIcon(); } //============================================================================== @@ -3769,7 +3771,7 @@ void SimulationExperimentViewSimulationWidget::updateSimulationResults(Simulatio // Note: tabBarPixmapSize()-2 because we want a one-pixel wide // border... - if ((newProgress != mProgress) && (mProgress != -1)) { + if ((newProgress != mProgress)) { // The progress has changed, so keep track of its new value and // update our file tab icon From 18a77b66e416d1f204a83665bdcbe091745f402a Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 17:38:02 +1300 Subject: [PATCH 04/10] Simulation Experiment view: make sure that we always update ourselves when our enabled state changes. --- .../src/simulationexperimentviewsimulationwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index b435cb2cc5..370e5fde7d 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -651,7 +651,7 @@ void SimulationExperimentViewSimulationWidget::changeEvent(QEvent *pEvent) // update our output widget while keeping its scrollbars, if any, still at // the same position - if (isVisible() && (pEvent->type() == QEvent::EnabledChange)) { + if (pEvent->type() == QEvent::EnabledChange) { int horizontalSliderPosition = mOutputWidget->horizontalScrollBar()->sliderPosition(); int verticalSliderPosition = mOutputWidget->verticalScrollBar()->sliderPosition(); From dd3c836461e6500e5561d462db7c37d4cd21c333 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 18:11:42 +1300 Subject: [PATCH 05/10] Some minor cleaning up. --- src/misc/closesimulation.cpp.inl | 2 +- src/misc/furtherinitialize.cpp.inl | 28 +++++++++---------- src/misc/initializesolver.cpp.inl | 6 ++-- .../DataStore/src/datastorepythonwrapper.cpp | 2 +- .../i18n/SimulationExperimentView_fr.ts | 24 ++++++++-------- .../simulationexperimentviewpythonwrapper.cpp | 2 +- .../i18n/SimulationSupport_fr.ts | 20 ++++++------- 7 files changed, 42 insertions(+), 42 deletions(-) diff --git a/src/misc/closesimulation.cpp.inl b/src/misc/closesimulation.cpp.inl index 40c918480b..b4659cddba 100644 --- a/src/misc/closesimulation.cpp.inl +++ b/src/misc/closesimulation.cpp.inl @@ -17,7 +17,7 @@ static PyObject * closeSimulation(PyObject *pSelf, PyObject *pArgs) auto simulation = static_cast(wrappedSimulation->_objPointerCopy); if (!Core::centralWidget()->closeFile(simulation->fileName())) { - PyErr_SetString(PyExc_IOError, qPrintable(QObject::tr("unable to close the simulation"))); + PyErr_SetString(PyExc_IOError, qPrintable(QObject::tr("unable to close the simulation."))); return nullptr; } diff --git a/src/misc/furtherinitialize.cpp.inl b/src/misc/furtherinitialize.cpp.inl index adbfe94d69..cddb9cd88f 100644 --- a/src/misc/furtherinitialize.cpp.inl +++ b/src/misc/furtherinitialize.cpp.inl @@ -117,7 +117,7 @@ QString Simulation::furtherInitialize() const } if (!propertySet) { - simulationError(QObject::tr("the requested solver property (%1) could not be set").arg(id), + simulationError(QObject::tr("the requested solver property (%1) could not be set.").arg(id), Error::InvalidSimulationEnvironment); return false; @@ -133,7 +133,7 @@ QString Simulation::furtherInitialize() const } #ifdef GUI_SUPPORT - simulationError(QObject::tr("the requested solver (%1) could not be found").arg(nlaSolverName), + simulationError(QObject::tr("the requested solver (%1) could not be found.").arg(nlaSolverName), Error::InvalidSimulationEnvironment); return false; @@ -143,7 +143,7 @@ QString Simulation::furtherInitialize() const #ifndef GUI_SUPPORT if (mustHaveNlaSolver && !hasNlaSolver) { - return QObject::tr("the requested solver (%1) could not be found").arg(nlaSolverName); + return QObject::tr("the requested solver (%1) could not be found.").arg(nlaSolverName); } #endif } @@ -360,28 +360,28 @@ QString Simulation::furtherInitialize() const if (xParameter == nullptr) { if (yParameter == nullptr) { - simulationError(QObject::tr("the requested curve (%1) could not be set (the variable %2 in component %3 and the variable %4 in component %5 could not be found)").arg(QString::fromStdString(sedmlCurve->getId()), - xCellmlVariable, - xCellmlComponent, - yCellmlVariable, - yCellmlComponent), + simulationError(QObject::tr("the requested curve (%1) could not be set (the variable %2 in component %3 and the variable %4 in component %5 could not be found).").arg(QString::fromStdString(sedmlCurve->getId()), + xCellmlVariable, + xCellmlComponent, + yCellmlVariable, + yCellmlComponent), Error::InvalidSimulationEnvironment); return false; } - simulationError(QObject::tr("the requested curve (%1) could not be set (the variable %2 in component %3 could not be found)").arg(QString::fromStdString(sedmlCurve->getId()), - xCellmlVariable, - xCellmlComponent), + simulationError(QObject::tr("the requested curve (%1) could not be set (the variable %2 in component %3 could not be found).").arg(QString::fromStdString(sedmlCurve->getId()), + xCellmlVariable, + xCellmlComponent), Error::InvalidSimulationEnvironment); return false; } if (yParameter == nullptr) { - simulationError(QObject::tr("the requested curve (%1) could not be set (the variable %2 in component %3 could not be found)").arg(QString::fromStdString(sedmlCurve->getId()), - yCellmlVariable, - yCellmlComponent), + simulationError(QObject::tr("the requested curve (%1) could not be set (the variable %2 in component %3 could not be found).").arg(QString::fromStdString(sedmlCurve->getId()), + yCellmlVariable, + yCellmlComponent), Error::InvalidSimulationEnvironment); return false; diff --git a/src/misc/initializesolver.cpp.inl b/src/misc/initializesolver.cpp.inl index f7995c5e45..3ff13e5fb8 100644 --- a/src/misc/initializesolver.cpp.inl +++ b/src/misc/initializesolver.cpp.inl @@ -33,12 +33,12 @@ QString Simulation::initializeSolver(const libsedml::SedListOfAlgorithmParameter if (solverInterface == nullptr) { #ifdef GUI_SUPPORT - simulationError(QObject::tr("the requested solver (%1) could not be found").arg(pKisaoId), + simulationError(QObject::tr("the requested solver (%1) could not be found.").arg(pKisaoId), Error::InvalidSimulationEnvironment); return false; #else - return QObject::tr("the requested solver (%1) could not be found").arg(pKisaoId); + return QObject::tr("the requested solver (%1) could not be found.").arg(pKisaoId); #endif } @@ -103,7 +103,7 @@ QString Simulation::initializeSolver(const libsedml::SedListOfAlgorithmParameter } if (!propertySet) { - simulationError(QObject::tr("the requested solver property (%1) could not be set").arg(parameterKisaoId), + simulationError(QObject::tr("the requested solver property (%1) could not be set.").arg(parameterKisaoId), Error::InvalidSimulationEnvironment); return false; diff --git a/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp b/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp index 2e3af7c10a..783db81e12 100644 --- a/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp +++ b/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp @@ -129,7 +129,7 @@ static int DataStoreValuesDict_ass_subscript(PyObject *pValuesDict, return 0; } - PyErr_SetString(PyExc_TypeError, "Invalid value"); + PyErr_SetString(PyExc_TypeError, "invalid value."); return -1; } diff --git a/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts b/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts index 8687513d41..80d6ed7a9f 100644 --- a/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts +++ b/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts @@ -644,28 +644,28 @@ QObject - unable to get the simulation's runtime - incapable d'obtenir le modèle d'exécution de la simulation + unable to get the simulation's runtime. + incapable d'obtenir le modèle d'exécution de la simulation. - unable to close the simulation - incapable de fermer la simulation + unable to close the simulation. + incapable de fermer la simulation. - the requested solver (%1) could not be found - le solveur demandé (%1) n'a pas pu être trouvé + the requested solver (%1) could not be found. + le solveur demandé (%1) n'a pas pu être trouvé. - the requested solver property (%1) could not be set - la propriété demandée (%1) du solveur n'a pas pu être spécifiée + the requested solver property (%1) could not be set. + la propriété demandée (%1) du solveur n'a pas pu être spécifiée. - the requested curve (%1) could not be set (the variable %2 in component %3 and the variable %4 in component %5 could not be found) - la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 et la variable %4 dans le composant %5 n'ont pas pu être trouvées) + the requested curve (%1) could not be set (the variable %2 in component %3 and the variable %4 in component %5 could not be found). + la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 et la variable %4 dans le composant %5 n'ont pas pu être trouvées). - the requested curve (%1) could not be set (the variable %2 in component %3 could not be found) - la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 n'a pas pu être trouvée) + the requested curve (%1) could not be set (the variable %2 in component %3 could not be found). + la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 n'a pas pu être trouvée). diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp index 0958a21acd..27ec5b4bd3 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp @@ -53,7 +53,7 @@ static PyObject * simulation(const QString &pFileName, if (simulation->runtime() == nullptr) { // The simulation is missing a runtime, so raise a Python exception - PyErr_SetString(PyExc_ValueError, qPrintable(QObject::tr("unable to get the simulation's runtime"))); + PyErr_SetString(PyExc_ValueError, qPrintable(QObject::tr("unable to get the simulation's runtime."))); return nullptr; } diff --git a/src/plugins/support/SimulationSupport/i18n/SimulationSupport_fr.ts b/src/plugins/support/SimulationSupport/i18n/SimulationSupport_fr.ts index 5565521a8b..5faa34c6ec 100644 --- a/src/plugins/support/SimulationSupport/i18n/SimulationSupport_fr.ts +++ b/src/plugins/support/SimulationSupport/i18n/SimulationSupport_fr.ts @@ -54,24 +54,24 @@ Le solveur demandé (%1) n'a pas pu être trouvé. - unable to close the simulation - incapable de fermer la simulation + unable to close the simulation. + incapable de fermer la simulation. - the requested solver (%1) could not be found - le solveur demandé (%1) n'a pas pu être trouvé + the requested solver (%1) could not be found. + le solveur demandé (%1) n'a pas pu être trouvé. - the requested solver property (%1) could not be set - la propriété demandée (%1) du solveur n'a pas pu être spécifiée + the requested solver property (%1) could not be set. + la propriété demandée (%1) du solveur n'a pas pu être spécifiée. - the requested curve (%1) could not be set (the variable %2 in component %3 and the variable %4 in component %5 could not be found) - la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 et la variable %4 dans le composant %5 n'ont pas pu être trouvées) + the requested curve (%1) could not be set (the variable %2 in component %3 and the variable %4 in component %5 could not be found). + la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 et la variable %4 dans le composant %5 n'ont pas pu être trouvées). - the requested curve (%1) could not be set (the variable %2 in component %3 could not be found) - la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 n'a pas pu être trouvée) + the requested curve (%1) could not be set (the variable %2 in component %3 could not be found). + la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 n'a pas pu être trouvée). From 7a893ba7c3e2234640b963148ab894828a7042fe Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 19:22:57 +1300 Subject: [PATCH 06/10] Some minor cleaning up. --- .../i18n/SimulationExperimentView_fr.ts | 12 ++++--- ...mulationexperimentviewsimulationwidget.cpp | 34 +++++++++++-------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts b/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts index 80d6ed7a9f..375b9a5cdd 100644 --- a/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts +++ b/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts @@ -556,10 +556,6 @@ none aucun - - %1: - %1 : - the model needs both an ODE and an NLA solver, but none are available le modèle a besoin à la fois d'un solveur EDO et d'un solveur ALN, mais aucun n'est disponible @@ -640,6 +636,14 @@ Error: Erreur : + + <span %1><strong>[%2:%3] %4:</strong> %5.</span> + <span %1><strong>[%2:%3] %4 :</strong> %5.</span> + + + <span %1><strong>%2:</strong> %3.</span> + <span %1><strong>%2 :</strong> %3.</span> + QObject diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp index 370e5fde7d..ea2f6b21cd 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewsimulationwidget.cpp @@ -862,9 +862,9 @@ void SimulationExperimentViewSimulationWidget::updateInvalidModelMessageWidget() //============================================================================== static const char *OutputTab = "    "; -static const char *OutputGood = R"( class="good")"; -static const char *OutputInfo = R"( class="info")"; -static const char *OutputBad = R"( class="bad")"; +static const char *OutputGood = R"(class="good")"; +static const char *OutputInfo = R"(class="info")"; +static const char *OutputBad = R"(class="bad")"; static const char *OutputBrLn = "
\n"; //============================================================================== @@ -932,8 +932,8 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloadingView) // A VOI could be retrieved for our CellML file, so we can also // output the model type - information += QString()+""+tr("valid")+"."+OutputBrLn - +QString(QString()+OutputTab+""+tr("Model type:")+" %1."+OutputBrLn).arg(runtime->needNlaSolver()?tr("DAE"):tr("ODE")); + information += QString()+""+tr("valid")+"."+OutputBrLn + +QString(QString()+OutputTab+""+tr("Model type:")+" %1."+OutputBrLn).arg(runtime->needNlaSolver()?tr("DAE"):tr("ODE")); } else { // We couldn't retrieve a VOI, which means that we either don't // have a runtime or we have one, but it's not valid or it's @@ -946,7 +946,7 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloadingView) updateInvalidModelMessageWidget(); - information += QString()+""+((runtime != nullptr)?tr("invalid"):tr("none"))+"."+OutputBrLn; + information += QString()+""+((runtime != nullptr)?tr("invalid"):tr("none"))+"."+OutputBrLn; } } @@ -956,13 +956,19 @@ void SimulationExperimentViewSimulationWidget::initialize(bool pReloadingView) for (const auto &simulationIssue : simulationIssues) { if ((simulationIssue.line() != 0) && (simulationIssue.column() != 0)) { - information += QString(QString()+OutputTab+"[%1:%2] %3 %4."+OutputBrLn).arg(simulationIssue.line()) - .arg(simulationIssue.column()) - .arg(tr("%1:").arg(simulationIssue.typeAsString()), - Core::formatMessage(simulationIssue.message().toHtmlEscaped())); + information += OutputTab + +tr("[%2:%3] %4: %5.").arg(OutputBad) + .arg(simulationIssue.line()) + .arg(simulationIssue.column()) + .arg(simulationIssue.typeAsString(), + Core::formatMessage(simulationIssue.message().toHtmlEscaped())) + +OutputBrLn; } else { - information += QString(QString()+OutputTab+"%1 %2."+OutputBrLn).arg(tr("%1:").arg(simulationIssue.typeAsString()), - Core::formatMessage(simulationIssue.message().toHtmlEscaped())); + information += OutputTab + +tr("%2: %3.").arg(OutputBad, + simulationIssue.typeAsString(), + Core::formatMessage(simulationIssue.message().toHtmlEscaped())) + +OutputBrLn; } } } @@ -2993,7 +2999,7 @@ void SimulationExperimentViewSimulationWidget::simulationDone(qint64 pElapsedTim solversInformation += "+"+mSimulation->data()->nlaSolverName(); } - output(QString(QString()+OutputTab+""+tr("Simulation time:")+" "+tr("%1 using %2").arg(Core::formatTime(pElapsedTime), + output(QString(QString()+OutputTab+""+tr("Simulation time:")+" "+tr("%1 using %2").arg(Core::formatTime(pElapsedTime), solversInformation)+"."+OutputBrLn)); } @@ -3065,7 +3071,7 @@ void SimulationExperimentViewSimulationWidget::simulationError(const QString &pM updateInvalidModelMessageWidget(); - output(QString()+OutputTab+""+tr("Error:")+" "+pMessage+"."+OutputBrLn); + output(QString()+OutputTab+""+tr("Error:")+" "+pMessage+"."+OutputBrLn); } //============================================================================== From e01a134878bdb3d182faa115a24f640e1e99999c Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 19:30:39 +1300 Subject: [PATCH 07/10] Some minor cleaning up. --- src/plugins/dataStore/DataStore/i18n/DataStore_fr.ts | 7 +++++++ .../dataStore/DataStore/src/datastorepythonwrapper.cpp | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/plugins/dataStore/DataStore/i18n/DataStore_fr.ts b/src/plugins/dataStore/DataStore/i18n/DataStore_fr.ts index ce924516a5..1cdc72e9ee 100644 --- a/src/plugins/dataStore/DataStore/i18n/DataStore_fr.ts +++ b/src/plugins/dataStore/DataStore/i18n/DataStore_fr.ts @@ -16,4 +16,11 @@ Données :
+ + QObject + + invalid value. + valeur invalide. + + diff --git a/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp b/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp index 783db81e12..f7678da82c 100644 --- a/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp +++ b/src/plugins/dataStore/DataStore/src/datastorepythonwrapper.cpp @@ -129,7 +129,7 @@ static int DataStoreValuesDict_ass_subscript(PyObject *pValuesDict, return 0; } - PyErr_SetString(PyExc_TypeError, "invalid value."); + PyErr_SetString(PyExc_TypeError, qPrintable(QObject::tr("invalid value."))); return -1; } From d51e9669d6146086c1059d9d4c6c828764de3406 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Wed, 27 Nov 2019 19:37:18 +1300 Subject: [PATCH 08/10] Simualtion Experiment view: improved our our simulation Python wrapper (#2234). This needed since different types of issues may occur, e.g. a solver is not present. This also means that our Python console now generates the same error as our Simulation Experiment view. --- .../i18n/SimulationExperimentView_fr.ts | 12 ++++++---- .../simulationexperimentviewpythonwrapper.cpp | 24 +++++++++++++++---- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts b/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts index 375b9a5cdd..a3e08e24cf 100644 --- a/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts +++ b/src/plugins/simulation/SimulationExperimentView/i18n/SimulationExperimentView_fr.ts @@ -647,10 +647,6 @@ QObject - - unable to get the simulation's runtime. - incapable d'obtenir le modèle d'exécution de la simulation. - unable to close the simulation. incapable de fermer la simulation. @@ -671,5 +667,13 @@ the requested curve (%1) could not be set (the variable %2 in component %3 could not be found). la courbe demandée (%1) n'a pas pu être spécifiée (la variable %2 dans le composant %3 n'a pas pu être trouvée). + + [%1:%2] %3: %4. + [%1:%2] %3 : %4. + + + %1: %2. + %1 : %2. + diff --git a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp index 27ec5b4bd3..a7db08b0c6 100644 --- a/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp +++ b/src/plugins/simulation/SimulationExperimentView/src/simulationexperimentviewpythonwrapper.cpp @@ -50,10 +50,26 @@ static PyObject * simulation(const QString &pFileName, SimulationSupport::Simulation *simulation = pSimulationExperimentViewWidget->simulation(pFileName); if (simulation != nullptr) { - if (simulation->runtime() == nullptr) { - // The simulation is missing a runtime, so raise a Python exception - - PyErr_SetString(PyExc_ValueError, qPrintable(QObject::tr("unable to get the simulation's runtime."))); + // Check if something is wrong with our simulation and, if so, raise a + // Python exception + // Note: there may be several issues, but only the first one needs to be + // raised since Python obviously gives control back to the user as + // soon as an exception is raised... + + SimulationSupport::SimulationIssues simulationIssues = simulation->issues(); + + if (!simulationIssues.isEmpty()) { + auto simulationIssue = simulationIssues.first(); + + if ((simulationIssue.line() != 0) && (simulationIssue.column() != 0)) { + PyErr_SetString(PyExc_ValueError, qPrintable(QObject::tr("[%1:%2] %3: %4.").arg(simulationIssue.line()) + .arg(simulationIssue.column()) + .arg(simulationIssue.typeAsString(), + Core::formatMessage(simulationIssue.message().toHtmlEscaped())))); + } else { + PyErr_SetString(PyExc_ValueError, qPrintable(QObject::tr("%1: %2.").arg(simulationIssue.typeAsString(), + Core::formatMessage(simulationIssue.message().toHtmlEscaped())))); + } return nullptr; } From 7582459fbba18152c93a00d7cfa5cae508cbe015 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 28 Nov 2019 09:22:26 +1300 Subject: [PATCH 09/10] Plugin manager: all our solvers should be loaded when in CLI mode (#2234). This ensures that we can do whatever we want from Python when in "CLI mode". If we are in GUI mode, we want to allow the user to be able to select whatever solver s/he wants to have. When it comes to Python support, if a solver is not loaded but needed by a Python script, then we will get an error (see commit d51e9669d). --- src/plugins/pluginmanager.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/pluginmanager.cpp b/src/plugins/pluginmanager.cpp index be67836f12..c54c6d0b86 100644 --- a/src/plugins/pluginmanager.cpp +++ b/src/plugins/pluginmanager.cpp @@ -120,11 +120,11 @@ PluginManager::PluginManager(bool pGuiMode) : if (pluginInfo != nullptr) { // Keep track of the plugin itself, should it be selectable and - // requested by the user (if we are in GUI mode) or have CLI support - // (if we are in CLI mode) + // requested by the user (if we are in GUI mode), or have CLI + // support or is a solver (if we are in CLI mode) if ( ( pGuiMode && pluginInfo->isSelectable() && Plugin::load(pluginName)) - || (!pGuiMode && pluginInfo->hasCliSupport())) { + || (!pGuiMode && (pluginInfo->hasCliSupport() || (pluginInfo->category() == PluginInfo::Category::Solver)))) { // Keep track of the plugin's dependencies neededPlugins << pluginsInfo.value(pluginName)->fullDependencies(); From 266db8d9ce20f8c96f921cfa1dd236d7c1307ea1 Mon Sep 17 00:00:00 2001 From: Alan Garny Date: Thu, 28 Nov 2019 09:43:22 +1300 Subject: [PATCH 10/10] Slight update to our downloads page (#2234). --- doc/downloads/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/downloads/index.js b/doc/downloads/index.js index 30aaa86e43..07cb6c4a63 100644 --- a/doc/downloads/index.js +++ b/doc/downloads/index.js @@ -40,6 +40,7 @@ var jsonData = { "versions": [ { "change": "General: added (initial) support for Python (see issue #1255). Replaced our use of PackageMaker with that of productbuild on macOS (see issue #2210)." }, { "change": "Python support: now update the environment variable PATH using \\ rather than / on Windows (see issue #2219). Merged our duplicated code (see issue #2225)." }, { "change": "SED-ML support: added support left and right triangle symbols (see issue #2173)." }, + { "change": "Simulation support: don't require all our solvers to be installed anymore (see issue #2234)." }, { "change": "Simulation Experiment view: properly handle the Graph Panel properties (see issue #2171). Make sure that curves are plotted with all of their original settings when reloading a SED-ML file (see issue #2176). Make sure that all of a solver's properties get saved to a SED-ML file (see issue #2185)." }, { "change": "Third-party libraries: upgraded the OpenSSL library to version 1.1.1d (see issue #2157). Upgraded LLVM+Clang to version 9.0.0 (see issue #2161). Upgraded the SUNDIALS library to version 5.0.0 (see issue #2198). Upgraded QScintilla to version 2.11.3 (see issue #2208). Upgraded Mesa to version 19.2.6 (see issue #2230)." } ]