Skip to content

Commit

Permalink
fmk - adding citation to Pyrecodes
Browse files Browse the repository at this point in the history
  • Loading branch information
fmckenna committed Jan 27, 2025
1 parent eeca6f0 commit dbb9011
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
20 changes: 13 additions & 7 deletions RecoveryWidgets/Pyrecodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <QJsonObject>


static QString citeText = "Blagojević, Nikola and Stojadinović, Božidar. pyrecodes: an open-source library for regional recovery simulation and disaster resilience assessment of the built environment. (2023) Chair of Structural Dynamics and Earthquake Engineering, ETH Zurich. https://doi.org/10.5905/ethz-1007-700";


Pyrecodes::Pyrecodes(QWidget *parent)
: SimCenterAppWidget(parent), resultsWidget(0)
{
Expand Down Expand Up @@ -116,7 +119,6 @@ Pyrecodes::Pyrecodes(QWidget *parent)
boxLayout->addWidget(inputDataFolder, 0,1, 1,4);
boxLayout->addWidget(r2dResultsFolder, 1,1 ,1,4);


QHBoxLayout *runLayout = new QHBoxLayout();

runLayout->addStretch();
Expand All @@ -125,7 +127,6 @@ Pyrecodes::Pyrecodes(QWidget *parent)
runLayout->addStretch();
//boxLayout->addWidget(runLocal,2,0, 1,5);
boxLayout->addLayout(runLayout,2,0,1,5);

boxLayout->setRowStretch(3,1);

connect(runLocal, &QPushButton::clicked, this, &Pyrecodes::runPyReCodes);
Expand All @@ -134,11 +135,15 @@ Pyrecodes::Pyrecodes(QWidget *parent)
spacer->setFixedHeight(20); // Adjust the height as needed

mainLayout->addWidget(spacer, numRow++, 0);

mainLayout->addWidget(groupBox, numRow++, 0, 1, 5);

QLabel *citeLabel = new QLabel(citeText);
citeLabel->setWordWrap(true);
mainLayout->addWidget(citeLabel, numRow++,0, 1, 5);

mainLayout->setRowStretch(numRow, 1);


//
// create a PyrecodesResults widget and a popup Dialog for showing results if in Dialog
//
Expand Down Expand Up @@ -244,10 +249,9 @@ bool Pyrecodes::copyFiles(QString &destDir) {

}


bool Pyrecodes::outputCitation(QJsonObject &citation){
QString pyrecodesCitationKey = "PyReCoDes";
QJsonValue pyrecodesCitationValue( "\"citations\": [{\"citation\": \"Add\"}]}");
citation.insert(pyrecodesCitationKey, pyrecodesCitationValue);
citation.insert("Recovery",citeText);

return true;
}
Expand Down Expand Up @@ -334,8 +338,10 @@ void Pyrecodes::runPyReCodes() {

qDebug() << "SCRIPT: " << pyScript << " ARGS: " << args << " workDir: " << workDirString;

runLocal->setText("PyReCodes is Running");
runLocal->setText("PyReCodes is now Running");
runLocal->setDisabled(true);

this->statusMessage("PyReCodes is now running in the background ..");

// finally run, connect when done
RunPythonInThread *thePythonProcess = new RunPythonInThread(pyScript, args, workDirString);
Expand Down
2 changes: 1 addition & 1 deletion RecoveryWidgets/Pyrecodes.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*************************************************************************** */

// Written: Sina Naeimi
// Written: Sina Naeimi, fmk

#include <SimCenterAppWidget.h>

Expand Down
4 changes: 2 additions & 2 deletions RecoveryWidgets/PyrecodesResults.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ int PyrecodesResults::processResults(QString &outputDirPath)
resourceList << resource;
SC_MLC_ChartData *resourceLineData = new SC_MLC_ChartData();
resourceLineData->xLabel = "Days";
resourceLineData->yLabel = resource + QString("Supply");
resourceLineData->title = resource + QString("Supply Curve");
resourceLineData->yLabel = resource + QString(" Supply");
resourceLineData->title = resource + QString(" Supply Curve");
multipleLineChartData.insert(resource, resourceLineData);
}
}
Expand Down

0 comments on commit dbb9011

Please sign in to comment.