Skip to content

Commit

Permalink
Merge branch 'master' of github.com:NHERI-SimCenter/EE-UQ
Browse files Browse the repository at this point in the history
  • Loading branch information
fmckenna committed Oct 1, 2024
2 parents 1db6876 + f1d9c68 commit 9308307
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 6 deletions.
3 changes: 2 additions & 1 deletion EVENTS/EarthquakeEventSelection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ EarthquakeEventSelection::~EarthquakeEventSelection()
void
EarthquakeEventSelection::replyEventType(void)
{
qDebug() << "EarthquakeEventSelection::replyEventType(void)- HUH";
emit typeEVT("EQ");
//qDebug() << "EarthquakeEventSelection::replyEventType(void)- HUH";

}

Expand Down
56 changes: 51 additions & 5 deletions EVENTS/physicsBasedSimulation/M9SingleSite.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
*************************************************************************** */

// Written: fmckenna

// Written: fmckenna, Amin Pakzad
#include "MainWindow.h"
#include "M9SingleSite.h"
#include <SC_DoubleLineEdit.h>
#include <SC_IntLineEdit.h>
#include <SC_DirEdit.h>
#include <SC_ComboBox.h>
#include <SC_CheckBox.h>

#include <QApplication>
#include <QJsonObject>
#include <QDir>
#include <QDebug>
Expand All @@ -51,7 +51,6 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <QGroupBox>
#include <QWebEngineView>
#include <QWebEngineSettings>
#include <QSplitter>

#include <QGridLayout>
#include <QLabel>
Expand All @@ -63,6 +62,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <QJsonObject>
#include <QJsonArray>
#include <QFile>
#include <QScreen>

M9SingleSite::M9SingleSite(QWidget *parent)
:SimCenterAppWidget(parent), count(0), downloadedMotions(false), motionsDownloading(false)
Expand Down Expand Up @@ -191,6 +191,50 @@ M9SingleSite::downloadMotions(void)
{
qDebug() << "M9SingleSite::downloadMotions called";

// if user has not checked
if (!useAPI->isChecked()) {
// pop up a window to ask for username and password
QDialog *dialog = new QDialog();
dialog->setWindowTitle("Login to Tapis");
QVBoxLayout *layout = new QVBoxLayout(dialog);
QLineEdit *usernameEdit = new QLineEdit(dialog);
usernameEdit->setPlaceholderText("Username");
layout->addWidget(usernameEdit);
QLineEdit *passwordEdit = new QLineEdit(dialog);
passwordEdit->setPlaceholderText("Password");
passwordEdit->setEchoMode(QLineEdit::Password);
layout->addWidget(passwordEdit);
QPushButton *loginButton = new QPushButton("Login", dialog);
layout->addWidget(loginButton);
dialog->setLayout(layout);
connect(loginButton, &QPushButton::clicked, [=]() {
// check if the username and password are not empty
if (usernameEdit->text().isEmpty() || passwordEdit->text().isEmpty()) {
errorMessage("Error: Username and password cannot be empty");
return;
}
// close the dialog
dialog->accept();

});
// make the dialog appear in the center of the screen i nstead of the top left corner
// keep the dialog dimensions the same
QScreen *screen = qApp->primaryScreen();
QRect screenGeometry = screen->availableGeometry();
int x = (screenGeometry.width() - dialog->width()) / 2;
int y = (screenGeometry.height() - dialog->height()) / 2;
dialog->move(x, y);
dialog->exec();
// save the username and password
username = usernameEdit->text();
password = passwordEdit->text();

}





//
// get tmp directory to store motions, if it exists remove
//
Expand Down Expand Up @@ -230,7 +274,9 @@ M9SingleSite::downloadMotions(void)
<< QString("-g") << currentGrid
<< QString("-n") << QString::number(numMotion)
<< QString("-o") << destDir
<< QString("--API") << QString::number(useAPI->isChecked());
<< QString("--API") << QString::number(useAPI->isChecked())
<< "--username" << username
<< "--password" << password;

/*
QJsonObject information;
Expand Down
2 changes: 2 additions & 0 deletions EVENTS/physicsBasedSimulation/M9SingleSite.h
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,8 @@ public slots:
QPushButton *getMotions;
bool downloadedMotions;
bool motionsDownloading;
QString username;
QString password;
};

#endif // M9_SINGLE_SITE_WIDGET_H
10 changes: 10 additions & 0 deletions WorkflowAppEE_UQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
#include <RemoteOpenSeesApp.h>
#include <QList>
#include <ShakerMaker.h>
#include <DRM_Model.h>
#include <peerNGA/PEER_NGA_Records.h>
#include "CustomizedItemModel.h"

Expand Down Expand Up @@ -245,6 +246,15 @@ WorkflowAppEE_UQ::setMainWindow(MainWindowWorkflowApp* window) {
theDialog->showTool("ShakerMaker");
});

// DRM Model
DRM_Model *theDRM_Model = new DRM_Model();
theToolDialog->addTool(theDRM_Model, "Domain Reduction Method Analysis");
QAction *showDRM_Model = toolsMenu->addAction("&Domain Reduction Method Analysis");
connect(showDRM_Model, &QAction::triggered, this,[this, theDialog=theToolDialog, theEmp = theDRM_Model] {
theDialog->showTool("Domain Reduction Method Analysis");
});


// opensees@designsafe
RemoteOpenSeesApp *theOpenSeesApp = new RemoteOpenSeesApp();

Expand Down

0 comments on commit 9308307

Please sign in to comment.