本文整理汇总了Python中kiwi.ui.widgets.combo.ProxyComboBox.model_attribute方法的典型用法代码示例。如果您正苦于以下问题:Python ProxyComboBox.model_attribute方法的具体用法?Python ProxyComboBox.model_attribute怎么用?Python ProxyComboBox.model_attribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kiwi.ui.widgets.combo.ProxyComboBox
的用法示例。
在下文中一共展示了ProxyComboBox.model_attribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _setup_options_combo_slave
# 需要导入模块: from kiwi.ui.widgets.combo import ProxyComboBox [as 别名]
# 或者: from kiwi.ui.widgets.combo.ProxyComboBox import model_attribute [as 别名]
def _setup_options_combo_slave(self):
widget = ProxyComboBox()
widget.props.sensitive = self.sensitive
widget.model_attribute = "field_value"
widget.data_type = unicode
data = [(value, unicode(key)) for key, value in self.detail.options.items()]
widget.prefill(data)
self.proxy.add_widget("field_value", widget)
self.container.add(widget)
widget.show()
示例2: test_prefill_attr_none
# 需要导入模块: from kiwi.ui.widgets.combo import ProxyComboBox [as 别名]
# 或者: from kiwi.ui.widgets.combo.ProxyComboBox import model_attribute [as 别名]
def test_prefill_attr_none(self):
model = Settable(attr=None)
proxy = Proxy(FakeView(), model)
combo = ProxyComboBox()
combo.data_type = int
combo.model_attribute = 'attr'
combo.prefill([('foo', 10), ('bar', 20)])
proxy.add_widget('attr', combo)
# Even though attr is None, the combo doesn't allow something
# not prefilled in it to be selected. In this case, it will select
# the first item (prefill actually does that) instead.
self.assertEqual(model.attr, 10)