Skip to content

Commit

Permalink
Merge 78a328c into 76a4a6d
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Jul 5, 2018
2 parents 76a4a6d + 78a328c commit 061c60e
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 53 deletions.
1 change: 1 addition & 0 deletions doc/downloads/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ var jsonData = { "versions": [
],
"changes": [
{ "change": "<strong>Solvers:</strong> reference <a href=\"https://computation.llnl.gov/projects/sundials/cvode\">CVODE</a> rather than <a href=\"https://computation.llnl.gov/projects/sundials/cvodes\">CVODES</a> (see issue <a href=\"https://github.com/opencor/opencor/issues/1711\">#1711</a>)." },
{ "change": "<strong>CellML-based views:</strong> fixed an issue that prevented some views from showing a CellML file that cannot be fully instantiated (see issue <a href=\"https://github.com/opencor/opencor/issues/1725\">#1725</a>)." },
{ "change": "<strong>Simualtion Experiment view:</strong> fixed some issues with manually added graphs and graphs associated with another file (see issue <a href=\"https://github.com/opencor/opencor/issues/1716\">#1716</a>)." }
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,22 +532,6 @@ void CellmlAnnotationViewCellmlListWidget::initializeTreeViewWidget(bool pSelect

void CellmlAnnotationViewCellmlListWidget::populateModel()
{
// Make sure that the CellML file was properly loaded

if (mCellmlFile->issues().count()) {
// Something went wrong while trying to load the CellML file, so report
// the issue(s) and leave

foreach (const CellMLSupport::CellmlFileIssue &issue, mCellmlFile->issues()) {
mTreeViewModel->invisibleRootItem()->appendRow(new CellmlAnnotationViewCellmlElementItem(issue.type() == CellMLSupport::CellmlFileIssue::Error,
QString("[%1:%2] %3").arg(issue.line())
.arg(issue.column())
.arg(issue.formattedMessage())));
}

return;
}

// Retrieve the model's root

CellmlAnnotationViewCellmlElementItem *modelItem = new CellmlAnnotationViewCellmlElementItem(CellmlAnnotationViewCellmlElementItem::Model,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,11 @@ CellmlAnnotationViewEditingWidget::CellmlAnnotationViewEditingWidget(CellMLAnnot

Core::readFile(":/CellMLAnnotationView/qualifierInformation.html", mQualifierInformationTemplate);

// Retrieve and load, in case it's necessary, the requested CellML file
// Retrieve the requested CellML file

mCellmlFile = CellMLSupport::CellmlFileManager::instance()->cellmlFile(pFileName);

mCellmlFile->load();

// Customise our GUI which consists of two main parts:
// Customise our GUI, which consists of two main parts:
//
// 1) A couple of lists (for CellML elements and metadata, resp.); and
// 2) Some details (for a CellML element or metadata).
Expand All @@ -77,7 +75,7 @@ CellmlAnnotationViewEditingWidget::CellmlAnnotationViewEditingWidget(CellMLAnnot
// Create our two main parts

mCellmlList = new CellmlAnnotationViewCellmlListWidget(this);
mMetadataDetails = new CellmlAnnotationViewMetadataDetailsWidget(pPlugin, pAnnotationWidget, this, mCellmlFile, this);
mMetadataDetails = new CellmlAnnotationViewMetadataDetailsWidget(pPlugin, pAnnotationWidget, this);

// Populate ourselves

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,10 @@ namespace CellMLAnnotationView {

CellmlAnnotationViewMetadataDetailsWidget::CellmlAnnotationViewMetadataDetailsWidget(CellMLAnnotationViewPlugin *pPlugin,
CellmlAnnotationViewWidget *pAnnotationWidget,
CellmlAnnotationViewEditingWidget *pEditingWidget,
CellMLSupport::CellmlFile *pCellmlFile,
QWidget *pParent) :
CellmlAnnotationViewEditingWidget *pParent) :
Widget(pParent),
mPlugin(pPlugin),
mCellmlFile(pCellmlFile),
mCellmlFile(pParent->cellmlFile()),
mElement(0)
{
// Create and set our vertical layout
Expand Down Expand Up @@ -86,8 +84,8 @@ CellmlAnnotationViewMetadataDetailsWidget::CellmlAnnotationViewMetadataDetailsWi

// Create our details widgets

mMetadataEditDetails = new CellmlAnnotationViewMetadataEditDetailsWidget(pAnnotationWidget, pEditingWidget, pCellmlFile, mSplitter);
mMetadataViewDetails = new CellmlAnnotationViewMetadataViewDetailsWidget(pCellmlFile, mSplitter);
mMetadataEditDetails = new CellmlAnnotationViewMetadataEditDetailsWidget(pAnnotationWidget, pParent, mCellmlFile, mSplitter);
mMetadataViewDetails = new CellmlAnnotationViewMetadataViewDetailsWidget(mCellmlFile, mSplitter);
mWebViewer = new WebViewerWidget::WebViewerWidget(mSplitter);

mWebViewer->showProgressBar();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,7 @@ class CellmlAnnotationViewMetadataDetailsWidget : public Core::Widget
public:
explicit CellmlAnnotationViewMetadataDetailsWidget(CellMLAnnotationViewPlugin *pPlugin,
CellmlAnnotationViewWidget *pAnnotationWidget,
CellmlAnnotationViewEditingWidget *pEditingWidget,
CellMLSupport::CellmlFile *pCellmlFile,
QWidget *pParent);
CellmlAnnotationViewEditingWidget *pParent);

void retranslateUi() override;

Expand Down
37 changes: 14 additions & 23 deletions src/plugins/support/CellMLSupport/src/cellmlfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.

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

#include <QDir>
#include <QDomDocument>
#include <QFile>
#include <QStringList>
Expand Down Expand Up @@ -287,7 +288,7 @@ bool CellmlFile::fullyInstantiateImports(iface::cellml_api::Model *pModel,
if (isLocalFile && (pModel == mModel))
dependencies << fileNameOrUrl;
} else {
throw(CellmlFileException(tr("<strong>%1</strong> imports <strong>%2</strong>, which contents could not be retrieved").arg(xmlBaseFileNameOrUrl)
throw(CellmlFileException(tr("<strong>%1</strong> imports <strong>%2</strong>, which contents could not be retrieved").arg(QDir::toNativeSeparators(xmlBaseFileNameOrUrl))
.arg(xlinkHrefString)));
}
}
Expand All @@ -297,9 +298,10 @@ bool CellmlFile::fullyInstantiateImports(iface::cellml_api::Model *pModel,

ObjRef<iface::cellml_api::Model> importModel = import->importedModel();

if (!importModel)
throw(CellmlFileException(tr("<strong>%1</strong> imports <strong>%2</strong>, which CellML object could not be retrieved").arg(xmlBaseFileNameOrUrl)
if (!importModel) {
throw(CellmlFileException(tr("<strong>%1</strong> imports <strong>%2</strong>, which CellML object could not be retrieved").arg(QDir::toNativeSeparators(xmlBaseFileNameOrUrl))
.arg(xlinkHrefString)));
}

retrieveImports(isLocalFile?
QUrl::fromLocalFile(fileNameOrUrl).toString():
Expand Down Expand Up @@ -1176,28 +1178,17 @@ CellmlFile::Version CellmlFile::fileVersion(const QString &pFileName)
{
// Return the version of the given CellML file

CellmlFile *cellmlFile = CellmlFileManager::instance()->cellmlFile(pFileName);

if (cellmlFile) {
// The given CellML file is managed, so simply return its version

return cellmlFile->version();
} else {
// The given CellML file is not managed, so try to load it and return
// its version

ObjRef<iface::cellml_api::CellMLBootstrap> cellmlBootstrap = CreateCellMLBootstrap();
ObjRef<iface::cellml_api::DOMModelLoader> modelLoader = cellmlBootstrap->modelLoader();
ObjRef<iface::cellml_api::Model> model;

try {
model = modelLoader->loadFromURL(QUrl::fromPercentEncoding(QUrl::fromLocalFile(pFileName).toEncoded()).toStdWString());
} catch (...) {
return Unknown;
}
ObjRef<iface::cellml_api::CellMLBootstrap> cellmlBootstrap = CreateCellMLBootstrap();
ObjRef<iface::cellml_api::DOMModelLoader> modelLoader = cellmlBootstrap->modelLoader();
ObjRef<iface::cellml_api::Model> model;

return modelVersion(model);
try {
model = modelLoader->loadFromURL(QUrl::fromPercentEncoding(QUrl::fromLocalFile(pFileName).toEncoded()).toStdWString());
} catch (...) {
return Unknown;
}

return modelVersion(model);
}

//==============================================================================
Expand Down

0 comments on commit 061c60e

Please sign in to comment.