How to use the decorator.Display.Display function in decorator

To help you get started, we’ve selected a few decorator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Relph1119 / GraphicDesignPatternByPython / src / decorator / FullBorder.py View on Github external
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 = ""
github Relph1119 / GraphicDesignPatternByPython / src / decorator / StringDisplay.py View on Github external
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
github Relph1119 / GraphicDesignPatternByPython / src / decorator / SideBorder.py View on Github external
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