Skip to content

Commit

Permalink
Escape <> in python console output so python object display
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@6829 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
gsherman committed Mar 24, 2007
1 parent c09e954 commit ef92d63
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/app/qgspythondialog.cpp
Expand Up @@ -43,8 +43,12 @@ void QgsPythonDialog::on_edtCmdLine_returnPressed()
{
QgsPythonUtils::evalString("sys.stdout.data", output);
QgsPythonUtils::runString("sys.stdout.data = ''");

output += QgsPythonUtils::getResult();
QString result = QgsPythonUtils::getResult();
// escape the result so python objects display properly and
// we can still use html output to get nicely formatted display
result.replace("<","&lt;");
result.replace(">","&gt;");
output += result;

if (!output.isEmpty())
output += "<br>";
Expand All @@ -56,8 +60,8 @@ void QgsPythonDialog::on_edtCmdLine_returnPressed()

output = "<font color=\"red\">" + className + ": " + errorText + "</font><br>";
}

QString str = "<b><font color=\"green\">>>></font> " + command + "</b><br>" + output;
QString str = "<b><font color=\"green\">>>></font> " + command.replace("<","&lt;") + "</b><br>" + output;
txtHistory->setText(txtHistory->text() + str);
edtCmdLine->setText("");

Expand Down

0 comments on commit ef92d63

Please sign in to comment.