make the GUI update interval a configurable option in the preferences

This commit is contained in:
Axel Kohlmeyer
2023-09-14 10:32:10 -04:00
parent 232e57a949
commit 6d12800a0d
4 changed files with 25 additions and 3 deletions

View File

@ -528,6 +528,13 @@ General Settings:
log) of the application can be set.
- *Select Text Font:* Opens a font selection dialog where the type and
size for the text editor and log font of the application can be set.
- *GUI update interval:* Allows to set the time interval between GUI
and data updates during a LAMMPS run in milliseconds. The default is
to update the GUI every 100 milliseconds. This is good for most cases.
For LAMMPS runs that run very fast, however, data may be missed and
through lowering this interval, this can be corrected. However, this
will make the GUI use more resources, which may be a problem on some
computers with slower CPUs. The default value is 100 milliseconds.
Accelerators:
^^^^^^^^^^^^^

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.16)
project(lammps-gui VERSION 1.5.3 LANGUAGES CXX)
project(lammps-gui VERSION 1.5.4 LANGUAGES CXX)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)

View File

@ -1092,7 +1092,7 @@ void LammpsGui::do_run(bool use_buffer)
logupdater = new QTimer(this);
connect(logupdater, &QTimer::timeout, this, &LammpsGui::logupdate);
logupdater->start(100);
logupdater->start(settings.value("updfreq", "100").toInt());
}
void LammpsGui::render_image()

View File

@ -167,6 +167,9 @@ void Preferences::accept()
box = tabWidget->findChild<QCheckBox *>("viewslide");
if (box) settings->setValue("viewslide", box->isChecked());
auto spin = tabWidget->findChild<QSpinBox *>("updfreq");
if (spin) settings->setValue("updfreq", spin->value());
if (need_relaunch) {
QMessageBox msg(QMessageBox::Information, QString("Relaunching LAMMPS-GUI"),
QString("LAMMPS library plugin path was changed.\n"
@ -181,7 +184,7 @@ void Preferences::accept()
// reformatting settings
settings->beginGroup("reformat");
auto spin = tabWidget->findChild<QSpinBox *>("cmdval");
spin = tabWidget->findChild<QSpinBox *>("cmdval");
if (spin) settings->setValue("command", spin->value());
spin = tabWidget->findChild<QSpinBox *>("typeval");
if (spin) settings->setValue("type", spin->value());
@ -254,6 +257,17 @@ GeneralTab::GeneralTab(QSettings *_settings, LammpsWrapper *_lammps, QWidget *pa
connect(getallfont, &QPushButton::released, this, &GeneralTab::newallfont);
connect(gettextfont, &QPushButton::released, this, &GeneralTab::newtextfont);
auto *freqlayout = new QHBoxLayout;
auto *freqlabel = new QLabel("GUI update interval (ms)");
auto *freqval = new QSpinBox;
freqval->setRange(1, 1000);
freqval->setStepType(QAbstractSpinBox::AdaptiveDecimalStepType);
freqval->setValue(settings->value("updfreq", "100").toInt());
freqval->setObjectName("updfreq");
freqlayout->addWidget(freqlabel);
freqlayout->addWidget(freqval);
freqlayout->addStretch(1);
layout->addWidget(echo);
layout->addWidget(cite);
layout->addWidget(logv);
@ -267,6 +281,7 @@ GeneralTab::GeneralTab(QSettings *_settings, LammpsWrapper *_lammps, QWidget *pa
layout->addLayout(pluginlayout);
#endif
layout->addLayout(fontlayout);
layout->addLayout(freqlayout);
layout->addStretch(1);
setLayout(layout);
}