Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
from decorator.Display import Display
from decorator.Border import Border
class FullBorder(Border, Display):
def getColumns(self):
return 1 + self.display.getColumns() + 1
def getRows(self):
return 1 + self.display.getRows() + 1
def getRowText(self, row):
if row == 0:
return "+{0}+".format(self.makeLine('-', self.display.getColumns()))
elif row == self.display.getRows() + 1:
return "+{0}+".format(self.makeLine('-', self.display.getColumns()))
else:
return "|{0}|".format(self.display.getRowText(row - 1))
def makeLine(self, ch, count):
buf = ""
from decorator.Display import Display
class StringDisplay(Display):
def __init__(self, string):
self.string = string
def getColumns(self):
return len(self.string)
def getRows(self):
return 1
def getRowText(self, row):
return self.string if row == 0 else None
from Border import Border
from decorator.Display import Display
class SideBorder(Border, Display):
def __init__(self, display, ch):
super().__init__(display)
self.borderChar = ch
def getColumns(self):
return 1 + self.display.getColumns() + 1
def getRows(self):
return self.display.getRows()
def getRowText(self, row):
return self.borderChar + self.display.getRowText(row) + self.borderChar