diff --git a/tools/lammps-gui/icons/tutorial2-logo.png b/tools/lammps-gui/icons/tutorial2-logo.png new file mode 100644 index 0000000000..dc661decb3 Binary files /dev/null and b/tools/lammps-gui/icons/tutorial2-logo.png differ diff --git a/tools/lammps-gui/lammpsgui.cpp b/tools/lammps-gui/lammpsgui.cpp index 36f22abb5f..89597ec7fe 100644 --- a/tools/lammps-gui/lammpsgui.cpp +++ b/tools/lammps-gui/lammpsgui.cpp @@ -1668,19 +1668,56 @@ QWizardPage *LammpsGui::tutorial1_finish() void LammpsGui::start_tutorial2() { if (wizard) delete wizard; - wizard = new QWizard; + wizard = new Tutorial2Wizard; wizard->addPage(tutorial2_intro()); + wizard->addPage(tutorial2_info()); wizard->addPage(tutorial2_directory()); + wizard->addPage(tutorial2_finish()); wizard->setWindowTitle("Tutorial 2 Setup Wizard"); + wizard->setWizardStyle(QWizard::ModernStyle); wizard->show(); } QWizardPage *LammpsGui::tutorial2_intro() { auto *page = new QWizardPage; - page->setTitle("Starting Tutorial 2"); - auto *label = new QLabel("This wizard will guide you to get set up for working " - "through the Tutorial 2 from lammpstutorials.github.io."); + page->setTitle("Getting Started With Tutorial 2"); + page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png")); + + // XXX TODO: update URL to published tutorial DOI + auto *label = + new QLabel("
This wizard will help you to select and populate a folder with " + "materials required to work through tutorial 2 from a fourthcoming " + "LAMMPS tutorial using LAMMPS-GUI by Simon Gravelle, Jake Gissinger, " + "and Axel Kohlmeyer.
\n" + "The work-in-progress materials for this tutorial are available at: " + "github.com/lammpstutorials/lammpstutorials-articleClick on the \"Next\" button to begin.
"); + label->setWordWrap(true); + + auto *layout = new QVBoxLayout; + layout->addWidget(label); + page->setLayout(layout); + return page; +} + +QWizardPage *LammpsGui::tutorial2_info() +{ + auto *page = new QWizardPage; + page->setTitle("Contents of Tutorial 2"); + page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png")); + + auto *label = + new QLabel("In tutorial 2 you will learn about setting up a simulation for a molecular " + "system with bonds. The target is to simulate a carbon nanotube with a " + "conventional molecular force field under growing strain and observe the " + "response to it. Since bonds are represented by a harmonic potential, they " + "cannot break. This is then compared to simulating the same system with a " + "reactive force field (AIREBO) where bonds may be broken and formed.
" + "Click on the \"Next\" button to select a folder.
"); label->setWordWrap(true); auto *layout = new QVBoxLayout; @@ -1693,11 +1730,79 @@ QWizardPage *LammpsGui::tutorial2_directory() { auto *page = new QWizardPage; page->setTitle("Select Directory for Tutorial 2"); - auto *label = new QLabel("Please select a directory to store the files for tutorial 2"); + page->setPixmap(QWizard::WatermarkPixmap, QPixmap(":/icons/tutorial2-logo.png")); + + auto *frame = new QFrame; + auto *label = new QLabel( + "Select a directory to store the files for tutorial 2. The directory will be " + "created if necessary and LAMMPS-GUI will download the files required for the " + "tutorial.
\n" + "If selected, an existing directory may be cleared.
\n" + "Also, available files of the tutorial solution may be downloaded to a " + "folder \"solution\", if requested.
\n" + "You are now ready to start tutorial 2.
\n" + "Click on the \"Finish\" button to " + "complete the setup.
"); label->setWordWrap(true); auto *layout = new QVBoxLayout; layout->addWidget(label); + layout->setStretch(0, 100); + page->setLayout(layout); return page; } @@ -1881,7 +1986,7 @@ void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, boo lammps.command(QString("shell cd " + dir).toLocal8Bit()); // read and process manifest - lammps.command(geturl.arg(1).arg(".manifest").toLocal8Bit()); + lammps.command(geturl.arg(tutno).arg(".manifest").toLocal8Bit()); QFile manifest(".manifest"); QString line, first; if (manifest.open(QIODevice::ReadOnly)) { @@ -1895,12 +2000,12 @@ void LammpsGui::setup_tutorial(int tutno, const QString &dir, bool purgedir, boo // file in subfolder if (line.contains('/')) { if (getsolution && line.startsWith("solution")) { - lammps.command(geturl.arg(1).arg(line).toLocal8Bit()); + lammps.command(geturl.arg(tutno).arg(line).toLocal8Bit()); } } else { // first file is the initial template if (first.isEmpty()) first = line; - lammps.command(geturl.arg(1).arg(line).toLocal8Bit()); + lammps.command(geturl.arg(tutno).arg(line).toLocal8Bit()); } } manifest.close(); @@ -1948,6 +2053,45 @@ void Tutorial1Wizard::accept() QDialog::accept(); } +Tutorial2Wizard::Tutorial2Wizard(QWidget *parent) : QWizard(parent) +{ + setWindowIcon(QIcon(":/icons/tutorial-logo.png")); +} + +// actions to perform when the wizard for tutorial 2 is complete +// and the user has clicked on "Finish" + +void Tutorial2Wizard::accept() +{ + // get pointers to the widgets with the information we need + auto *dirname = findChild