def splitRecursive(self, deep):
        l = None
        if self._core:
            l = VerticalLayout() if self._vertical else HorizontalLayout()
        else:
            if self._vertical:
                l = WeeLayout(Direction.VERTICAL)
            else:
                l = WeeLayout(Direction.HORIZONTAL)

        l.setSizeFull()
        if self._core:
            c = l
            b = NativeButton('One')
            b.setSizeFull()
            c.addComponent(b)
            c.setExpandRatio(b, 1)
            if deep > 0:
                deep -= 1
                c2 = self.splitRecursive(deep)
                c.addComponent(c2)
                c.setExpandRatio(c2, 9)
        else:
            wl = l
            wl.setClipping(True)
            b = NativeButton('Button')
            b.setSizeFull()
            if self._vertical:
                b.setHeight('10%')
            else:
                b.setWidth('10%')

            l.addComponent(b)
            if deep > 0:
                deep -= 1
                w = self.splitRecursive(deep)
                if self._vertical:
                    w.setHeight('90%')
                else:
                    w.setWidth('90%')

                l.addComponent(w)
            else:
                b.setSizeFull()

        return l
Пример #2
0
    def splitRecursive(self, deep):
        l = None
        if self._core:
            l = VerticalLayout() if self._vertical else HorizontalLayout()
        else:
            if self._vertical:
                l = WeeLayout(Direction.VERTICAL)
            else:
                l = WeeLayout(Direction.HORIZONTAL)

        l.setSizeFull()
        if self._core:
            c = l
            b = NativeButton('One')
            b.setSizeFull()
            c.addComponent(b)
            c.setExpandRatio(b, 1)
            if deep > 0:
                deep -= 1
                c2 = self.splitRecursive(deep)
                c.addComponent(c2)
                c.setExpandRatio(c2, 9)
        else:
            wl = l
            wl.setClipping(True)
            b = NativeButton('Button')
            b.setSizeFull()
            if self._vertical:
                b.setHeight('10%')
            else:
                b.setWidth('10%')

            l.addComponent(b)
            if deep > 0:
                deep -= 1
                w = self.splitRecursive(deep)
                if self._vertical:
                    w.setHeight('90%')
                else:
                    w.setWidth('90%')

                l.addComponent(w)
            else:
                b.setSizeFull()

        return l