mirror of https://github.com/kivy/kivy.git
remove try/except from grab/ungrab
This commit is contained in:
parent
b0ceefef9a
commit
f132a1da5d
|
@ -322,11 +322,7 @@ class MotionEvent(MotionEventBase):
|
||||||
raise Exception('Grab works only for Touch MotionEvents.')
|
raise Exception('Grab works only for Touch MotionEvents.')
|
||||||
if self.grab_exclusive_class is not None:
|
if self.grab_exclusive_class is not None:
|
||||||
raise Exception('Cannot grab the touch, touch is exclusive')
|
raise Exception('Cannot grab the touch, touch is exclusive')
|
||||||
try:
|
class_instance = weakref.ref(class_instance.__self__)
|
||||||
class_instance = weakref.ref(class_instance)
|
|
||||||
except TypeError:
|
|
||||||
# handle weakproxy objects which cannot be weakref'd
|
|
||||||
class_instance = weakref.ref(class_instance.__self__)
|
|
||||||
if exclusive:
|
if exclusive:
|
||||||
self.grab_exclusive_class = class_instance
|
self.grab_exclusive_class = class_instance
|
||||||
self.grab_list.append(class_instance)
|
self.grab_list.append(class_instance)
|
||||||
|
@ -334,11 +330,7 @@ class MotionEvent(MotionEventBase):
|
||||||
def ungrab(self, class_instance):
|
def ungrab(self, class_instance):
|
||||||
'''Ungrab a previously grabbed touch
|
'''Ungrab a previously grabbed touch
|
||||||
'''
|
'''
|
||||||
try:
|
class_instance = weakref.ref(class_instance.__self__)
|
||||||
class_instance = weakref.ref(class_instance)
|
|
||||||
except TypeError:
|
|
||||||
# handle weakproxy objects which cannot be weakref'd
|
|
||||||
class_instance = weakref.ref(class_instance.__self__)
|
|
||||||
if self.grab_exclusive_class == class_instance:
|
if self.grab_exclusive_class == class_instance:
|
||||||
self.grab_exclusive_class = None
|
self.grab_exclusive_class = None
|
||||||
if class_instance in self.grab_list:
|
if class_instance in self.grab_list:
|
||||||
|
|
Loading…
Reference in New Issue