Hi

I'm not sure is this is an error --  but when I attach a ListModel and
and CellRenderer to a gtk.ComboBox I end up with duplicate columns in
the list box. Attached is a small screenshot.

This only occurs if I have first opened the combobox list editor in
glade and then saved.

Glade inserts an empty items property in the xml:
        <property name="items" translatable="yes"></property>

Removing this element fixes the problem.  The code below replicates the problem.

Is this a bug and should be reported on bu

Relevent versions numbers are:

ii  python          2.5.1-0ubuntu3
ii  python-glade2   2.10.4-0ubuntu3
ii  python-gtk2     2.10.4-0ubuntu3

ii  glade-3         3.2.0-0ubuntu1
ii  libglade2-0     2.6.0-3

-----code follows ---
#!/usr/bin/env python2.5

import pygtk
import gtk
import gtk.glade


glade_buffer = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Thu Feb 14 10:01:52 2008 by
[EMAIL PROTECTED]>
<glade-interface>
  <widget class="GtkWindow" id="window1">
    <property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
    <child>
      <widget class="GtkVBox" id="vbox1">
        <property name="visible">True</property>
        <property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
        <child>
          <widget class="GtkComboBox" id="combobox1">
            <property name="visible">True</property>
            <property name="events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
            <property name="wrap_width">1</property>
                        <!--            VVVVV  Note the items property -->
                        <property name="items" translatable="yes"></property>
          </widget>
        </child>
      </widget>
    </child>
  </widget>
</glade-interface>
"""
        
if __name__ == "__main__":

        xml = gtk.glade.xml_new_from_buffer(glade_buffer, len(glade_buffer))

        combobox = xml.get_widget('combobox1')
        
        liststore = gtk.ListStore(str)
        liststore.append(['first'])
        liststore.append(['second'])
        
        combobox.set_model(liststore)
        
        cell = gtk.CellRendererText()
        combobox.pack_start(cell, True)
        combobox.set_attributes(cell, text=0)

        w = xml.get_widget('window1')
        w.show_all()
        gtk.main()

-- 

Edward Stow

<<attachment: duplicate_columns.png>>

_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to