def bar(self, node): above = self.settings.get('lines.above') sep = self.settings.get('separator') bg = self.settings.get('colors.background', node) con = self.settings.get('colors.selected', node) coff = self.settings.get('colors.deselected', node) hline(above, node.inner.x, node.position.y + 1, node.inner.width, bg) bitlist = BitSet( Befores(self.settings, *map(Bit, node.befores(node.selected))), SelectedBit(node.selected), Afters(self.settings, *map(Bit, node.afters(node.selected)))) seplen, width = len(sep), node.inner.width for (before, selected, after) in bitlist: lb, ls, la =len(before), len(selected), len(after) if lb + (seplen if lb else 0) + ls + (seplen if la else 0) + la <= width: break line = Line(node.inner.x, node.position.y, node.inner.width, bg) line.add(before, coff) if before: line.add(sep, coff) line.add(selected, con) if after: line.add(sep, coff) line.add(after, coff) line.draw()
def draw(self, node): left = self.settings.get('lines.left') right = self.settings.get('lines.right') below = self.settings.get('lines.below') bg = self.settings.get('colors.background', node) vline(left, node.position.x, node.position.y, node.position.height, bg) vline(right, node.inner.x + node.inner.width, node.position.y, node.position.height, bg) hline(below, node.position.x, node.inner.y + node.inner.height, node.position.width, bg) self.bar(node)
def draw_spacer_after(self, child): from api.line import hline hline(self.spacer, child.position.x, child.position.y + child.position.height, child.position.width, self.module.setting('spacers.vertical.color'))