Skip to content
Permalink
Browse files
Escape <> in python console output so python object display
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 ef92d63882e3a0e88be25dbec887f65a614d82ee
Showing with 8 additions and 4 deletions.
  1. +8 −4 src/app/qgspythondialog.cpp
@@ -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>";
@@ -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("");

0 comments on commit ef92d63

Please sign in to comment.