[pygtk] Setting the state of a CellRendererToggle

Stephen Langer stephen.langer at nist.gov
Tue Apr 4 05:22:55 WST 2006


Hello --

I'm writing code to record and replay a user's actions, for the  
purpose of creating a test suite.  For example, when the user presses  
a button, the line "button.clicked()" will be put in the log, with  
"button" set to an appropriate widget.  Then the log can be run and  
the session recreated.

However, I'm having trouble figuring out how to log the "toggle"  
signal for a CellRendererToggle in a TreeView.  Assuming that I know  
the TreeView and the column number, I can get the CellRenderer by  
calling
      renderer = treeview.get_column(column).get_cell_renderers()[0]
but then
      renderer.set_active(0)
doesn't say which row is being set or unset.  How do I explicitly  
toggle the CellRendererToggle in a particular row and column of the  
TreeView?

In the main part of the code (ie, not the logging and replaying  
machinery) the state of the toggle is set by assigning a  
cell_data_func to the CellRenderer.  Going in by hand and setting the  
state of the model, then updating the TreeView is not possible here,  
because it would short-circuit the testing that I'm trying to do.

Many thanks,
        Steve


--
-- EMail: stephen.langer at nist.gov                    Phone: (301)  
975-5423 --
-- WWW:  http://math.nist.gov/mcsd/Staff/SLanger/    Fax:   (301)  
975-3144 --
-- Mail: NIST; 100 Bureau Drive -- Stop 8910; Gaithersburg, Md   
20899-8910 --

-- "I don't think this will work.  That's why it's  
science."               --
--                                      Naomi Langer,  17 Feb  
2003         --




More information about the pygtk mailing list