[pygtk] Setting the state of a CellRendererToggle

Stephen Langer stephen.langer at nist.gov
Tue Apr 4 22:12:52 WST 2006


Responding to my own message.... Of course I figured out what to do  
after sending off my request for help.  I only need to explicitly  
call CellRendererToggle.emit('toggled', path).

  -- Steve

On Apr 3, 2006, at 5:22 PM, Stephen Langer wrote:

> 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         --
>
>
> _______________________________________________
> pygtk mailing list   pygtk at daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
>

--
-- 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