Re: [pygtk] CellRendererText doesn't have clicked signal now what?

2005-02-19 Thread Chris Lambacher
You can attach to the button-pressed signal of the tree view.  This
will give you mouse coordinates.  You can then get the column from
TreeView.get_path_at_pos

Something similar to what you want is in FAQ 13.17
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.017.htp

-Chris


On Sat, 19 Feb 2005 09:01:36 -0500, Thomas Mills Hinkle
<[EMAIL PROTECTED]> wrote:
> On Sat, 19 Feb 2005 14:15:11 +0200, Nikos Kouremenos <[EMAIL PROTECTED]> 
> wrote:
> http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.026.htp
> > but even if it was, I cannot understand what it says [so either way plz
> > someone that knows what it's saying edit it to become more easy to
> > understand for the rest of us]
> 
> Well, I can tell you that this isn't useful for your case at least.
> This FAQ entry is about connecting to the column header, not any place
> in the columns. For example, in many apps, clicking on the column
> header sorts the treemodel by that column.
> 
> An additional query -- does anyone know if it's possible to select and
> arbitrary range of a treeview, a la spreadsheets? I'd like to let the
> user, for example, select four rows of one column so that I could
> offer e.g. a "fill down" action.
> 
> Tom
> ___
> 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/
> 


-- 
Christopher Lambacher
[EMAIL PROTECTED]
___
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/


Re: [pygtk] CellRendererText doesn't have clicked signal now what?

2005-02-19 Thread Brian
On Sat, 2005-19-02 at 14:15 +0200, Nikos Kouremenos wrote:
> I have a treeview with:
> 
> COL1  COL2 COL3
> toggle | string | string
> 
> 
> I want if the user clicks on the text on a row of *col2* or *col3* to
> toggle the bool in the *col1*.
> I cannot find a way to do that in GTK.
> 
Here are some code snipits from our app that do the same as you want.
In this case the first time a row is clicked it only selects that row,
the toggle is only changed on every other click in that same row.  I
hope it is clear enough for you.

class PackageView(CommonTreeView):
""" Self contained treeview of packages """
def __init__(self):
""" Initialize """
# initialize the treeview
CommonTreeView.__init__(self)

# setup the treecolumn
self._column = gtk.TreeViewColumn(_("Packages"))
self._column.set_resizable(True)
self.append_column(self._column)
# connect to clicked event
self.connect("cursor_changed", self._clicked)

def _init_view(self):
""" Set the treeview column """
# add the toggle renderer
check = gtk.CellRendererToggle()
self._column.pack_start(check, expand = False)
self._column.add_attribute(check, "active", 1)
# set the last selected to nothing
self._last_selected = None



def _clicked(self, treeview, *args):
""" Handles treeview clicks """
# get the selection
package = get_treeview_selection(treeview, 1)
if not package:
if self._package_changed:
self._package_changed(None)
return
if package.full_name == self._last_selected:
model, iter = self.get_selection().get_selected()
check = model.get_value(iter, 1)
model.set_value(iter, 1, not check)
self._last_selected = package.full_name

-- 
Brian <[EMAIL PROTECTED]>

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


Re: [pygtk] CellRendererText doesn't have clicked signal now what?

2005-02-19 Thread Thomas Mills Hinkle
On Sat, 19 Feb 2005 14:15:11 +0200, Nikos Kouremenos <[EMAIL PROTECTED]> wrote:
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.026.htp
> but even if it was, I cannot understand what it says [so either way plz
> someone that knows what it's saying edit it to become more easy to
> understand for the rest of us]

Well, I can tell you that this isn't useful for your case at least. 
This FAQ entry is about connecting to the column header, not any place
in the columns. For example, in many apps, clicking on the column
header sorts the treemodel by that column.

An additional query -- does anyone know if it's possible to select and
arbitrary range of a treeview, a la spreadsheets? I'd like to let the
user, for example, select four rows of one column so that I could
offer e.g. a "fill down" action.

Tom
___
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/


[pygtk] CellRendererText doesn't have clicked signal now what?

2005-02-19 Thread Nikos Kouremenos
I have a treeview with:

COL1  COL2 COL3
toggle | string | string


I want if the user clicks on the text on a row of *col2* or *col3* to
toggle the bool in the *col1*.
I cannot find a way to do that in GTK.

with respect to David Cook, I don't know if this is useful or not:
http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq13.026.htp
but even if it was, I cannot understand what it says [so either way plz
someone that knows what it's saying edit it to become more easy to
understand for the rest of us]

Thank you in advance
-- 
Nikos Kouremenos | http://members.hellug.gr/nkour | JabberID: [EMAIL PROTECTED]

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