partial implementation of wizards to start tutorials
This commit is contained in:
BIN
tools/lammps-gui/icons/tutorial1-logo.png
Normal file
BIN
tools/lammps-gui/icons/tutorial1-logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 106 KiB |
@ -37,6 +37,7 @@
|
|||||||
#include <QFont>
|
#include <QFont>
|
||||||
#include <QGuiApplication>
|
#include <QGuiApplication>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QLineEdit>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QProcess>
|
#include <QProcess>
|
||||||
@ -49,6 +50,8 @@
|
|||||||
#include <QTextStream>
|
#include <QTextStream>
|
||||||
#include <QTimer>
|
#include <QTimer>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
#include <QWizard>
|
||||||
|
#include <QWizardPage>
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
@ -67,8 +70,8 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
QMainWindow(parent), ui(new Ui::LammpsGui), highlighter(nullptr), capturer(nullptr),
|
QMainWindow(parent), ui(new Ui::LammpsGui), highlighter(nullptr), capturer(nullptr),
|
||||||
status(nullptr), logwindow(nullptr), imagewindow(nullptr), chartwindow(nullptr),
|
status(nullptr), logwindow(nullptr), imagewindow(nullptr), chartwindow(nullptr),
|
||||||
slideshow(nullptr), logupdater(nullptr), dirstatus(nullptr), progress(nullptr),
|
slideshow(nullptr), logupdater(nullptr), dirstatus(nullptr), progress(nullptr),
|
||||||
prefdialog(nullptr), lammpsstatus(nullptr), varwindow(nullptr), runner(nullptr),
|
prefdialog(nullptr), lammpsstatus(nullptr), varwindow(nullptr), wizard(nullptr),
|
||||||
is_running(false), run_counter(0)
|
runner(nullptr), is_running(false), run_counter(0)
|
||||||
{
|
{
|
||||||
// enforce using the plain ASCII C locale within the GUI.
|
// enforce using the plain ASCII C locale within the GUI.
|
||||||
QLocale::setDefault(QLocale("C"));
|
QLocale::setDefault(QLocale("C"));
|
||||||
@ -213,11 +216,13 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
|
|||||||
connect(ui->actionStop_LAMMPS, &QAction::triggered, this, &LammpsGui::stop_run);
|
connect(ui->actionStop_LAMMPS, &QAction::triggered, this, &LammpsGui::stop_run);
|
||||||
connect(ui->actionSet_Variables, &QAction::triggered, this, &LammpsGui::edit_variables);
|
connect(ui->actionSet_Variables, &QAction::triggered, this, &LammpsGui::edit_variables);
|
||||||
connect(ui->actionImage, &QAction::triggered, this, &LammpsGui::render_image);
|
connect(ui->actionImage, &QAction::triggered, this, &LammpsGui::render_image);
|
||||||
|
connect(ui->actionLAMMPS_Tutorial, &QAction::triggered, this, &LammpsGui::tutorial_web);
|
||||||
|
connect(ui->actionTutorial1, &QAction::triggered, this, &LammpsGui::start_tutorial1);
|
||||||
|
connect(ui->actionTutorial2, &QAction::triggered, this, &LammpsGui::start_tutorial2);
|
||||||
connect(ui->actionAbout_LAMMPS_GUI, &QAction::triggered, this, &LammpsGui::about);
|
connect(ui->actionAbout_LAMMPS_GUI, &QAction::triggered, this, &LammpsGui::about);
|
||||||
connect(ui->action_Help, &QAction::triggered, this, &LammpsGui::help);
|
connect(ui->action_Help, &QAction::triggered, this, &LammpsGui::help);
|
||||||
connect(ui->actionLAMMPS_GUI_Howto, &QAction::triggered, this, &LammpsGui::howto);
|
connect(ui->actionLAMMPS_GUI_Howto, &QAction::triggered, this, &LammpsGui::howto);
|
||||||
connect(ui->actionLAMMPS_Manual, &QAction::triggered, this, &LammpsGui::manual);
|
connect(ui->actionLAMMPS_Manual, &QAction::triggered, this, &LammpsGui::manual);
|
||||||
connect(ui->actionLAMMPS_Tutorial, &QAction::triggered, this, &LammpsGui::tutorial);
|
|
||||||
connect(ui->actionPreferences, &QAction::triggered, this, &LammpsGui::preferences);
|
connect(ui->actionPreferences, &QAction::triggered, this, &LammpsGui::preferences);
|
||||||
connect(ui->actionDefaults, &QAction::triggered, this, &LammpsGui::defaults);
|
connect(ui->actionDefaults, &QAction::triggered, this, &LammpsGui::defaults);
|
||||||
connect(ui->actionView_in_OVITO, &QAction::triggered, this, &LammpsGui::start_exe);
|
connect(ui->actionView_in_OVITO, &QAction::triggered, this, &LammpsGui::start_exe);
|
||||||
@ -1495,11 +1500,113 @@ void LammpsGui::manual()
|
|||||||
QDesktopServices::openUrl(QUrl(QString("https://docs.lammps.org%1").arg(docver)));
|
QDesktopServices::openUrl(QUrl(QString("https://docs.lammps.org%1").arg(docver)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void LammpsGui::tutorial()
|
void LammpsGui::tutorial_web()
|
||||||
{
|
{
|
||||||
QDesktopServices::openUrl(QUrl("https://lammpstutorials.github.io/"));
|
QDesktopServices::openUrl(QUrl("https://lammpstutorials.github.io/"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LammpsGui::start_tutorial1()
|
||||||
|
{
|
||||||
|
if (wizard) delete wizard;
|
||||||
|
wizard = new QWizard;
|
||||||
|
wizard->addPage(tutorial1_intro());
|
||||||
|
wizard->addPage(tutorial1_directory());
|
||||||
|
wizard->setWindowTitle("Tutorial 1 Setup Wizard");
|
||||||
|
wizard->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
QWizardPage *LammpsGui::tutorial1_intro()
|
||||||
|
{
|
||||||
|
auto *page = new QWizardPage;
|
||||||
|
page->setTitle("Getting Started With Tutorial 1");
|
||||||
|
auto *logo = new QLabel;
|
||||||
|
logo->setPixmap(QPixmap(":/icons/tutorial1-logo.png"));
|
||||||
|
logo->setFrameStyle(QFrame::Panel);
|
||||||
|
logo->setLineWidth(2);
|
||||||
|
auto *label = new QLabel("<p>This wizard will help you to select and populate a folder "
|
||||||
|
"with the materials to work through Tutorial 1 from the LAMMPS "
|
||||||
|
"tutorials by Simon Gravelle at <b>lammpstutorials.github.io</b>.</p>"
|
||||||
|
"Please click on \"Next\" to begin.");
|
||||||
|
label->setWordWrap(true);
|
||||||
|
label->setMargin(10);
|
||||||
|
label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||||
|
label->setLineWidth(2);
|
||||||
|
auto *main = new QHBoxLayout;
|
||||||
|
main->addWidget(logo);
|
||||||
|
main->addWidget(label);
|
||||||
|
main->setStretch(0, 0);
|
||||||
|
main->setStretch(1, 100);
|
||||||
|
|
||||||
|
auto *layout = new QVBoxLayout;
|
||||||
|
layout->addLayout(main);
|
||||||
|
page->setLayout(layout);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
QWizardPage *LammpsGui::tutorial1_directory()
|
||||||
|
{
|
||||||
|
auto *page = new QWizardPage;
|
||||||
|
page->setTitle("Select Directory for Tutorial 1");
|
||||||
|
auto *logo = new QLabel;
|
||||||
|
logo->setPixmap(QPixmap(":/icons/tutorial1-logo.png"));
|
||||||
|
logo->setFrameStyle(QFrame::Panel);
|
||||||
|
logo->setLineWidth(2);
|
||||||
|
auto *label = new QLabel("Please select a directory to store the files for Tutorial 1");
|
||||||
|
label->setWordWrap(true);
|
||||||
|
label->setMargin(10);
|
||||||
|
label->setFrameStyle(QFrame::Panel | QFrame::Sunken);
|
||||||
|
label->setLineWidth(2);
|
||||||
|
auto *main = new QHBoxLayout;
|
||||||
|
main->addWidget(logo);
|
||||||
|
main->addWidget(label);
|
||||||
|
main->setStretch(0, 0);
|
||||||
|
main->setStretch(1, 100);
|
||||||
|
|
||||||
|
auto *directory = new QLineEdit(current_dir + "/" + "my-first-input");
|
||||||
|
auto *layout = new QVBoxLayout;
|
||||||
|
layout->addLayout(main);
|
||||||
|
layout->addWidget(directory);
|
||||||
|
page->setLayout(layout);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
void LammpsGui::start_tutorial2()
|
||||||
|
{
|
||||||
|
if (wizard) delete wizard;
|
||||||
|
wizard = new QWizard;
|
||||||
|
wizard->addPage(tutorial2_intro());
|
||||||
|
wizard->addPage(tutorial2_directory());
|
||||||
|
wizard->setWindowTitle("Tutorial 2 Setup Wizard");
|
||||||
|
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.");
|
||||||
|
label->setWordWrap(true);
|
||||||
|
|
||||||
|
auto *layout = new QVBoxLayout;
|
||||||
|
layout->addWidget(label);
|
||||||
|
page->setLayout(layout);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
label->setWordWrap(true);
|
||||||
|
|
||||||
|
auto *layout = new QVBoxLayout;
|
||||||
|
layout->addWidget(label);
|
||||||
|
page->setLayout(layout);
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
void LammpsGui::howto()
|
void LammpsGui::howto()
|
||||||
{
|
{
|
||||||
if (docver.isEmpty()) setDocver();
|
if (docver.isEmpty()) setDocver();
|
||||||
|
|||||||
@ -34,9 +34,13 @@
|
|||||||
|
|
||||||
// forward declarations
|
// forward declarations
|
||||||
|
|
||||||
class GeneralTab;
|
class QLabel;
|
||||||
class LammpsRunner;
|
class QPlainTextEdit;
|
||||||
class LogWindow;
|
class QProgressBar;
|
||||||
|
class QTimer;
|
||||||
|
class QWidget;
|
||||||
|
class QWizard;
|
||||||
|
class QWizardPage;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
@ -44,18 +48,15 @@ class LammpsGui;
|
|||||||
}
|
}
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class QLabel;
|
|
||||||
class QPlainTextEdit;
|
|
||||||
class QProgressBar;
|
|
||||||
class QTimer;
|
|
||||||
class QWidget;
|
|
||||||
|
|
||||||
class Highlighter;
|
|
||||||
class StdCapture;
|
|
||||||
class Preferences;
|
|
||||||
class ImageViewer;
|
|
||||||
class ChartWindow;
|
class ChartWindow;
|
||||||
|
class GeneralTab;
|
||||||
|
class Highlighter;
|
||||||
|
class ImageViewer;
|
||||||
|
class LammpsRunner;
|
||||||
|
class LogWindow;
|
||||||
|
class Preferences;
|
||||||
class SlideShow;
|
class SlideShow;
|
||||||
|
class StdCapture;
|
||||||
|
|
||||||
class LammpsGui : public QMainWindow {
|
class LammpsGui : public QMainWindow {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@ -79,6 +80,10 @@ protected:
|
|||||||
void run_done();
|
void run_done();
|
||||||
void setDocver();
|
void setDocver();
|
||||||
void autoSave();
|
void autoSave();
|
||||||
|
QWizardPage *tutorial1_intro();
|
||||||
|
QWizardPage *tutorial1_directory();
|
||||||
|
QWizardPage *tutorial2_intro();
|
||||||
|
QWizardPage *tutorial2_directory();
|
||||||
void purge_inspect_list();
|
void purge_inspect_list();
|
||||||
bool eventFilter(QObject *watched, QEvent *event) override;
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
||||||
|
|
||||||
@ -113,7 +118,9 @@ private slots:
|
|||||||
void about();
|
void about();
|
||||||
void help();
|
void help();
|
||||||
void manual();
|
void manual();
|
||||||
void tutorial();
|
void tutorial_web();
|
||||||
|
void start_tutorial1();
|
||||||
|
void start_tutorial2();
|
||||||
void howto();
|
void howto();
|
||||||
void logupdate();
|
void logupdate();
|
||||||
void modified();
|
void modified();
|
||||||
@ -137,6 +144,7 @@ private:
|
|||||||
Preferences *prefdialog;
|
Preferences *prefdialog;
|
||||||
QLabel *lammpsstatus;
|
QLabel *lammpsstatus;
|
||||||
QLabel *varwindow;
|
QLabel *varwindow;
|
||||||
|
QWizard *wizard;
|
||||||
|
|
||||||
struct InspectData {
|
struct InspectData {
|
||||||
QWidget *info;
|
QWidget *info;
|
||||||
|
|||||||
@ -2,6 +2,7 @@
|
|||||||
<RCC>
|
<RCC>
|
||||||
<qresource prefix="/">
|
<qresource prefix="/">
|
||||||
<file>icons/lammps-icon-128x128.png</file>
|
<file>icons/lammps-icon-128x128.png</file>
|
||||||
|
<file>icons/tutorial1-logo.png</file>
|
||||||
<file>help_index.table</file>
|
<file>help_index.table</file>
|
||||||
<!-- This file is updated with: grep 'mycmd ==' ../../src/input.cpp | sed -e 's/^.*mycmd == "\(.*\)".*$/\1/' > lammps_internal_commands.txt -->
|
<!-- This file is updated with: grep 'mycmd ==' ../../src/input.cpp | sed -e 's/^.*mycmd == "\(.*\)".*$/\1/' > lammps_internal_commands.txt -->
|
||||||
<file>lammps_internal_commands.txt</file>
|
<file>lammps_internal_commands.txt</file>
|
||||||
|
|||||||
@ -79,6 +79,16 @@
|
|||||||
<addaction name="actionView_in_OVITO"/>
|
<addaction name="actionView_in_OVITO"/>
|
||||||
<addaction name="actionView_in_VMD"/>
|
<addaction name="actionView_in_VMD"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QMenu" name="menu_Tutorial">
|
||||||
|
<property name="title">
|
||||||
|
<string>&Tutorials</string>
|
||||||
|
</property>
|
||||||
|
<addaction name="actionLAMMPS_Tutorial"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
<addaction name="actionTutorial1"/>
|
||||||
|
<addaction name="actionTutorial2"/>
|
||||||
|
<addaction name="separator"/>
|
||||||
|
</widget>
|
||||||
<widget class="QMenu" name="menuAbout">
|
<widget class="QMenu" name="menuAbout">
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&About</string>
|
<string>&About</string>
|
||||||
@ -103,6 +113,7 @@
|
|||||||
<addaction name="menuEdit"/>
|
<addaction name="menuEdit"/>
|
||||||
<addaction name="menu_Run"/>
|
<addaction name="menu_Run"/>
|
||||||
<addaction name="menu_View"/>
|
<addaction name="menu_View"/>
|
||||||
|
<addaction name="menu_Tutorial"/>
|
||||||
<addaction name="menuAbout"/>
|
<addaction name="menuAbout"/>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QStatusBar" name="statusbar"/>
|
<widget class="QStatusBar" name="statusbar"/>
|
||||||
@ -320,7 +331,7 @@
|
|||||||
<iconset theme=":/icons/help-browser.png"/>
|
<iconset theme=":/icons/help-browser.png"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>LAMMPS &Manual</string>
|
<string>LAMMPS Online &Manual</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+Shift+M</string>
|
<string>Ctrl+Shift+M</string>
|
||||||
@ -331,7 +342,7 @@
|
|||||||
<iconset theme=":/icons/help-tutorial.png"/>
|
<iconset theme=":/icons/help-tutorial.png"/>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>LAMMPS &Tutorial</string>
|
<string>LAMMPS &Tutorial Website</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="shortcut">
|
<property name="shortcut">
|
||||||
<string>Ctrl+Shift+T</string>
|
<string>Ctrl+Shift+T</string>
|
||||||
@ -473,6 +484,22 @@
|
|||||||
<string>Ctrl+Shift+W</string>
|
<string>Ctrl+Shift+W</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="actionTutorial1">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme=":/icons/document-new.png"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Start LAMMPS Tutorial &1</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="actionTutorial2">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme=":/icons/document-new.png"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Start LAMMPS Tutorial &2</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
<action name="actionLAMMPS_GUI_Howto">
|
<action name="actionLAMMPS_GUI_Howto">
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset theme=":/icons/system-help.png"/>
|
<iconset theme=":/icons/system-help.png"/>
|
||||||
|
|||||||
Reference in New Issue
Block a user