本文整理汇总了Python中kivy.uix.anchorlayout.AnchorLayout.setter方法的典型用法代码示例。如果您正苦于以下问题:Python AnchorLayout.setter方法的具体用法?Python AnchorLayout.setter怎么用?Python AnchorLayout.setter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.anchorlayout.AnchorLayout
的用法示例。
在下文中一共展示了AnchorLayout.setter方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: dispatch_visit
# 需要导入模块: from kivy.uix.anchorlayout import AnchorLayout [as 别名]
# 或者: from kivy.uix.anchorlayout.AnchorLayout import setter [as 别名]
#.........这里部分代码省略.........
text=bullet, document=self.root))
self.current.add_widget(item)
self.push(item)
elif cls is nodes.system_message:
label = RstSystemMessage()
if self.root.show_errors:
self.current.add_widget(label)
self.push(label)
elif cls is nodes.warning:
label = RstWarning()
self.current.add_widget(label)
self.push(label.content)
assert(self.text == '')
elif cls is nodes.note:
label = RstNote()
self.current.add_widget(label)
self.push(label.content)
assert(self.text == '')
elif cls is nodes.image:
uri = node['uri']
if uri.startswith('/') and self.root.document_root:
uri = join(self.root.document_root, uri[1:])
if uri.startswith('http://') or uri.startswith('https://'):
image = RstAsyncImage(source=uri)
else:
image = RstImage(source=uri)
align = node.get('align', 'center')
root = AnchorLayout(size_hint_y=None, anchor_x=align, height=1)
image.bind(height=root.setter('height'))
root.add_widget(image)
self.current.add_widget(root)
elif cls is nodes.definition_list:
lst = RstDefinitionList(document=self.root)
self.current.add_widget(lst)
self.push(lst)
elif cls is nodes.term:
assert(isinstance(self.current, RstDefinitionList))
term = RstTerm(document=self.root)
self.current.add_widget(term)
self.push(term)
elif cls is nodes.definition:
assert(isinstance(self.current, RstDefinitionList))
definition = RstDefinition(document=self.root)
definition.add_widget(RstDefinitionSpace(document=self.root))
self.current.add_widget(definition)
self.push(definition)
elif cls is nodes.field_list:
fieldlist = RstFieldList()
self.current.add_widget(fieldlist)
self.push(fieldlist)
elif cls is nodes.field_name:
name = RstFieldName(document=self.root)
self.current.add_widget(name)
self.push(name)
elif cls is nodes.field_body:
示例2: dispatch_visit
# 需要导入模块: from kivy.uix.anchorlayout import AnchorLayout [as 别名]
# 或者: from kivy.uix.anchorlayout.AnchorLayout import setter [as 别名]
#.........这里部分代码省略.........
elif cls is nodes.image:
# docutils parser breaks path with spaces
# e.g. "C:/my path" -> "C:/mypath"
uri = node['uri']
align = node.get('align', 'center')
image_size = [
node.get('width'),
node.get('height')
]
# use user's size if defined
def set_size(img, size):
img.size = [
size[0] or img.width,
size[1] or img.height
]
if uri.startswith('/') and self.root.document_root:
uri = join(self.root.document_root, uri[1:])
if uri.startswith('http://') or uri.startswith('https://'):
image = RstAsyncImage(source=uri)
image.bind(on_load=lambda *a: set_size(image, image_size))
else:
image = RstImage(source=uri)
set_size(image, image_size)
root = AnchorLayout(
size_hint_y=None,
anchor_x=align,
height=image.height
)
image.bind(height=root.setter('height'))
root.add_widget(image)
self.current.add_widget(root)
elif cls is nodes.definition_list:
lst = RstDefinitionList(document=self.root)
self.current.add_widget(lst)
self.push(lst)
elif cls is nodes.term:
assert(isinstance(self.current, RstDefinitionList))
term = RstTerm(document=self.root)
self.current.add_widget(term)
self.push(term)
elif cls is nodes.definition:
assert(isinstance(self.current, RstDefinitionList))
definition = RstDefinition(document=self.root)
definition.add_widget(RstDefinitionSpace(document=self.root))
self.current.add_widget(definition)
self.push(definition)
elif cls is nodes.field_list:
fieldlist = RstFieldList()
self.current.add_widget(fieldlist)
self.push(fieldlist)
elif cls is nodes.field_name:
name = RstFieldName(document=self.root)
self.current.add_widget(name)
self.push(name)
elif cls is nodes.field_body:
示例3: dispatch_visit
# 需要导入模块: from kivy.uix.anchorlayout import AnchorLayout [as 别名]
# 或者: from kivy.uix.anchorlayout.AnchorLayout import setter [as 别名]
#.........这里部分代码省略.........
elif cls is nodes.image:
# docutils parser breaks path with spaces
# e.g. "C:/my path" -> "C:/mypath"
uri = node['uri']
align = node.get('align', 'center')
image_size = [
node.get('width'),
node.get('height')
]
# use user's size if defined
def set_size(img, size):
img.size = [
size[0] or img.width,
size[1] or img.height
]
if uri.startswith('/') and self.root.document_root:
uri = join(self.root.document_root, uri[1:])
if uri.startswith('http://') or uri.startswith('https://'):
image = RstAsyncImage(source=uri)
image.bind(on_load=lambda *a: set_size(image, image_size))
else:
image = RstImage(source=uri)
set_size(image, image_size)
root = AnchorLayout(
size_hint_y=None,
anchor_x=align,
height=image.height
)
image.bind(height=root.setter('height'))
root.add_widget(image)
self.current.add_widget(root)
# TODO:
# .. _img: <url>
# .. |img| image:: <img>
# |img|_ <- needs refs and on_ref_press
elif cls is nodes.definition_list:
lst = RstDefinitionList(document=self.root)
self.current.add_widget(lst)
self.push(lst)
elif cls is nodes.term:
assert(isinstance(self.current, RstDefinitionList))
term = RstTerm(document=self.root)
self.current.add_widget(term)
self.push(term)
elif cls is nodes.definition:
assert(isinstance(self.current, RstDefinitionList))
definition = RstDefinition(document=self.root)
definition.add_widget(RstDefinitionSpace(document=self.root))
self.current.add_widget(definition)
self.push(definition)
elif cls is nodes.field_list:
fieldlist = RstFieldList()
self.current.add_widget(fieldlist)
self.push(fieldlist)
elif cls is nodes.field_name:
name = RstFieldName(document=self.root)
示例4: dispatch_visit
# 需要导入模块: from kivy.uix.anchorlayout import AnchorLayout [as 别名]
# 或者: from kivy.uix.anchorlayout.AnchorLayout import setter [as 别名]
#.........这里部分代码省略.........
self.current.add_widget(RstListBullet(text=bullet))
self.current.add_widget(item)
self.push(item)
elif cls is nodes.system_message:
label = RstSystemMessage()
if self.root.show_errors:
self.current.add_widget(label)
self.push(label)
elif cls is nodes.warning:
label = RstWarning()
self.current.add_widget(label)
self.push(label.content)
assert self.text == ""
elif cls is nodes.note:
label = RstNote()
self.current.add_widget(label)
self.push(label.content)
assert self.text == ""
elif cls is nodes.image:
uri = node["uri"]
if uri.startswith("/") and self.root.document_root:
uri = join(self.root.document_root, uri[1:])
if uri.startswith("http://") or uri.startswith("https://"):
image = RstAsyncImage(source=uri)
else:
image = RstImage(source=uri)
align = node.get("align", "center")
root = AnchorLayout(size_hint_y=None, anchor_x=align, height=1)
image.bind(height=root.setter("height"))
root.add_widget(image)
self.current.add_widget(root)
elif cls is nodes.definition_list:
lst = RstDefinitionList()
self.current.add_widget(lst)
self.push(lst)
elif cls is nodes.term:
assert isinstance(self.current, RstDefinitionList)
term = RstTerm()
self.current.add_widget(term)
self.push(term)
elif cls is nodes.definition:
assert isinstance(self.current, RstDefinitionList)
definition = RstDefinition()
definition.add_widget(RstDefinitionSpace())
self.current.add_widget(definition)
self.push(definition)
elif cls is nodes.field_list:
fieldlist = RstFieldList()
self.current.add_widget(fieldlist)
self.push(fieldlist)
elif cls is nodes.field_name:
name = RstFieldName()
self.current.add_widget(name)
self.push(name)
elif cls is nodes.field_body: