Skip to content

Commit

Permalink
Merge 276292a into b1e7f85
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Nov 27, 2019
2 parents b1e7f85 + 276292a commit 5813615
Show file tree
Hide file tree
Showing 9 changed files with 95 additions and 18 deletions.
2 changes: 1 addition & 1 deletion doc/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var jsonData = { "versions": [
{ "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>)." },
{ "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>)." },
{ "change": "<strong>Simulation support:</strong> don't require all our solvers to be installed anymore (see issue <a href=\"https://github.com/opencor/opencor/issues/2234\">#2234</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> properly handle the Graph Panel properties (see issue <a href=\"https://github.com/opencor/opencor/issues/2171\">#2171</a>). Make sure that curves are plotted with all of their original settings when reloading a SED-ML file (see issue <a href=\"https://github.com/opencor/opencor/issues/2176\">#2176</a>). Make sure that all of a solver's properties get saved to a SED-ML file (see issue <a href=\"https://github.com/opencor/opencor/issues/2185\">#2185</a>)." },
{ "change": "<strong>Simulation Experiment view:</strong> properly handle the Graph Panel properties (see issue <a href=\"https://github.com/opencor/opencor/issues/2171\">#2171</a>). Make sure that curves are plotted with all of their original settings when reloading a SED-ML file (see issue <a href=\"https://github.com/opencor/opencor/issues/2176\">#2176</a>). Make sure that all of a solver's properties get saved to a SED-ML file (see issue <a href=\"https://github.com/opencor/opencor/issues/2185\">#2185</a>). Don't access our central widget directly anymore (see issue <a href=\"https://github.com/opencor/opencor/issues/2218\">#2218</a>)." },
{ "change": "<strong>Third-party libraries:</strong> upgraded the <a href=\"https://www.openssl.org/\">OpenSSL</a> library to version 1.1.1d (see issue <a href=\"https://github.com/opencor/opencor/issues/2157\">#2157</a>). Upgraded <a href=\"http://www.llvm.org/\">LLVM</a>+<a href=\"http://clang.llvm.org/\">Clang</a> to version 9.0.0 (see issue <a href=\"https://github.com/opencor/opencor/issues/2161\">#2161</a>). Upgraded the <a href=\"http://computation.llnl.gov/projects/sundials\">SUNDIALS</a> library to version 5.0.0 (see issue <a href=\"https://github.com/opencor/opencor/issues/2198\">#2198</a>). Upgraded <a href=\"https://riverbankcomputing.com/software/qscintilla/intro\">QScintilla</a> to version 2.11.3 (see issue <a href=\"https://github.com/opencor/opencor/issues/2208\">#2208</a>). Upgraded <a href=\"https://www.mesa3d.org/\">Mesa</a> to version 19.2.6 (see issue <a href=\"https://github.com/opencor/opencor/issues/2230\">#2230</a>)." }
]
},
Expand Down
2 changes: 1 addition & 1 deletion src/misc/closesimulation.cpp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ static PyObject * closeSimulation(PyObject *pSelf, PyObject *pArgs)

auto simulation = static_cast<SimulationSupport::Simulation *>(wrappedSimulation->_objPointerCopy);

