Hi, I took another swing at creating a custom cell renderer that can render any arbitrary widget in a TreeView. It currently works, albeit with a few annoyances. The source is available at https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/virtaal/virtaal/views/widgets/cellrendererwidget.py
The widget (retrieved from the TreeView's model) is rendered by wrapping it in a gtk.CellEditable, which was the only way I could find to render arbitrary widgets. This means that the cell renderer must use the editable mode and that the activatable mode is of no use. So the cell is currently rendered in one of three states: * Unselected: A CellRendererText is emulatedwith the strfunc callable supplying the string to render. * Selected (not editing): When selecting a row (with the mouse or keyboard) the cell is empty. Neither the string or the widget is rendered. * Editing: When clicking on the cell (or pressing Enter on it) after it has been selected it enters editing mode and displays the appropriate widget. The problem is the second state mentioned above and that brings me to my actual question: How can I get CellRenderer to enter editing mode as soon as it is selected? I have tried testing the flags parameter (in on_render) for gtk.CELL_RENDERER_SELECTED and then calling self.start_editing() myself. I have confirmed that my on_start_editing() is indeed called, but that does not seem to be enough to put the cell in editing mode and show the widget. This is has been solved in Virtaal (the application I'm working on), but it involved creating a custom TreeModel implementation. This model would return True for get_value() calls on the (hard-coded) column number of the editable property, only if the internal iterator matched the get_value() call's parameter. This is a big hack I'd like to avoid in my implementation. For this implementation the CellRenderer is in https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/virtaal/virtaal/views/widgets/storeviewwidgets.py and the CellEditable is in https://translate.svn.sourceforge.net/svnroot/translate/src/trunk/virtaal/virtaal/views/unitview.py Any insight would be greatly appreciated. Thanks in advance, -- Walter Leibbrandt Software Developer Recent blogs: * Firefox-style button with a pop-up menu http://www.translate.org.za/blogs/walter/en/content/firefox-style-button-pop-menu _______________________________________________ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/