[pygtk] gnome-python2.0
Is there any chance of getting this to work with the vicious build scripts? I'm not an auto* expert but would really like to use glade2 with python. Stephen. ___ 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] defs in gnome-python
Hi, I noticed the .defs files in gnome-python/gnome-python are not copied to shape/pygtk/2.0/defs. This is very unpleasant since I inherit from GnomeCanvas for DiaCanvas view class. I posted a bug (#80448) on bugzilla.gnome.org and applied a patch. Regards, Arjan ___ 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] GtkTextBuffer.set_modified
Hi to all, with the new release of pygtk I've problem with gtkTextBuffer.set_modified method More precisely it semms to be broken, please can anybody check it? Thanks Pier ___ 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] Widget tree traversal
On Wed, 2002-05-01 at 10:43, Steve McClure wrote: Please excuse the interruption. A quick search turned up the answer. > I can't find anything to get the parent of a widget. There are methods > to reparent and unparent but I don't see any method to just retrieve the > parent widget. > > I'm using Gtk 1.2 > > Thanks, > -- > Steve McClure 430 10th St NW > RacemiSuite N-210 > http://www.racemi.com Atlanta, GA 30318 > [EMAIL PROTECTED] voice/fax: 404-892-5850 -- Steve McClure 430 10th St NW Racemi Suite N-210 http://www.racemi.com Atlanta, GA 30318 [EMAIL PROTECTED] voice/fax: 404-892-5850 signature.asc Description: This is a digitally signed message part
Re: [pygtk] dialog window function
On Wed, 2002-05-01 at 16:41, Steve McClure wrote: > On Wed, 2002-05-01 at 10:34, Erik Grinaker wrote: > > > > I'm using 0.6.8 for GTK+ 1.2, so it didn't work - but I'm getting a > > similar error whenever I try re-opening a window which has been > > destroy()ed, so it's surely just some silly error I've made. > > You can't reopen a window that has been destroyed, you can only recreate > it. You might prefer to set hide_on_delete() for the window and then > use show() and hide() to manage them. Yeah, that was it - thanks -- Erik Grinaker Freelance UNIX/Linux systems consultant "Perfection is acheived not when there is nothing more to add, but rather when there is nothing more to take away" - Antoine de Saint-Exupéry signature.asc Description: This is a digitally signed message part
[pygtk] Widget tree traversal
I can't find anything to get the parent of a widget. There are methods to reparent and unparent but I don't see any method to just retrieve the parent widget. I'm using Gtk 1.2 Thanks, -- Steve McClure 430 10th St NW Racemi Suite N-210 http://www.racemi.com Atlanta, GA 30318 [EMAIL PROTECTED] voice/fax: 404-892-5850 signature.asc Description: This is a digitally signed message part
Re: [pygtk] dialog window function
On Wed, 2002-05-01 at 10:34, Erik Grinaker wrote: > On Wed, 2002-05-01 at 15:47, Matt Wilson wrote: > > > in PyGTK+ 2.x: > > > > label.set_property('text', text) > > I'm using 0.6.8 for GTK+ 1.2, so it didn't work - but I'm getting a > similar error whenever I try re-opening a window which has been > destroy()ed, so it's surely just some silly error I've made. You can't reopen a window that has been destroyed, you can only recreate it. You might prefer to set hide_on_delete() for the window and then use show() and hide() to manage them. > > btw; is it recommended to develop for the 2.x platform? I haven't > checked out the GNOME 2.0 prereleases yet, as I want a stable > environment - and I heard there were quite a few conflicts between gtk > 1.2 and 2.0 applications. > > > -- > > Erik Grinaker > Freelance UNIX/Linux systems consultant > > "Perfection is acheived not when there is nothing more to add, but > rather when there is nothing more to take away" > - Antoine de Saint-Exupéry > > > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Steve McClure 430 10th St NW Racemi Suite N-210 http://www.racemi.com Atlanta, GA 30318 [EMAIL PROTECTED] voice/fax: 404-892-5850 signature.asc Description: This is a digitally signed message part
Re: [pygtk] dialog window function
On Wed, 2002-05-01 at 15:47, Matt Wilson wrote: > in PyGTK+ 2.x: > > label.set_property('text', text) I'm using 0.6.8 for GTK+ 1.2, so it didn't work - but I'm getting a similar error whenever I try re-opening a window which has been destroy()ed, so it's surely just some silly error I've made. btw; is it recommended to develop for the 2.x platform? I haven't checked out the GNOME 2.0 prereleases yet, as I want a stable environment - and I heard there were quite a few conflicts between gtk 1.2 and 2.0 applications. -- Erik Grinaker Freelance UNIX/Linux systems consultant "Perfection is acheived not when there is nothing more to add, but rather when there is nothing more to take away" - Antoine de Saint-Exupéry ___ 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] dialog window function
in PyGTK+ 2.x: label.set_property('text', text) Cheers, Matt On Wed, May 01, 2002 at 03:31:18PM +0200, Erik Grinaker wrote: > > Also; I seem to be having some problems when the function is called the > second time around; Python gives this error: > > File "main.py", line 142, in dialog_yesno > label.set_text(text) > AttributeError: 'NoneType' object has no attribute 'set_text' ___ 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] dialog window function
Hi all I have just started out with Python, and am playing around a bit with pygtk and libglade. I have some experience with structured programming, but this is my first encounter with object-oriented programming. I am trying to create a generic function for a Yes/No type dialog box, but the code seems a bit "clunky" - would anyone care to look at it and give me some pointers to how this could be done in a sexier fashion? Also; I seem to be having some problems when the function is called the second time around; Python gives this error: File "main.py", line 142, in dialog_yesno label.set_text(text) AttributeError: 'NoneType' object has no attribute 'set_text' Any ideas? Here is the code for my dialog function : def dialog_yesno(text): "Displays a yes/no dialog, returns true on yes, false on no" global xml, status def yes(obj): global status status = 1 print "yes" window_yesno.destroy() gtk.mainquit() def no(obj): global status status = 0 print "no" window_yesno.destroy() gtk.mainquit() def destroy(obj): obj.destroy() gtk.mainquit() # get pointers to relevant widgets window_yesno = xml.get_widget("window_yesnodialog") label = xml.get_widget("yesno_text") yesbutton = xml.get_widget("yesno_yes") nobutton = xml.get_widget("yesno_no") # set the dialog window label label.set_text(text) # default status is false status = 0 # map signals yesbutton.connect("clicked", yes) nobutton.connect("clicked", no) window_yesno.connect("destroy", destroy) # Show the window window_yesno.show() gtk.mainloop() # Return our value return status -- Erik Grinaker Freelance UNIX/Linux systems consultant "Perfection is acheived not when there is nothing more to add, but rather when there is nothing more to take away" - Antoine de Saint-Exupéry ___ 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] Memory usage question
On Wed, 2002-05-01 at 02:07, James Henstridge wrote: > >I've been experimenting with libglade from Python, and have found that I > >can use up an awful amount of memory incredibly quickly by destroying > >and re-creating widgets. I've written a small script that demonstrates > >it. > > If you could run this under memprof to see which allocations are using > the most memory? Thanks for the reply. I've downloaded memprof. Can you give me some pointers on what to do with it and what should I look for? (I can execute my script from memprof okay, but I'm not sure what to look out for) > What if you change the labe.destroy() calls to this?: vbox.remove(label) No change, unfortunately. It eats approximately 1MB per second. > If you feel like it, you could also try the latest pygtk 1.99.x release > to see if it has the same problem (much of the code has been rewritten > for the 2.0 release of both pygtk and libglade). I will definitely be having a look at that at some point, but for the moment I have to stick with the old versions as porting the rest of our code base over to 2.0 would be a big job. How solid are the 2.0 python bindings, in comparison to the older versions? -- Graham Ashton ___ 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] Inheriting from GObject
Hi, I'm working on a python wrapper for DiaCanvas2 (hence the previous postings ;-) and came up with some thoughts... First of all: the properties and signal handling in Python is really neat. But it's screaming for more... Shouldn't it be nice if classes inherited from GObject (or GTK+ objects or whatever) can override the methods defined in the *Class structures? I noticed property handling works nice this way (although it works a little different, so it's not comparable :-( ). Inheriting from a GObject, calling __gobject__init__() in the __init__() method and registering it declaration creates a new GType. It would be nice if an object could set some custom handlers for *Class methods itself. In case of a DiaCanvasItem (and GnomeCanvasItem) this would mean that if you create your own canvas item you can override the default 'update' method by creating a 'on_update' method or something like that in your python class and PyGTK takes care of the rest. This creates a few problems: - what happens if you inherit from a python class which is inherited from a GObject class? - How do we define those handlers? Next: it would also be very neat if you can inherit from a GObject and a set of interfaces. E.g. class MyClass (GObject, GtkTreeModel): def on_get_value(self): pass The type registration stuff should be able to handle this AFAICS. This means of course that overriding *Class methods should work properly. And last: could it be possible to depricate the gobject.type_register() function? Could it be done during the first call to GObject.__gobject_init__()? That would make the python code more clean. I hope I made myself clear ;-) ... Regards, Arjan ___ 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] defs in gnome-python
Hi, I noticed the .defs files in gnome-python/gnome-python are not copied to shape/pygtk/2.0/defs. This is very unpleasant since I inherit from GnomeCanvas for DiaCanvas view class. I posted a bug (#80448) on bugzilla.gnome.org and applied a patch. Regards, Arjan ___ 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] constructors in h2def.py
Hi, I used h2def.py this weekend and noticed it does not create 'is-constructor-of' entries in the generated code. I started browsing the code and noticed this is a todo item. I solved it this way: - a constructor function ends with '_new' and returns a pointer - h2def converts the text before the _new to a class name and writes a constructor entry. Here's the patch. Regards, Arjan Index: pygtk/codegen/h2def.py === RCS file: /cvs/gnome/gnome-python/pygtk/codegen/h2def.py,v retrieving revision 1.15 diff -u -r1.15 h2def.py --- pygtk/codegen/h2def.py 2002/04/17 16:07:40 1.15 +++ pygtk/codegen/h2def.py 2002/05/01 09:43:28 @@ -296,6 +296,8 @@ write_func(fp, func, ret, args) get_type_pat = re.compile(r'(const-)?([A-Za-z0-9]+)\*?\s+') +pointer_pat = re.compile('.*\*$') +func_new_pat = re.compile('(\w+)_new$') def write_func(fp, name, ret, args): if len(args) >= 1: @@ -334,9 +336,23 @@ fp.write(')\n\n') return # it is either a constructor or normal function -# FIXME: put in constructor check fp.write('(define-function ' + name + '\n') -# do in-module thingee + +# Hmmm... Let's asume that a constructor function name +# ends with '_new' and it returns a pointer. +m = func_new_pat.match(name) +if pointer_pat.match(ret) and m: +cname = '' + for s in m.group(1).split ('_'): + cname += s.title() + if cname != '': + fp.write(' (is-constructor-of "' + cname + '")\n') +else: + # do in-module thingee + s = name.split('_') + if s: + fp.write(' (in-module "' + s[0].title() + '")\n') + fp.write(' (c-name "' + name + '")\n') if ret != 'void': fp.write(' (return-type "' + ret + '")\n')