mansrz / pymt

Automatically exported from code.google.com/p/pymt
0 stars 0 forks source link

Nested layouts are unbearably slow #263

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See:

from pymt import *

# callback for the buttons
def test_button(btn, *largs):
    print 'button pressed', btn.label

# create a grid layout with 2 rows
layout = MTGridLayout(rows=1)
for x in xrange(22):
    box = MTBoxLayout()
    grid = MTGridLayout(cols=2, rows=2)
    grid.add_widgets(MTLabel(label="foo"))
    grid.add_widgets(MTLabel(label="bar"))
    grid.add_widgets(MTLabel(label="baz"))
    grid.add_widgets(MTLabel(label="bum"))
    box.add_widget(grid)
    box.add_widget(MTLabel(label="bla"))
    #btn = MTToggleButton(label='label%d' % x)
    #btn.connect('on_press', curry(test_button, btn))
    layout.add_widget(box)

# create a list of 400x200 size, and disable scrolling on Y axis
lst = MTList(width=getWindow().width, do_y=False)
lst.add_widget(layout)

# center the list on the screen
anchor = MTAnchorLayout()
anchor.add_widget(lst)

runTouchApp(anchor)

Original issue reported on code.google.com by dennd...@gmail.com on 22 Jun 2010 at 7:34

GoogleCodeExporter commented 9 years ago
Yes, this happens because we use absolute positionuing for a ll 
widgets...instead of relative!

if one thing changes, the whole layout has to be recomputed

Original comment by thomas.h...@gmail.com on 22 Jun 2010 at 9:24

GoogleCodeExporter commented 9 years ago
Actually, no.
The MTList children are relative. If the list move, the children are not moved.

The issue occur because on_move/on_resize are always call. I'm trying to known 
why.

Original comment by txprog on 22 Jun 2010 at 9:30

GoogleCodeExporter commented 9 years ago
Very hard to track, here is a little patch to see some things.
http://paste.pocoo.org/show/228716/

Thomas, can you fix & handle layout fixes ?
If not, tell us, then we can known.

8 days left before the beta

Original comment by txprog on 22 Jun 2010 at 9:46

GoogleCodeExporter commented 9 years ago
fixed, needs reviews

Original comment by thomas.h...@gmail.com on 28 Jun 2010 at 5:12

GoogleCodeExporter commented 9 years ago

Original comment by txprog on 2 Jul 2010 at 2:08