Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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 74141c0
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions python/console.py
Expand Up @@ -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):
Expand Down Expand Up @@ -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)
Expand All @@ -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 ">>> "
Expand Down

0 comments on commit 74141c0

Please sign in to comment.