Add comments to all methods in UiConsole class
This commit is contained in:
parent
2cebcd3be6
commit
22355dc960
@ -40,7 +40,11 @@ class UiConsole(UiElement):
|
|||||||
"""
|
"""
|
||||||
self.addLinesToConsoleAndScrollToDisplayThem([inp])
|
self.addLinesToConsoleAndScrollToDisplayThem([inp])
|
||||||
|
|
||||||
def writeConsoleLines(self, startingLineInd=0):
|
def writeConsoleLines(self, startingLineInd: int = 0):
|
||||||
|
"""
|
||||||
|
Displays lines stored in console's list of lines, starting from line with given index.
|
||||||
|
:param startingLineInd: Line index, which will be written on top of the console.
|
||||||
|
"""
|
||||||
self.image.fill(self.bgColor)
|
self.image.fill(self.bgColor)
|
||||||
if startingLineInd < 0:
|
if startingLineInd < 0:
|
||||||
startingLineInd = 0
|
startingLineInd = 0
|
||||||
@ -53,6 +57,13 @@ class UiConsole(UiElement):
|
|||||||
writtenLines += 1
|
writtenLines += 1
|
||||||
|
|
||||||
def addLinesToConsole(self, linesToAdd):
|
def addLinesToConsole(self, linesToAdd):
|
||||||
|
"""
|
||||||
|
Adds lines to console's list of lines. If one line is too long to display, then it is being cut to pieces,
|
||||||
|
so that it is appropriate size.
|
||||||
|
|
||||||
|
Warning: this method doesn't display given lines, just adds to list of lines.
|
||||||
|
:param linesToAdd:
|
||||||
|
"""
|
||||||
for line in linesToAdd:
|
for line in linesToAdd:
|
||||||
self.consoleLines.append(line)
|
self.consoleLines.append(line)
|
||||||
self.linesCount += 1
|
self.linesCount += 1
|
||||||
@ -81,6 +92,10 @@ class UiConsole(UiElement):
|
|||||||
self.linesImagesCount += 1
|
self.linesImagesCount += 1
|
||||||
|
|
||||||
def addLinesToConsoleAndScrollToDisplayThem(self, linesToAdd):
|
def addLinesToConsoleAndScrollToDisplayThem(self, linesToAdd):
|
||||||
|
"""
|
||||||
|
Adds given lines to console's list of lines, writes them and scrolls console down to display them.
|
||||||
|
:param linesToAdd: Lines to add to console's list of lines and to display.
|
||||||
|
"""
|
||||||
self.addLinesToConsole(linesToAdd)
|
self.addLinesToConsole(linesToAdd)
|
||||||
ind = 0
|
ind = 0
|
||||||
if self.linesImagesCount > self.maxLines:
|
if self.linesImagesCount > self.maxLines:
|
||||||
|
Loading…
Reference in New Issue
Block a user