def draw(self, **kwargs): hint = kwargs.get("hint", "tblr") color = conf.stack_unfocused_color light = conf.stack_unfocused_highlight dark = conf.stack_unfocused_shadow if self.focused: color = conf.stack_focused_color light = conf.stack_focused_highlight dark = conf.stack_focused_shadow x = self.x y = self.y w = self.w h = self.h left = x right = x + w - 1 top = y bot = y + h - 1 pypixel.rectangle(color, self.rect) # Draw light edge if "t" in hint: pypixel.line(light, (left, top), (right, top)) # top if "l" in hint: pypixel.line(light, (left, top), (left, bot)) # left # Draw dark edge if "r" in hint: pypixel.line(dark, (right, bot), (right, top)) # right if "b" in hint: pypixel.line(dark, (right, bot), (left, bot)) # bottom item = self.item() if item is not None: item.draw()
def draw_wallpaper(self): grey0 = (32, ) * 3 grey1 = (128,) * 3 screen = self.display.item() w, h = screen.dim for x in xrange(0, w, 2): p0 = (x, 0 ) p1 = (x, h - 1) pypixel.line(grey0, p0, p1) p0 = (x + 1, 0 ) p1 = (x + 1, h - 1) pypixel.line(grey1, p0, p1)
def draw_bar(self): screen = self.display.item() tag = screen.item() if tag.bar_hidden: return color = conf.bar_color highlight = conf.bar_highlight bh = conf.bar_height # Top bar x, y = 0, 0 w, h = screen.dim rect = ((x, y), (w, bh)) # (x, y), (w, h) line = ((x, y - 2 + bh), (w - 1, y - 2 + bh)) # (x, y), (x, y) pypixel.rectangle(color, rect) pypixel.line(highlight, *line)