Re: [pygtk] TreeView (liststore) sorting.

2010-02-03 Thread middleofdre...@gmail.com
I have now something like that:
 view['listmodel'].set_sort_column_id(5,gtk.SORT_DESCENDING)
view['listmodel'].set_sort_func(5,compare_data, 5)
view['listmodel'].set_sort_func(0,compare_data, 0)

...

def compare_data(model, iter1, iter2, column):
   data1 = model.get_value(iter1,column)
   data2 = model.get_value(iter2,column)
   print data1, data2, cmp(data1, data2)
   return cmp(data1, data2)


but it sorts only by column 5. tried also
  view['listmodel'].set_sort_func(5,compare_data, 0)
but it doesn't work...
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can a treeview be reordered with a CellRendererToggle present

2010-02-03 Thread Mathew Yeates
I want to be able to drag rows of my list. i.e. reorder the list

On Wed, Feb 3, 2010 at 12:36 PM, Pietro Battiston  wrote:

> Il giorno mer, 03/02/2010 alle 12.21 -0800, Mathew Yeates ha scritto:
> > Here is an example
>
> And *what is the problem*?!?
>
> Your first email was not at all understandeable to me, and the second
> didn't help. I assume this must _certainly_ be because I'm not a native
> English speaker... still, many questions on this list don't even get
> answers, so if I was in you I would try to catch attention by _stating
> clearly your problem_. By the way, I also see it as a form of respect.
>
> Notice I _may_ possibly understand the problem by studying your code,
> but I expect that you explain it carefully, not that I must fight to get
> it.
>
> Pietro
>
>
> > import gtk
> > class ListDisp:
> > def __init__(self):
> > self.builder = gtk.Builder()
> > self.builder.add_from_file("
> > drag.xml")
> > self.window = self.builder.get_object("window1")
> > self.store=gtk.ListStore('gboolean',str)
> > #self.store=gtk.ListStore(str)
> > self.view=self.builder.get_object("treeview1")
> > self.view.set_model(self.store)
> > self.tvcolumn = gtk.TreeViewColumn('File Name')
> > self.view.append_column(self.tvcolumn)
> > self.cell = gtk.CellRendererText()
> > self.toggle=gtk.CellRendererToggle()
> > self.tvcolumn.pack_start(self.toggle, True)
> > self.tvcolumn.pack_start(self.cell, True)
> > self.tvcolumn.add_attribute(self.cell, 'text', 1)
> > self.tvcolumn.add_attribute(self.toggle, 'active', 0)
> > self.view.set_reorderable(True)
> > self.store.append([True,"foo"])
> > self.store.append([True,"goo"])
> >
> > if __name__ == "__main__":
> > ld=ListDisp()
> > ld.window.show_all()
> > gtk.main()
> >
> >
> >
> > And here is the glade file
> > 
> > 
> >   
> > 
> >   
> > 
> >   
> > True
> > True
> > automatic
> > automatic
> > 
> >   
> > True
> > True
> >   
> > 
> >   
> > 
> >   
> > 
> >
> >
> > On Tue, Feb 2, 2010 at 11:37 PM, Pietro Battiston 
> > wrote:
> > Il giorno mar, 02/02/2010 alle 16.08 -0800, Yeates, Mathew C
> > (388D) ha
> > scritto:
> >
> > > I have a CellRendererToggle and CellRendererToggle packed in
> > a column
> > > and cannot reorder. However, if I don’t pack the
> > CellRendererToggle
> > > then I can’t.
> > >
> > >
> > >
> > >
> > >
> > > Any clues or example code showing this?
> > >
> > >
> >
> >
> > I humbly suggest that you rephrase your problem more clearly,
> > perhaps
> > providing a simple and running snippet exposing it.
> >
> > Pietro
> >
> >
> > ___
> > pygtk mailing list   pygtk@daa.com.au
> > http://www.daa.com.au/mailman/listinfo/pygtk
> > Read the PyGTK FAQ: http://faq.pygtk.org/
> >
>
>
> ___
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can a treeview be reordered with a CellRendererToggle present

2010-02-03 Thread Pietro Battiston
Il giorno mer, 03/02/2010 alle 12.21 -0800, Mathew Yeates ha scritto:
> Here is an example

And *what is the problem*?!?

Your first email was not at all understandeable to me, and the second
didn't help. I assume this must _certainly_ be because I'm not a native
English speaker... still, many questions on this list don't even get
answers, so if I was in you I would try to catch attention by _stating
clearly your problem_. By the way, I also see it as a form of respect.

Notice I _may_ possibly understand the problem by studying your code,
but I expect that you explain it carefully, not that I must fight to get
it.

Pietro


> import gtk
> class ListDisp:
> def __init__(self): 
> self.builder = gtk.Builder()
> self.builder.add_from_file("
> drag.xml") 
> self.window = self.builder.get_object("window1")
> self.store=gtk.ListStore('gboolean',str)
> #self.store=gtk.ListStore(str)
> self.view=self.builder.get_object("treeview1")
> self.view.set_model(self.store)
> self.tvcolumn = gtk.TreeViewColumn('File Name')
> self.view.append_column(self.tvcolumn)
> self.cell = gtk.CellRendererText()
> self.toggle=gtk.CellRendererToggle() 
> self.tvcolumn.pack_start(self.toggle, True)
> self.tvcolumn.pack_start(self.cell, True)
> self.tvcolumn.add_attribute(self.cell, 'text', 1)
> self.tvcolumn.add_attribute(self.toggle, 'active', 0)
> self.view.set_reorderable(True)
> self.store.append([True,"foo"])
> self.store.append([True,"goo"])
> 
> if __name__ == "__main__":
> ld=ListDisp()
> ld.window.show_all()
> gtk.main()
> 
> 
> 
> And here is the glade file
> 
> 
>   
> 
>   
> 
>   
> True
> True
> automatic
> automatic
> 
>   
> True
> True
>   
> 
>   
> 
>   
> 
> 
> 
> On Tue, Feb 2, 2010 at 11:37 PM, Pietro Battiston 
> wrote:
> Il giorno mar, 02/02/2010 alle 16.08 -0800, Yeates, Mathew C
> (388D) ha
> scritto:
> 
> > I have a CellRendererToggle and CellRendererToggle packed in
> a column
> > and cannot reorder. However, if I don’t pack the
> CellRendererToggle
> > then I can’t.
> >
> >
> >
> >
> >
> > Any clues or example code showing this?
> >
> >
> 
> 
> I humbly suggest that you rephrase your problem more clearly,
> perhaps
> providing a simple and running snippet exposing it.
> 
> Pietro
> 
> 
> ___
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
> 


___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] can a treeview be reordered with a CellRendererToggle present

2010-02-03 Thread Mathew Yeates
Here is an example
import gtk
class ListDisp:
def __init__(self):
self.builder = gtk.Builder()
self.builder.add_from_file("
drag.xml")
self.window = self.builder.get_object("window1")
self.store=gtk.ListStore('gboolean',str)
#self.store=gtk.ListStore(str)
self.view=self.builder.get_object("treeview1")
self.view.set_model(self.store)
self.tvcolumn = gtk.TreeViewColumn('File Name')
self.view.append_column(self.tvcolumn)
self.cell = gtk.CellRendererText()
self.toggle=gtk.CellRendererToggle()
self.tvcolumn.pack_start(self.toggle, True)
self.tvcolumn.pack_start(self.cell, True)
self.tvcolumn.add_attribute(self.cell, 'text', 1)
self.tvcolumn.add_attribute(self.toggle, 'active', 0)
self.view.set_reorderable(True)
self.store.append([True,"foo"])
self.store.append([True,"goo"])

if __name__ == "__main__":
ld=ListDisp()
ld.window.show_all()
gtk.main()



And here is the glade file


  

  

  
True
True
automatic
automatic

  
True
True
  

  

  



On Tue, Feb 2, 2010 at 11:37 PM, Pietro Battiston  wrote:

> Il giorno mar, 02/02/2010 alle 16.08 -0800, Yeates, Mathew C (388D) ha
> scritto:
> > I have a CellRendererToggle and CellRendererToggle packed in a column
> > and cannot reorder. However, if I don’t pack the CellRendererToggle
> > then I can’t.
> >
> >
> >
> >
> >
> > Any clues or example code showing this?
> >
> >
>
> I humbly suggest that you rephrase your problem more clearly, perhaps
> providing a simple and running snippet exposing it.
>
> Pietro
>
>
> ___
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

[pygtk] Python 3.x

2010-02-03 Thread Stephen George

Hi All,

I've searched the archives, and pyGTK web site, I can't find any 
information about how the Python 3.x port is going.

Does anyone know where I should hang out to find out more about the 
python 3.x port of pyGTk?

Thanks in advance
- Steve

___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] Porting pygtk to python 3

2010-02-03 Thread Gerald Britton
Any news on this initiative?  I work on a pygtk-based project that is
considering moving to Python 3.x but we cannot until there is a
function pygtk availalble.

Is there a ETA or a roadmap?

On Mon, Nov 9, 2009 at 3:11 PM, Alex Dedul  wrote:
> On Mon, Nov 9, 2009 at 11:14 AM, Tomeu Vizoso  wrote:
>> On Mon, Nov 9, 2009 at 09:22, Rafael Villar Burke (Pachi)
>>  wrote:
>>> Alex Dedul wrote:
 Hi!

 Any news on porting pygtk to python 3 ? I would be glad to help maybe
 almost full-time on this. Just would be good to know current status on
 this matters first.. And if none projects or initiatives were already
 started on this - is to okay then to just clone git repo and start
 hacking ? Any things i better do before that like to notify some
 people about this or the like ?

>>> AFAIK, the expected way to support python 3.x is through
>>> gobject-introspection generated bindings.
>>>
>>> If you want to help pushing forward python 3 support then, IMHO, it
>>> would be a good idea to help with the pybank and pygobject introspection
>>> work. This last project was mentioned on the mailing list some days ago.
>>> You should read the "[pygtk] introspection pygobject branch" thread
>>> starting on the 13rd of october this year for more information and
>>> pending tasks and try to contact the people working on it.
>>>
>>> Regards, and thanks for helping,
>>
>> Yes, having introspection support means we don't have to port the
>> existing static bindings, making the move to 3.0 (and maybe pypy?)
>> more doable.
>>
>> Some info:
>>
>> http://live.gnome.org/PyGObject
>> http://live.gnome.org/PyGI
>>
>> All help is welcome.
>>
>> Regards,
>>
>> Tomeu
>
> Thanks guys! I'll do some research on those matters and we'll see what
> do we have and what to do with all of that.
>
> With best regards from the Soul, Alex.
> ___
> pygtk mailing list   pygtk@daa.com.au
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://faq.pygtk.org/
>



-- 
Gerald Britton
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/


Re: [pygtk] TreeView (liststore) sorting.

2010-02-03 Thread middleofdre...@gmail.com
>
>
>
> http://www.pygtk.org/docs/pygtk/class-gtktreesortable.html#method-gtktreesortable--set-sort-func
>
> I strongly suggest using devhelp and taking a look at the page of the
> classes you happen to use: even by a fast glance, you can learn many
> things.


And I'm always doing it but this time... i have no idea how too use it. An
example would be great
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Re: [pygtk] TreeView problem, really simple program

2010-02-03 Thread Chris Gonnerman
Alessandro Dentella wrote:
> you forgot to specify the source of data for the CellRenderer, you do that
> when you create the column and is the index of the column in the model where
> is should read the data:
>
> self.programview.append_column(
>gtk.TreeViewColumn(allflds[i], gtk.CellRendererText(), text=i))
>
> namely you forgot to add text=i
>   
Excellent, thanks!  Rather stupid of me, eh?

-- Chris.
___
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/