if (!Core::centralWidget()->closeFile(simulation->fileName())) {
if (!Core::guiCloseFile(simulation->fileName())) {
PyErr_SetString(PyExc_IOError, qPrintable(QObject::tr("unable to close the simulation.")));

return nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/misc/openfile.cpp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
QString CentralWidget::openFile(const QString &pFileName, File::Type pType,
const QString &pUrl, bool pShowWarning)
#else
QString openFile(const QString &pFileName, const File::Type &pType,
const QString &pUrl)
QString cliOpenFile(const QString &pFileName, File::Type pType,
const QString &pUrl)
#endif
{
// Make sure that modes are available and that the file exists
Expand Down
6 changes: 3 additions & 3 deletions src/misc/openremotefile.cpp.inl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifdef GUI_SUPPORT
QString CentralWidget::openRemoteFile(const QString &pUrl, bool pShowWarning)
#else
QString openRemoteFile(const QString &pUrl)
QString cliOpenRemoteFile(const QString &pUrl)
#endif
{
// Make sure that pUrl really refers to a remote file
Expand All @@ -21,7 +21,7 @@ QString openRemoteFile(const QString &pUrl)
#ifdef GUI_SUPPORT
return openFile(fileNameOrUrl, File::Type::Local, QString(), pShowWarning);
#else
return openFile(fileNameOrUrl);
return cliOpenFile(fileNameOrUrl);
#endif
}

Expand Down Expand Up @@ -106,6 +106,6 @@ QString openRemoteFile(const QString &pUrl)
#ifdef GUI_SUPPORT
return openFile(fileName, File::Type::Remote, fileNameOrUrl, pShowWarning);
#else
return openFile(fileName, File::Type::Remote, fileNameOrUrl);
return cliOpenFile(fileName, File::Type::Remote, fileNameOrUrl);
#endif
}
12 changes: 6 additions & 6 deletions src/misc/opensimulation.cpp.inl
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ static PyObject * openSimulation(PyObject *pSelf, PyObject *pArgs)

QString error = isLocalFile?
#ifdef GUI_SUPPORT
Core::centralWidget()->openFile(fileNameOrUrl,
Core::File::Type::Local,
QString(), false):
Core::centralWidget()->openRemoteFile(fileNameOrUrl, false);
Core::guiOpenFile(fileNameOrUrl,
Core::File::Type::Local,
QString(), false):
Core::guiOpenRemoteFile(fileNameOrUrl, false);
#else
Core::openFile(fileNameOrUrl):
Core::openRemoteFile(fileNameOrUrl);
Core::cliOpenFile(fileNameOrUrl):
Core::cliOpenRemoteFile(fileNameOrUrl);
#endif

if (!error.isEmpty()) {
Expand Down
8 changes: 4 additions & 4 deletions src/plugins/miscellaneous/Core/src/corecliutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@ bool CORE_EXPORT isEmptyDirectory(const QString &pDirName);
void CORE_EXPORT doNothing(quint64 pMax);
void CORE_EXPORT doNothing(const quint64 *pMax, const bool *pStopped = nullptr);

QString CORE_EXPORT openFile(const QString &pFileName,
const File::Type &pType = File::Type::Local,
const QString &pUrl = QString());
QString CORE_EXPORT openRemoteFile(const QString &pUrl);
QString CORE_EXPORT cliOpenFile(const QString &pFileName,
File::Type pType = File::Type::Local,
const QString &pUrl = QString());
QString CORE_EXPORT cliOpenRemoteFile(const QString &pUrl);

QString CORE_EXPORT formatXml(const QString &pXml);

Expand Down
65 changes: 65 additions & 0 deletions src/plugins/miscellaneous/Core/src/coreguiutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,25 @@ Plugin * currentViewPlugin()

//==============================================================================

QString currentFileName()
{
// Return our current file name

CentralWidget *centralWidget = Core::centralWidget();

if (centralWidget != nullptr) {
return centralWidget->currentFileName();
}

return {};
}

//==============================================================================

QString allFilters(const QStringList &pFilters)
{
// Return all the filters as a string

QStringList filters = pFilters;

filters.sort(Qt::CaseInsensitive);
Expand Down Expand Up @@ -415,6 +432,54 @@ QString getEmptyDirectory(const QString &pCaption, const QString &pDirName)

//==============================================================================

QString CORE_EXPORT guiOpenFile(const QString &pFileName, File::Type pType,
const QString &pUrl, bool pShowWarning)
{
// Open the given file

CentralWidget *centralWidget = Core::centralWidget();

if (centralWidget != nullptr) {
centralWidget->openFile(pFileName, pType, pUrl, pShowWarning);
}

return QObject::tr("there is no central widget, so the file cannot be opened.");
// Note: we should never reach this point...
}

//==============================================================================

QString guiOpenRemoteFile(const QString &pUrl, bool pShowWarning)
{
// Open the given remote file

CentralWidget *centralWidget = Core::centralWidget();

if (centralWidget != nullptr) {
centralWidget->openRemoteFile(pUrl, pShowWarning);
}

return QObject::tr("there is no central widget, so the remote file cannot be opened.");
// Note: we should never reach this point...
}

//==============================================================================

bool guiCloseFile(const QString &pFileName)
{
// Close the given file

CentralWidget *centralWidget = Core::centralWidget();

if (centralWidget != nullptr) {
centralWidget->closeFile(pFileName);
}

return false;
}

//==============================================================================

void setFocusTo(QWidget *pWidget)
{
// Give the focus to pWidget, but then revert the focus back to whoever had
Expand Down
12 changes: 12 additions & 0 deletions src/plugins/miscellaneous/Core/src/coreguiutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
//==============================================================================

#include "coreglobal.h"
#include "file.h"

//==============================================================================

Expand Down Expand Up @@ -116,6 +117,8 @@ void CORE_EXPORT hideCentralBusyWidget();

Plugin CORE_EXPORT * currentViewPlugin();

QString CORE_EXPORT currentFileName();

QString CORE_EXPORT getOpenFileName(const QString &pCaption,
const QStringList &pFilters = QStringList(),
QString *pSelectedFilter = nullptr);
Expand All @@ -136,6 +139,15 @@ QString CORE_EXPORT getDirectory(const QString &pCaption,
QString CORE_EXPORT getEmptyDirectory(const QString &pCaption,
const QString &pDirName = QString());

QString CORE_EXPORT guiOpenFile(const QString &pFileName,
File::Type pType = File::Type::Local,
const QString &pUrl = QString(),
bool pShowWarning = true);
QString CORE_EXPORT guiOpenRemoteFile(const QString &pUrl,
bool pShowWarning = true);

bool CORE_EXPORT guiCloseFile(const QString &pFileName);

void CORE_EXPORT setFocusTo(QWidget *pWidget);

QMenu CORE_EXPORT * newMenu(const QString &pName, QWidget *pParent);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static PyObject * simulation(PyObject *pSelf, PyObject *pArgs)
SimulationExperimentViewWidget *simulationExperimentViewWidget = SimulationExperimentViewPlugin::instance()->viewWidget();

if (simulationExperimentViewWidget != nullptr) {
return simulation(Core::centralWidget()->currentFileName(), simulationExperimentViewWidget);
return simulation(Core::currentFileName(), simulationExperimentViewWidget);
}

#include "pythonbegin.h"
Expand Down

0 comments on commit 5813615

Please sign in to comment.