How to use the wasabi.devices.mi6k.userspace.vfdwidgets.Rect function in wasabi

To help you get started, we’ve selected a few wasabi 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 scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitTop(self, amount):
        """Split a rectangle off of the top side of this one,
           returning a (top, remaining) tuple.
           """
        return (Rect(self.x, self.y, self.width, amount),
                Rect(self.x, self.y + amount, self.width, self.height - amount))
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
# then remove all widgets from the lowest priority line.
            lineprios = []
            for line in layoutLines.itervalues():
                total = 0
                for widget in line.widgets:
                    total += widget.priority
                lineprios.append((total, line))
            lineprios.sort()
            for widget in lineprios[0][1].widgets:
                widgets.remove(widget)
            return False

        # Sort the layout lines, and assign each a rectangle
        lineKeys = layoutLines.keys()
        lineKeys.sort()
        remaining = Rect(0, 0, self.width, self.height)
        for y in lineKeys:
            line = layoutLines[y]
            if y < 0:
                line.rect, remaining = remaining.splitTop(line.height)
        lineKeys.reverse()
        for y in lineKeys:
            line = layoutLines[y]
            if y > 0:
                line.rect, remaining = remaining.splitBottom(line.height)
        if 0 in lineKeys:
            layoutLines[0].rect = remaining

        # Lay out the widgets on each line
        self.widgetRects = {}
        for line in lineKeys:
            layoutLines[line].layout(self.widgetRects)
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitBottom(self, amount):
        """Split a rectangle off of the bottom side of this one,
           returning a (bottom, remaining) tuple.
           """
        return (Rect(self.x, self.y + self.height - amount, self.width, amount),
                Rect(self.x, self.y, self.width, self.height - amount))
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitLeft(self, amount):
        """Split a rectangle off of the left side of this one,
           returning a (left, remaining) tuple.
           """
        return (Rect(self.x, self.y, amount, self.height),
                Rect(self.x + amount, self.y, self.width - amount, self.height))
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitRight(self, amount):
        """Split a rectangle off of the right side of this one,
           returning a (right, remaining) tuple.
           """
        return (Rect(self.x + self.width - amount, self.y, amount, self.height),
                Rect(self.x, self.y, self.width - amount, self.height))
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitLeft(self, amount):
        """Split a rectangle off of the left side of this one,
           returning a (left, remaining) tuple.
           """
        return (Rect(self.x, self.y, amount, self.height),
                Rect(self.x + amount, self.y, self.width - amount, self.height))
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitTop(self, amount):
        """Split a rectangle off of the top side of this one,
           returning a (top, remaining) tuple.
           """
        return (Rect(self.x, self.y, self.width, amount),
                Rect(self.x, self.y + amount, self.width, self.height - amount))
github scanlime / navi-misc / wasabi / devices / mi6k / userspace / vfdwidgets.py View on Github external
def splitRight(self, amount):
        """Split a rectangle off of the right side of this one,
           returning a (right, remaining) tuple.
           """
        return (Rect(self.x + self.width - amount, self.y, amount, self.height),
                Rect(self.x, self.y, self.width - amount, self.height))