Hello,
In my application, I load some data from disk, and generate a treeview that represents this data. Each row of the treeview contains an icon, a gtk.STOCK_OPEN icon for a root node, and a gtk.STOCK_NEW icon for a child node.
When this data is read in, I have a function that determines whether this node is a root or a child, and sets the appropriate icon for that row. Later on in the session, if I manually add a new row, the same function is used to determine the appropriate icon for that new row as well.
The problem is, when the tree is generated from the data on disk, the icons drawn in the treeview are the GTK default theme. When I manually add a new row, the GTK custom theme that I am using is used for the icons. Here is a pic:
http://tinyurl.com/2logm
The last two rows in the treeview have been added manually, and the corresponding icons are themed. The rest are not. Is there a trick that ensures that themed icons are always used? Here is the code I use to get the icons:
def get_icon_pixbuf(self, is_parent=gtk.FALSE): """Returns the appropriate icon for a given node""" if is_parent: return self.render_icon(stock_id=gtk.STOCK_OPEN, size=gtk.ICON_SIZE_MENU, detail=None) else: return self.render_icon(stock_id=gtk.STOCK_NEW, size=gtk.ICON_SIZE_MENU, detail=None)
Sorry if it's a little ugly ;)
I think that this proleam will be fixed by calling self.ensure_style() before calling self.get_icon_pixbuf(...) for the first time.
A possibly better solution is to use the "stock-id" and "stock-size" properties of gtk.CellRendererPixbuf rather than setting the "pixbuf" property directly.
-- Tim Evans Applied Research Associates NZ http://www.aranz.com/ _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
