Example #1
0
 def setUp(self):
     self.model = Settable(attr=0)
     proxy = Proxy(FakeView(), self.model)
     self.combo = disabledeprecationcall(self.type)
     self.combo.data_type = int
     self.combo.model_attribute = 'attr'
     self.combo.prefill([('foo', 0),
                         ('bar', 1)])
     proxy.add_widget('attr', self.combo)
     self.combo.show()
Example #2
0
    def construct(self, name, gtype, properties):
        if gtype in (ProxyComboBox.__gtype__,
                     ComboBox.__gtype__):
            object_type = ProxyComboBox
        elif gtype in (ProxyComboBoxEntry.__gtype__,
                       ComboBoxEntry.__gtype__):
            object_type = ProxyComboBoxEntry
        else:
            raise AssertionError("Unknown ComboBox GType: %r" % gtype)

        obj = disabledeprecationcall(object_type)
        obj.set_name(name)
        return obj
Example #3
0
    def testConstruct(self):
        objs = [("kiwi+ui+widgets+list+List", "w1"),
                ("kiwi+ui+widgets+combobox+ComboBox", "w3"),
                ("kiwi+ui+widgets+combobox+ComboBoxEntry", "w5")
                ]

        if HAVE_2_8:
            objs.extend([("ObjectList", "w2"),
                         ("ProxyComboBox", "w4"),
                         ("ProxyComboBoxEntry", "w6")
                         ])
        s = ''

        for obj, name in objs:
            s += '<widget class="%s" id="%s"/>\n' % (obj, name)
        ob = disabledeprecationcall(ObjectBuilder, buffer=glade(s))
        for obj, name in objs:
            widget = ob.get_widget(name)
            self.failUnless(isinstance(widget, gtk.Widget))
            gtype = gobject.type_from_name(obj)
            self.failUnless(gobject.type_is_a(gtype, gtk.Widget))
            self.failUnless(gobject.type_is_a(gtype, widget))