Skip to content
Permalink
Browse files

[pyqgis-console] a better attribute name

  • Loading branch information
slarosa authored and nyalldawson committed Oct 4, 2020
1 parent 7463121 commit f724793cf03542ef3012ef79354081c56b208eba
Showing with 9 additions and 6 deletions.
  1. +9 −6 python/console/console_sci.py
@@ -65,8 +65,9 @@ def __init__(self, parent=None):
self.setMarginLineNumbers(0, False) # NO linenumbers for the input line

self.buffer = []
self.continuationLine = False

self.displayPrompt(self.buffer)
self.displayPrompt(self.continuationLine)

for line in _init_commands:
self.runsource(line)
@@ -212,15 +213,15 @@ def move_cursor_to_start(self):
self.setCursorPosition(0, 0)
self.ensureCursorVisible()
self.ensureLineVisible(0)
self.displayPrompt(self.buffer)
self.displayPrompt(self.continuationLine)

def move_cursor_to_end(self):
"""Move cursor to end of text"""
line, index = self.get_end_pos()
self.setCursorPosition(line, index)
self.ensureCursorVisible()
self.ensureLineVisible(line)
self.displayPrompt(self.buffer)
self.displayPrompt(self.continuationLine)

def is_cursor_on_last_line(self):
"""Return True if cursor is on the last line"""
@@ -417,7 +418,7 @@ def keyPressEvent(self, e):
self.setCursorPosition(line, index + 7)
QsciScintilla.keyPressEvent(self, e)

self.displayPrompt(self.buffer)
self.displayPrompt(self.continuationLine)

def contextMenuEvent(self, e):
menu = QMenu(self)
@@ -538,14 +539,16 @@ def runCommand(self, cmd):
self.buffer.append(cmd)
src = "\n".join(self.buffer)
more = self.runsource(src)
self.continuationLine = True
if not more:
self.continuationLine = False
self.buffer = []

# prevents to commands with more lines to break the console
# in the case they have a eol different from '\n'
self.setText('')
self.move_cursor_to_end()
self.displayPrompt(more)
self.displayPrompt(self.continuationLine)

def write(self, txt):
sys.stderr.write(txt)
@@ -554,7 +557,7 @@ def writeCMD(self, txt):
if sys.stdout:
sys.stdout.fire_keyboard_interrupt = False
if len(txt) > 0:
prompt = "... " if self.buffer else ">>> "
prompt = "... " if self.continuationLine else ">>> "
sys.stdout.write(prompt + txt + '\n')

def runsource(self, source, filename='<input>', symbol='single'):

0 comments on commit f724793

Please sign in to comment.
You can’t perform that action at this time.