Add menu entries to open LAMMPS tutorial website

This commit is contained in:
Axel Kohlmeyer
2024-07-25 22:14:06 -04:00
parent 26503c948a
commit c8818a16c5
11 changed files with 41 additions and 5 deletions

View File

@ -559,6 +559,9 @@ a minimal description of LAMMPS-GUI. The ``LAMMPS-GUI Howto`` entry
will open this documentation page from the online documentation in a web will open this documentation page from the online documentation in a web
browser window. The ``LAMMPS Manual`` entry will open the main page of browser window. The ``LAMMPS Manual`` entry will open the main page of
the LAMMPS online documentation in a web browser window. the LAMMPS online documentation in a web browser window.
The ``LAMMPS Tutorial`` entry will open the main page of the set of
LAMMPS tutorials authored and maintained by Simon Gravelle at
https://lammpstutorials.github.io/ in a web browser window.
----- -----
@ -744,12 +747,12 @@ available (On macOS use the Command key instead of Ctrl/Control).
- Reformat line - Reformat line
- Shift+TAB - Shift+TAB
- Show Completions - Show Completions
* - Ctrl+Shift+Enter * - Ctrl+Shift+T
- LAMMPS Tutorial
- Ctrl+Shift+Enter
- Run File - Run File
- -
- -
-
-
Further editing keybindings `are documented with the Qt documentation Further editing keybindings `are documented with the Qt documentation
<https://doc.qt.io/qt-5/qplaintextedit.html#editing-key-bindings>`_. In <https://doc.qt.io/qt-5/qplaintextedit.html#editing-key-bindings>`_. In

View File

@ -1355,6 +1355,7 @@ Grama
grana grana
granregion granregion
graphene graphene
Gravelle
Greathouse Greathouse
greenyellow greenyellow
Greffet Greffet

View File

@ -199,7 +199,7 @@ if(APPLE)
MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION} MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
MACOSX_BUNDLE_ICON_FILE lammps.icns MACOSX_BUNDLE_ICON_FILE lammps.icns
MACOSX_BUNDLE_COPYRIGHT "(c) 2003 - 2023, The LAMMPS Developers" MACOSX_BUNDLE_COPYRIGHT "(c) 2003 - 2024, The LAMMPS Developers"
MACOSX_BUNDLE TRUE MACOSX_BUNDLE TRUE
) )
# additional targets to populate the bundle tree and create the .dmg image file # additional targets to populate the bundle tree and create the .dmg image file

View File

@ -775,6 +775,11 @@ void CodeEditor::contextMenuEvent(QContextMenuEvent *event)
action->setData(QString()); action->setData(QString());
connect(action, &QAction::triggered, this, &CodeEditor::open_help); connect(action, &QAction::triggered, this, &CodeEditor::open_help);
action = menu->addAction(QString("LAMMPS Tutorial"));
action->setIcon(QIcon(":/icons/help-tutorial.png"));
action->setData(QString("https://lammpstutorials.github.io/"));
connect(action, &QAction::triggered, this, &CodeEditor::open_url);
menu->exec(event->globalPos()); menu->exec(event->globalPos());
delete menu; delete menu;
} }
@ -1208,6 +1213,12 @@ void CodeEditor::open_help()
QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString()))); QUrl(QString("https://docs.lammps.org/%1").arg(act->data().toString())));
} }
void CodeEditor::open_url()
{
auto *act = qobject_cast<QAction *>(sender());
QDesktopServices::openUrl(QUrl(act->data().toString()));
}
void CodeEditor::view_file() void CodeEditor::view_file()
{ {
auto *act = qobject_cast<QAction *>(sender()); auto *act = qobject_cast<QAction *>(sender());

View File

@ -78,6 +78,7 @@ private slots:
void get_help(); void get_help();
void find_help(QString &page, QString &help); void find_help(QString &page, QString &help);
void open_help(); void open_help();
void open_url();
void view_file(); void view_file();
void reformatCurrentLine(); void reformatCurrentLine();
void runCompletion(); void runCompletion();

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.0 KiB

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

View File

@ -210,6 +210,7 @@ LammpsGui::LammpsGui(QWidget *parent, const char *filename) :
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);
@ -1332,6 +1333,11 @@ void LammpsGui::manual()
QDesktopServices::openUrl(QUrl("https://docs.lammps.org/")); QDesktopServices::openUrl(QUrl("https://docs.lammps.org/"));
} }
void LammpsGui::tutorial()
{
QDesktopServices::openUrl(QUrl("https://lammpstutorials.github.io/"));
}
void LammpsGui::howto() void LammpsGui::howto()
{ {
QDesktopServices::openUrl(QUrl("https://docs.lammps.org/Howto_lammps_gui.html")); QDesktopServices::openUrl(QUrl("https://docs.lammps.org/Howto_lammps_gui.html"));

View File

@ -99,6 +99,7 @@ private slots:
void about(); void about();
void help(); void help();
void manual(); void manual();
void tutorial();
void howto(); void howto();
void logupdate(); void logupdate();
void modified(); void modified();

View File

@ -40,6 +40,7 @@
<file>icons/help-about.png</file> <file>icons/help-about.png</file>
<file>icons/help-browser.png</file> <file>icons/help-browser.png</file>
<file>icons/help-faq.png</file> <file>icons/help-faq.png</file>
<file>icons/help-tutorial.png</file>
<file>icons/image-x-generic.png</file> <file>icons/image-x-generic.png</file>
<file>icons/media-playback-start-2.png</file> <file>icons/media-playback-start-2.png</file>
<file>icons/media-playlist-repeat.png</file> <file>icons/media-playlist-repeat.png</file>

View File

@ -86,6 +86,7 @@
<addaction name="action_Help"/> <addaction name="action_Help"/>
<addaction name="actionLAMMPS_GUI_Howto"/> <addaction name="actionLAMMPS_GUI_Howto"/>
<addaction name="actionLAMMPS_Manual"/> <addaction name="actionLAMMPS_Manual"/>
<addaction name="actionLAMMPS_Tutorial"/>
</widget> </widget>
<widget class="QMenu" name="menu_View"> <widget class="QMenu" name="menu_View">
<property name="title"> <property name="title">
@ -313,6 +314,17 @@
<string>Ctrl+Shift+M</string> <string>Ctrl+Shift+M</string>
</property> </property>
</action> </action>
<action name="actionLAMMPS_Tutorial">
<property name="icon">
<iconset theme=":/icons/help-tutorial.png"/>
</property>
<property name="text">
<string>LAMMPS &amp;Tutorial</string>
</property>
<property name="shortcut">
<string>Ctrl+Shift+T</string>
</property>
</action>
<action name="actionDefaults"> <action name="actionDefaults">
<property name="icon"> <property name="icon">
<iconset theme=":/icons/document-revert.png"/> <iconset theme=":/icons/document-revert.png"/>
@ -454,7 +466,7 @@
<iconset theme=":/icons/system-help.png"/> <iconset theme=":/icons/system-help.png"/>
</property> </property>
<property name="text"> <property name="text">
<string>LAMMPS-GUI Howto</string> <string>LAMMPS-&amp;GUI Howto</string>
</property> </property>
<property name="shortcut"> <property name="shortcut">
<string>Ctrl+Shift+G</string> <string>Ctrl+Shift+G</string>