Re: [pygtk] TreeList check boxes

2003-03-06 Thread David M. Cook
On Thu, Mar 06, 2003 at 11:40:03PM -0700, Jay Graves wrote:

> self.col2.connect('toggled',self.toggle)

You want to connect to the renderer, not the column:

cell = gtk.CellRendererToggle()
cell.connect("toggled", self.toggle)
self.col2 = gtk.TreeViewColumn("allow",gtk.CellRendererToggle(),active=2)

Dave Cook
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] TreeList check boxes

2003-03-06 Thread Jay Graves
Thanks so much, that is exactly what I was looking for.  However I am
having trouble connecting to the cell renderer's "toggled" signal

Below is the code I am using to connect, I have tried connecting to
'toggled' and 'toggle_cursor_row' but they both return an error 
"TypeError: unknown signal name"

am I just not connecting to the signal correctly?

self.keyListModel = gtk.ListStore(gobject.TYPE_STRING, 
gobject.TYPE_STRING, gobject.TYPE_BOOLEAN)
.
self.keyListModel.set_value(iter,0,eachKey)
self.keyListModel.set_value(iter,1,self.keys.get(eachKey))
self.keyListModel.set_value(iter,2,False)
.
self.col = gtk.TreeViewColumn("key id",gtk.CellRendererText(),text=0)
self.col1 = gtk.TreeViewColumn("name",gtk.CellRendererText(),text=1)
self.col2 = gtk.TreeViewColumn("allow",gtk.CellRendererToggle(),active=2)
self.col2.connect('toggled',self.toggle)
.
def toggle(cell, path_string, model):
print "toggled"


Thanks again.

> You want to use a gtk.CellRendererToggle() instead of a 
> CellRendererText().  You want to map active=2 to make the toggle display 
> the state of the 3rd column.  If you want the toggle to update the state 
> of the tree, you will need to connect to the cell renderer's "toggled" 
> signal.  Your callback might look something like this:
>def cell_toggled(cell, path_string, model):
>path = tuple([int(i) for i in path_string.split(':')])
>row = model[path]
>row[2] = not row[2]
>model.row_changed(path, row.iter)
> 
> (I haven't tested the above, but it is approximately what it should look 
> like).
> 
> James.
> 
> -- 
> Email: [EMAIL PROTECTED]
> WWW:   http://www.daa.com.au/~james/
> 
> 
> 
> ___
> pygtk mailing list   [EMAIL PROTECTED]
> http://www.daa.com.au/mailman/listinfo/pygtk
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

-- 

Jay Graves 
[EMAIL PROTECTED]
jay.skabber.com

   O__
  _/`.\
  `=( '



pgp0.pgp
Description: PGP signature


Re: [pygtk] TreeList check boxes

2003-03-06 Thread James Henstridge
Jay Graves wrote:

I am trying to have a TreeList with check boxes in the TreeViewColumn
If you don't know what I mean look at the gconf-editor and click around,
you will see one.
Right now I have:
self.keyListModel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, 
gobject.TYPE_BOOLEAN)
.
self.keyListModel.set_value(iter,0,eachKey)
self.keyListModel.set_value(iter,1,self.keys.get(eachKey))
self.keyListModel.set_value(iter,2,False)
.
self.col = gtk.TreeViewColumn("key id",gtk.CellRendererText(),text=0)
self.col1 = gtk.TreeViewColumn("name",gtk.CellRendererText(),text=1)
self.col2 = gtk.TreeViewColumn("allow",gtk.CellRendererText())
I have tried putting text=2 in the col2 gtkTreeViewColumn but that just
displays 'False' in the TreeView
Am I on the right track or way off base?  
Does anyone know how to achieve this?
 

You want to use a gtk.CellRendererToggle() instead of a 
CellRendererText().  You want to map active=2 to make the toggle display 
the state of the 3rd column.  If you want the toggle to update the state 
of the tree, you will need to connect to the cell renderer's "toggled" 
signal.  Your callback might look something like this:
   def cell_toggled(cell, path_string, model):
   path = tuple([int(i) for i in path_string.split(':')])
   row = model[path]
   row[2] = not row[2]
   model.row_changed(path, row.iter)

(I haven't tested the above, but it is approximately what it should look 
like).

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] Entry validation

2003-03-06 Thread Rene Olsthoorn
Dear readers,

At time of writing (2003.03.06), there is no entryfield validation in GTK. No support 
for currency, integer(little bit with spinbutton), date or percentage values.
I've coded a little bit, which might be useful to you.
The validation of the entry is done when it receives an focus_out_event. This is what 
I want because imho users must be free to enter anything. No beeping or blinking when 
the user happens to hit an incorrect key! And when validating, the program will remove 
the incorrect characters.
Download the example from my page at: 
http://home.hetnet.nl/~olsthoorns/OpenSource/cc/entryvalidation.html
To keep the example simple, I didn't use libglade or date entry.
Keep in mind that the code you can download is software in progress, so it's not 
perfect. And if somebody knows python code that does a better job at validation, 
please let me know.
(that guys coding ZOPE really never coded something like this? I can hardly imagine...)

