remove try/except from grab/ungrab

This commit is contained in:
Ryan Pessa 2014-07-18 10:17:17 -05:00
parent b0ceefef9a
commit f132a1da5d
1 changed files with 2 additions and 10 deletions

View File

@ -322,11 +322,7 @@ class MotionEvent(MotionEventBase):
raise Exception('Grab works only for Touch MotionEvents.')
if self.grab_exclusive_class is not None:
raise Exception('Cannot grab the touch, touch is exclusive')
try:
class_instance = weakref.ref(class_instance)
except TypeError:
# handle weakproxy objects which cannot be weakref'd
class_instance = weakref.ref(class_instance.__self__)
class_instance = weakref.ref(class_instance.__self__)
if exclusive:
self.grab_exclusive_class = class_instance
self.grab_list.append(class_instance)
@ -334,11 +330,7 @@ class MotionEvent(MotionEventBase):
def ungrab(self, class_instance):
'''Ungrab a previously grabbed touch
'''
try:
class_instance = weakref.ref(class_instance)
except TypeError:
# handle weakproxy objects which cannot be weakref'd
class_instance = weakref.ref(class_instance.__self__)
class_instance = weakref.ref(class_instance.__self__)
if self.grab_exclusive_class == class_instance:
self.grab_exclusive_class = None
if class_instance in self.grab_list: