Skip to content

Commit

Permalink
Fixed core.resetOutput(); method behaviour (Fix #750)
Browse files Browse the repository at this point in the history
Calling this method should clearing the output file and Output window in
Script Console.
  • Loading branch information
alex-w authored and gzotti committed Dec 23, 2019
1 parent 955d67e commit a8b3f90
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/gui/ScriptConsole.cpp
Expand Up @@ -199,7 +199,7 @@ void ScriptConsole::preprocessScript()
void ScriptConsole::runScript()
{
ui->tabs->setCurrentIndex(1);
ui->logBrowser->setHtml("");
ui->logBrowser->clear();

appendLogLine(QString("Starting script at %1").arg(QDateTime::currentDateTime().toString()));
if (!StelApp::getInstance().getScriptMgr().runScriptDirect(ui->scriptEdit->toPlainText(), ui->includeEdit->text()))
Expand Down Expand Up @@ -239,10 +239,17 @@ void ScriptConsole::appendLogLine(const QString& s)

void ScriptConsole::appendOutputLine(const QString& s)
{
QString html = ui->outputBrowser->toHtml();
html.replace(QRegExp("^\\s+"), "");
html += s;
ui->outputBrowser->setHtml(html);
if (s.isEmpty())
{
ui->outputBrowser->clear();
}
else
{
QString html = ui->outputBrowser->toHtml();
html.replace(QRegExp("^\\s+"), "");
html += s;
ui->outputBrowser->setHtml(html);
}
}


Expand Down
1 change: 1 addition & 0 deletions src/scripting/StelScriptOutput.cpp
Expand Up @@ -48,6 +48,7 @@ void StelScriptOutput::writeLog(QString msg)

void StelScriptOutput::reset(void)
{
outputFile.resize(0);
outputFile.reset();
outputText.clear();
}
Expand Down

0 comments on commit a8b3f90

Please sign in to comment.