Greets and best whishes,
Rene Olsthoorn.

-- 
__
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] TreeList check boxes

2003-03-06 Thread Jay Graves
I am trying to have a TreeList with check boxes in the TreeViewColumn
If you don't know what I mean look at the gconf-editor and click around,
you will see one.

Right now I have:
self.keyListModel = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING, 
gobject.TYPE_BOOLEAN)
.
self.keyListModel.set_value(iter,0,eachKey)
self.keyListModel.set_value(iter,1,self.keys.get(eachKey))
self.keyListModel.set_value(iter,2,False)
.
self.col = gtk.TreeViewColumn("key id",gtk.CellRendererText(),text=0)
self.col1 = gtk.TreeViewColumn("name",gtk.CellRendererText(),text=1)
self.col2 = gtk.TreeViewColumn("allow",gtk.CellRendererText())

I have tried putting text=2 in the col2 gtkTreeViewColumn but that just
displays 'False' in the TreeView

Am I on the right track or way off base?  
Does anyone know how to achieve this?

Thanks

-- 

Jay Graves 
[EMAIL PROTECTED]
jay.skabber.com

   O__
  _/`.\
  `=( '



pgp0.pgp
Description: PGP signature


[pygtk] [ANNOUNCE] PyGtkGLExt 0.0.1

2003-03-06 Thread Naofumi Yasufuku
Hello PyGTK list members,

I've released PyGtkGLExt - Python language binding for GtkGLExt
(OpenGL Extension to GTK).

  http://sourceforge.net/projects/gtkglext/

This is the first alpha release. Could you please try this?
Any patches, bug fixes and improvements are always welcome.

Requirements:

  * Python 2.2(http://www.python.org/)
  * PyOpenGL 2.0  (http://pyopengl.sourceforge.net/)
  * PyGTK 1.99.15 (http://www.daa.com.au/~james/software/pygtk/)
  * GtkGLExt 0.7.0(http://gtkglext.sourceforge.net/)

Currently, PyGtkGLExt has only a few examples which come with PyGTK.
If you send me your PyGtkGLExt program, I'll be glad to add it to the
source package.

Enjoy!

--Naofumi
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] applets & libglade

2003-03-06 Thread mekkaoui omar
Le jeu 06/03/2003 à 13:55, Christian Reis a écrit :
> On Wed, Mar 05, 2003 at 11:57:24PM +0100, Martin Preishuber wrote:
> > > > 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> > > > something like:
> > > > 
> > > > xml = gtk.glade.XML(gladefile)
> > > > 
> > > > this works fine, but it immidiately shows the window ... is there any
> > > > way to load it invisible and set it to visible manually later ? I need
> > > > to fill some parts of the window before it is visible.
> > > 
> > > Go into glade, mark the window, go the Common tab, uncheck Visible.
> > 
> > thanks again ... how comes, that I feel somehow stupid now ? :|
> 
> You shouldn't. This is a very common problem when using liglade to build
> a complex application -- the parse of the file has the side-effect of
> rendering the window when it's marked as visible.
> 
> I've discussed this before, and I'm not sure there is a good solution to
> the problem. On one hand, you could ignore the visible attribute for
> top-level windows, but that would be violating the 1-1 correspondence
> between gladefile and libglade tree which is expected. On the other
> hand, you could have Glade make GtkWindows not visible my default; but
> then you have a consistency issue between windows and other widgets.
> 
> I don't see solutions (beyond stuff like 
> 
> GladeXML("foo.glade", invisible_windows=1)
> 
> which I don't like very much). But maybe somebody else does.
> 


Hi,
Here is my approach to use glade for a complex application. I suppose an
application with two windows (window1 and an about widget).

def on_about_activate(obj):
about = XML("foo.glade", "about1").get_widget("about1")
about.show()

def start_foo():
global wTree
dic = {"gtk_main_quit": mainquit,
   "on_button1_clicked":on_about_activate}

gnome.init("foo.glade","2.0")
wTree = XML("foo.glade", "window1")
wTree.signal_autoconnect(dic)

"""At this level only window1 appear and when you button1 is
clicked the about1 widget appear too.
You haven't to specify anything for a GtkWidget like not
visible property. 
"""

if __name__ == "__main__":
start_foo()
mainloop()

Perhaps is not a correct approach but it works very well for.

___
Omar Mekkaoui
Thema, University of Cergy-Pontoise
France





___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] GObject reference handling

2003-03-06 Thread James Henstridge
James Henstridge wrote:

If anyone on the list has experience with the Python cycle GC, I would 
appreciate it if you could read over my reasoning, and hopefully spot 
any obvious mistakes.  If I can get this working, I would like to 
apply it for the next pygtk release.
Okay.  I found the problem (it was a fairly simple problem).  There is a 
fixed patch on bug 92955 now.

The main difference in behaviour with this change is that GObject 
subclasses with __del__ methods will not get released.  This behaviour 
comes from the cycle GC, since __del__ methods aren't usually written to 
function correctly when the instance dictionary has been cleared, for 
instance.

Is this likely to be a problem for anyone?  In my opinion, the gains 
from such a change outweigh the losses but I would like to hear other 
people's point of view if they disagree.  The patch is available here:
   http://bugzilla.gnome.org/showattachment.cgi?attach_id=14812

James.

--
Email: [EMAIL PROTECTED]
WWW:   http://www.daa.com.au/~james/


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Port of pugtk-1.99.15 on win32

2003-03-06 Thread Martin Preishuber
Hi,The page is nice yes :) the only thing which should be changed,
is the download site of GTK+ Runtime Environment. I think the primary site
ishttp://sourceforge.net/projects/gtk-win/since the
other site just references the sourceforge page. I wanted to change this in
Christians FAQ, but then I realized that I didn't have the password and
lazyness caught me :)Martin

- Original Message From:
"Christian Reis" <[EMAIL PROTECTED]>To: "Cedric Gustin"
<[EMAIL PROTECTED]>Cc: [EMAIL PROTECTED]Subject: Re:
[pygtk] Port of pugtk-1.99.15 on win32Date: 06/03/03 14:54On Wed, Mar 05, 2003 at 09:40:08PM +0100,
Cedric Gustin wrote:>> After some requests from a bunch of
users interested by my port of pygtk on> win32, I created a web page
with the binaries at>> http://www.pcpm.ucl.ac.be/~gustin/win32_ports/>>
Feel free to send any comment.Why not have a link to the older
versions, including the pygtk-0.6.xversions? You can put up a notice
saying "These are unsupported, use atyour own risk and don't dare
emailing me" if you don't want to behassled about it?Apart from
that, thanks for the webpage, it was really becomingnecessary
:-)Take care,--Christian Reis, Senior Engineer, Async Open
Source, Brazil.http://async.com.br/~kiko/ | [+55 16] 261 2331 |
NMFL___pygtk mailing
list [EMAIL PROTECTED]http://www.daa.com.au/mailman/listinfo/pygtkRead the
PyGTK FAQ: http://www.async.com.br/faq/pygtk/

