Issue 339: MTList in MTKinetic crashes bacause entry in touch.userdata is missing/ deleted
Status:  New
Owner: ----
Reported by jaybradl...@gmail.com, Oct 4, 2010
What steps will reproduce the problem?

from pymt import *

# Create background window
w = getWindow()

# add kinetics to everything
kinetics = MTKinetic()
w.add_widget(kinetics)

# create a grid layout with 2 rows
layout = MTGridLayout(rows=2)
for x in xrange(22):
    btn = MTToggleButton(label='label%d' % x)
    layout.add_widget(btn)

# create a list of 400x200 size, and disable scrolling on Y axis
lst = MTList(size=(400, 200), do_y=False)
lst.add_widget(layout)
   
kinetics.add_widget(lst) # This doesn't. This "loses" some userdata. "startpos" goes missing
#w.add_widget(lst) # This works
   
runTouchApp()

What is the expected output? What do you see instead?

The program crashes on a touch move event on the MTList:

File "/usr/lib64/python2.6/site-packages/pymt/ui/widgets/klist.py", line 182, in on_touch_move
    cx, cy = touch.userdata['list.startpos']
KeyError: 'list.startpos'

This is when using a mouse for testing.

What version of the product are you using? On what operating system?
Version: HEAD, OS: Linux Fedora 11

Please provide any additional information below.

The userdata is set at line 174 of pymt/ui/widgets/klist.py:

touch.userdata['list.startpos'] = self.content_x, self.content_y

but on line 184 the dictionary entry is missing:

cx, cy = touch.userdata['list.startpos']