Skip to content
Permalink
Browse files
Added clearConsole() to Python console. Contributed by Nathan Woodrow…
… - thanks!

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@14999 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder committed Jan 5, 2011
1 parent 3120590 commit 74141c026e30de1aa74a3025b19beb9201855f0c
Showing with 19 additions and 5 deletions.
  1. +19 −5 python/console.py
@@ -48,11 +48,17 @@ def show_console():
_console.edit.setFocus()



_old_stdout = sys.stdout
_console_output = None


def clearConsole():
global _console
if _console is None:
return
_console.edit.clearConsole()


# hook for python console so all output will be redirected
# and then shown in console
def console_displayhook(obj):
@@ -135,10 +141,8 @@ def __init__(self,parent=None):
self.setFont(monofont)

self.buffer = []

self.insertTaggedText(QCoreApplication.translate("PythonConsole", "To access Quantum GIS environment from this console\n"
"use qgis.utils.iface object (instance of QgisInterface class).\n\n"),
ConsoleHighlighter.INIT)

self.insertInitText()

for line in _init_commands:
self.runsource(line)
@@ -149,6 +153,16 @@ def __init__(self,parent=None):
self.historyIndex = 0

self.high = ConsoleHighlighter(self)

def insertInitText(self):
self.insertTaggedText(QCoreApplication.translate("PythonConsole", "To access Quantum GIS environment from this console\n"
"use qgis.utils.iface object (instance of QgisInterface class).\n\n"),
ConsoleHighlighter.INIT)


def clearConsole(self):
self.clear()
self.insertInitText()

def displayPrompt(self, more=False):
self.currentPrompt = "... " if more else ">>> "

0 comments on commit 74141c0

Please sign in to comment.