本文整理汇总了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)