fix a couple of bugs that would hang the app waiting for log output
This commit is contained in:
@ -369,7 +369,7 @@ void LammpsGui::logupdate()
|
|||||||
double t_elapsed, t_remain, t_total;
|
double t_elapsed, t_remain, t_total;
|
||||||
int completed = 1000;
|
int completed = 1000;
|
||||||
|
|
||||||
if (is_running) {
|
if (lammps.is_running()) {
|
||||||
t_elapsed = lammps.get_thermo("cpu");
|
t_elapsed = lammps.get_thermo("cpu");
|
||||||
t_remain = lammps.get_thermo("cpuremain");
|
t_remain = lammps.get_thermo("cpuremain");
|
||||||
t_total = t_elapsed + t_remain + 1.0e-10;
|
t_total = t_elapsed + t_remain + 1.0e-10;
|
||||||
@ -441,7 +441,8 @@ void LammpsGui::run_buffer()
|
|||||||
clear();
|
clear();
|
||||||
capturer->BeginCapture();
|
capturer->BeginCapture();
|
||||||
|
|
||||||
char *input = mystrdup(ui->textEdit->toPlainText().toStdString());
|
// always add final newline since the text edit widget does not
|
||||||
|
char *input = mystrdup(ui->textEdit->toPlainText().toStdString() + "\n");
|
||||||
is_running = true;
|
is_running = true;
|
||||||
|
|
||||||
LammpsRunner *runner = new LammpsRunner(this);
|
LammpsRunner *runner = new LammpsRunner(this);
|
||||||
@ -524,7 +525,6 @@ void LammpsGui::view_image()
|
|||||||
|
|
||||||
void LammpsGui::clear()
|
void LammpsGui::clear()
|
||||||
{
|
{
|
||||||
if (!lammps.is_open()) lammps.command("clear");
|
|
||||||
ui->textEdit->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
ui->textEdit->moveCursor(QTextCursor::Start, QTextCursor::MoveAnchor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -27,6 +27,7 @@ public:
|
|||||||
// execute LAMMPS in runner thread
|
// execute LAMMPS in runner thread
|
||||||
void run() override
|
void run() override
|
||||||
{
|
{
|
||||||
|
lammps->command("clear");
|
||||||
lammps->commands_string(input);
|
lammps->commands_string(input);
|
||||||
emit resultReady();
|
emit resultReady();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user