Esempio n. 1
0
    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()
Esempio n. 2
0
    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()
Esempio n. 3
0
    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)
Esempio n. 4
0
    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)