___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Curves, splines and libart

2003-03-06 Thread cybolic
Thanks all three of you for your answers.

I've already implemented an algorithm using the method I described in my
mail, if anyone is interrested in it... I'ts a but funny though, but gives
interresting results, probably has best use in interactive demos :) .

Cheers...

Christian / Cybolic


___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] Port of pugtk-1.99.15 on win32

2003-03-06 Thread Christian Reis
On Wed, Mar 05, 2003 at 09:40:08PM +0100, Cedric Gustin wrote:
> 
> After some requests from a bunch of users interested by my port of pygtk on 
> win32, I created a web page with the binaries at
> 
> http://www.pcpm.ucl.ac.be/~gustin/win32_ports/
> 
> Feel free to send any comment.

Why not have a link to the older versions, including the pygtk-0.6.x
versions? You can put up a notice saying "These are unsupported, use at
your own risk and don't dare emailing me" if you don't want to be
hassled about it?

Apart from that, thanks for the webpage, it was really becoming
necessary :-)

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


Re: [pygtk] applets & libglade

2003-03-06 Thread Christian Reis
On Wed, Mar 05, 2003 at 11:57:24PM +0100, Martin Preishuber wrote:
> > > 2.) I create some windows with glade (pygtk2 1.99.15), to use it I do
> > > something like:
> > > 
> > >   xml = gtk.glade.XML(gladefile)
> > > 
> > > this works fine, but it immidiately shows the window ... is there any
> > > way to load it invisible and set it to visible manually later ? I need
> > > to fill some parts of the window before it is visible.
> > 
> > Go into glade, mark the window, go the Common tab, uncheck Visible.
> 
> thanks again ... how comes, that I feel somehow stupid now ? :|

You shouldn't. This is a very common problem when using liglade to build
a complex application -- the parse of the file has the side-effect of
rendering the window when it's marked as visible.

I've discussed this before, and I'm not sure there is a good solution to
the problem. On one hand, you could ignore the visible attribute for
top-level windows, but that would be violating the 1-1 correspondence
between gladefile and libglade tree which is expected. On the other
hand, you could have Glade make GtkWindows not visible my default; but
then you have a consistency issue between windows and other widgets.

I don't see solutions (beyond stuff like 

GladeXML("foo.glade", invisible_windows=1)

which I don't like very much). But maybe somebody else does.

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/


[pygtk] port of the textview demo from gtk+2.0

2003-03-06 Thread Nathan Hurst
I've ported the textview demo from the gtk+2.0 tarball into python-gtk2. Feel free to 
add it to the distro or whatever.

http://hawthorn.csse.monash.edu.au/~njh/programming/python-toys/textview.txt

-- 
njh
http://www.csse.monash.edu.au/~njh/
___
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/