def draw(self): minY = min(self.size.y, self.terminal.rows) minX = min(self.size.x, self.terminal.cols) for y in range(minY): buffer = DrawBuffer(True) for x in range(minX): cell = self.terminal.cells[y][x] attr = cell.attr c = cell.color if attr & curses.A_REVERSE: c = self.reverseColor(c) buffer.putAttribute(x, c) buffer.putChar(x, chr(cell.char)) self.writeLine(0, y, minX, 1, buffer) self.setCursor(self.terminal.currCol, self.terminal.currRow) if self.terminal.state & STATE_CURSOR_INVIS: self.hideCursor() else: self.showCursor() if self.terminal.state & STATE_TITLE_CHANGED: self.window.setTitle(self.terminal.title) self.terminal.state &= ~STATE_TITLE_CHANGED
def draw(self): b = DrawBuffer() b.moveChar(0, ' ', 0x70, self.size.x) for y in range(self.size.y + 1): if y < 4: for x in range(4): c = y * 4 + x b.moveChar(x * 3, self.icon, c, 3) if c == self._color: b.putChar(x * 3 + 1, self.icon_reversed) if c == 0: b.putAttribute(x * 3 + 1, 0x70) self.writeLine(0, y, self.size.x, 1, b)
def drawState(self, down): b = DrawBuffer() ch = ' ' if self.state & sfDisabled: cButton = self.getColor(0x0404) else: cButton = self.getColor(0x0501) if self.state & sfActive: if self.state & sfSelected: cButton = self.getColor(0x0703) elif self._amDefault: cButton = self.getColor(0x0602) cShadow = self.getColor(8) s = self.size.x - 1 titleRow = self.size.y // 2 - 1 for y in range(self.size.y - 1): b.moveChar(0, ' ', cButton, self.size.x) b.putAttribute(0, cShadow) if down: b.putAttribute(1, cShadow) ch = ' ' i = 2 else: b.putAttribute(s, cShadow) if self.showMarkers: ch = ' ' else: if y == 0: b.putChar(s, self.shadows[0]) else: b.putChar(s, self.shadows[1]) ch = self.shadows[2] i = 1 if y == titleRow and self.title: self.__drawTitle(b, s, i, cButton, down) if self.showMarkers and down: b.putChar(1, self.markers[0]) b.putChar(s - 1, self.markers[1]) self.writeLine(0, y, self.size.x, 1, b) b.moveChar(0, ' ', cShadow, 2) b.moveChar(2, ch, cShadow, s - 1) self.writeLine(0, self.size.y - 1, self.size.x, 1, b)