本文整理匯總了Python中kivy.event.EventDispatcher.__getattribute__方法的典型用法代碼示例。如果您正苦於以下問題:Python EventDispatcher.__getattribute__方法的具體用法?Python EventDispatcher.__getattribute__怎麽用?Python EventDispatcher.__getattribute__使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kivy.event.EventDispatcher
的用法示例。
在下文中一共展示了EventDispatcher.__getattribute__方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __getattribute__
# 需要導入模塊: from kivy.event import EventDispatcher [as 別名]
# 或者: from kivy.event.EventDispatcher import __getattribute__ [as 別名]
def __getattribute__(self, key):
# print ">> Trying to get %s" % key
if key in ("_model_attr", "__parent", "_model_class", "_model"):
return object.__getattribute__(self, key)
elif key in self._model_attr:
# print " INTERCEPTED!"
# Get the value of this key from the common data model
val = getattr(self.__parent, key)
# print " val or %s is %s" % (key, val)
# Typecase as needed
if isinstance(val, list):
# Construct a list of property objects
val2 = []
for a in val:
# We have to create a whole new UI model for these...
# class SubModel(UI_DataModel):
# _model_class = type(a)
# val2.append(SubModel(a))
val2.append(str(a))
else:
val2 = str(val)
# Invoke kivy's Property setter by setting our attribute
setattr(self, key, val2)
# Proceed as normal
return EventDispatcher.__getattribute__(self, key)
else:
# print " Pushing up to base class"
return EventDispatcher.__getattribute__(self, key)