Re: [pygtk] how to sort properly by column and display right-justifiedtext?
On Tue, 23 Oct 2001, Skip Montanaro wrote: 2. It doesn't matter what I fill the size list with (numbers or their string representation), the column header always sorts lexicographically, not numerically. How can I make it sort numerically? Also, the sizes are always displayed centered. Is there a way to make them right-justified? I used to have the same problem. The gtk function gtk_clist_set_comare_func() is not mapped into pygtk (at least not in the version I have, which is 0.6.6). What I did is add the data as space padded strings, using str(number).rjust(width), where width is the max width of the column. This should get you the list sorted correctly. If you want to use the data afterwards, you need to convert it back to an integer. Alexandre Fayolle -- LOGILAB, Paris (France). http://www.logilab.com http://www.logilab.fr http://www.logilab.org Narval, the first software agent available as free software (GPL). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Why do some stock images not display?
I noticed today that some of the stock images seem to be missing when creating widgets in PyGtk2 that use them. At Havoc's suggestion I ran Gtk's stock image demo. Everything worked fine there. On my system at least, the script below fails to display the UP or DOWN stock images. The BACK and FORWARD images display properly. #!/usr/bin/env python import gtk w = gtk.Window() w.connect(destroy, gtk.mainquit) tbl = gtk.Table(4, 2) tbl.set_homogeneous(gtk.TRUE) w.add(tbl) aopt = gtk.EXPAND|gtk.FILL|gtk.SHRINK r = 0 for label,stock in ((GO_UP, gtk-go-up), (GO_DOWN, gtk-go-down), (GO_BACK, gtk-go-back), (GO_FORWARD, gtk-go-forward)): c = 0 tbl.attach(gtk.Label(label),c,c+1,r,r+1, aopt, aopt, 0, 0) c = 1 tbl.attach(gtk.Button(stock=stock),c,c+1,r,r+1, aopt, aopt, 0, 0) r += 1 w.show_all() gtk.mainloop() This is extremely weird, because the pixbufs are hard-coded into Gtk. There are no files that can be missing. Can someone explain to me what's going on? Thanks, -- Skip Montanaro ([EMAIL PROTECTED]) http://www.mojam.com/ http://www.musi-cal.com/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Another off-the-wall question
Hi. This is another off the wall question, and it'll probably get as much attention as my question about gnome.triggers last week, but does anyone know if anyone is working on Python bindings for GConf? -- ++ | Jason F. McBrayer [EMAIL PROTECTED] | | The scalloped tatters of the King in Yellow must hide Yhtill | | forever.R.W. Chambers _The King in Yellow_ | ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] how to sort properly by column and display right-justifiedtext?
On Wed, 24 Oct 2001, Alexandre Fayolle wrote: I used to have the same problem. The gtk function gtk_clist_set_comare_func() is not mapped into pygtk (at least not in the version I have, which is 0.6.6). I did a lovely hack in Kiwi and I remove and reinsert every item into the list. Sound evil? It probably is, but I get to define my own sort function (which I do pretty easily) and it's fast as anything, even being pure python. Check it out. Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] GtkCList and find_row_from_data
I'm trying to use the find_row_from_data() in GtkClist to determine if I should update a row or append a new one, but find_row_from_data() always returns a -1 (row not found). What should the data parameter to find_row_from_data() look like? The clist has two columns and I also associate some additional data with each row using set_row_data() -- -- Travis Hume Software Engineer Tenzing Communications Inc. [EMAIL PROTECTED] ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Another off-the-wall question
On Wed, Oct 24, 2001 at 03:25:20PM -0400, Jason F. McBrayer wrote: Hi. This is another off the wall question, and it'll probably get as much attention as my question about gnome.triggers last week, but does anyone know if anyone is working on Python bindings for GConf? Fairly off-topic for this list, but I'll respond here just so that people can know it's been answered. Anything further, email me directly. To answer your question: I started to put some together about three weeks ago just for fun, but I've since been very sick and haven't looked at them (or the approximately three dozen other GNOME things I'm meant to be doing). They're not hard to do and if nobody else does anything, I'll eventually get back to them (in a week or two) and make them available. Malcolm -- On the other hand, you have different fingers. ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Emitting signal
On Sat, 13 Oct 2001, Arun wrote: If its with emit function, what are the parameters other than the signal name. Arguments to be passed as the signal's arguments. See gtk/gtk-signals.html in the gtk documentation. Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] FAQ call for PyGTK
Hello python-gtk-ninjas, I'm volunteering to write a FAQ for pygtk and I'm rounding up questions (preferrably with answers) that have plagued the list frequently. To help me out, just reply to this message to me, personally, with a question [+ answer] to a common question. No need to spam the list for it, too. I'll post a preview to the list on friday with the stuff collected so far and then we can do a first iteration. So scratch those heads and remember the questions that we answered over and over again. If anybody wants to plunge through the archives and check out what was queried frequently, i'll be saved that work too. I'm considering plain HTML, LaTeX and flat text in that order. I don't know any Docbook, unfortunately, so that's no good for me. Well, hoping to hear from you folks soon. Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Another off-the-wall question
On Thu, 25 Oct 2001, Malcolm Tredinnick wrote: To answer your question: I started to put some together about three weeks ago just for fun, but I've since been very sick and haven't looked at them (or the approximately three dozen other GNOME things I'm meant to be doing). With bonobo-python this should be simple, no zilch? Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] GDK_SELECTION_PRIMARY
On Mon, 22 Oct 2001, Jon Nelson wrote: What I want to do is, when the appropriate menu entry is selected, copy a line from a CList to the X clipboard. How do I do this? Uhm. So this has nothing to do with menus? You want to click on a clist row and have the line inserted into the X clipboard? Right now I don't know if that's possible: AFAICT we do have a GtkSelectionData type in pygtk, but I can't see an easy way to set the data. Hmmm. Check out the GTK Selection section of the GTK tutorial, and see if you can get a function that returns a GtkSelectionData instance. If you do, you can try meddling with the set() method it provides (see gtkmodule.c). Chances are you'll need to hook to some signal handler that returns this or perhaps even hack a function in - I'm too sleepy to find out on my own right now :) Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Patch to those who use glc.py (Python Glade Code Generator)
On Mon, 22 Oct 2001, Russell Nelson wrote: I agree that a) and b) are yucky. I much prefer: c) using `make' to re-generate the code whenever you change the .glade file, and never otherwise change the code. I guess... you have to rely on the generated code being good, of course, and you can't fit it into a framework like Kiwi without hacking the code generator (since the generation is monolithic, right?) I'm not too familiar with generation, but it seems a tad unflexible to me. Why _not_ libglade, btw? Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How to use GnomeDialog from an applet
On 23 Oct 2001, Akos Polster wrote: This is what happens: I create a GnomeDialog with a Close button, then call run_and_close. run_and_close returns when I press Close, but the dialog, instead of being destroyed, stays on the screen, and becomes unresponsive, together with the rest of the applet. Do the buttons click, or is the app frozen? Does the app redraw when covered with another window or not? Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] - Callback problem]
On Tue, 16 Oct 2001, Brice VISSIERE wrote: Here are the warnings printed when i close the window Traceback (most recent call last): File /usr/lib/python2.0/site-packages/gtk.py, line 125, in __call__ ret = apply(self.func, a) TypeError: no arguments expected Other idea with these new elements ? Brice, one thing I do know is that 'destroy' doesn't send an event as a second parameter. So your callback function should have the following signature: def my_destroy_handler(self): do_whatever() return gtk.TRUE You could also use something like def my_destroy_handler(self, *args): to avoid this sort of problem - I always do so my callbacks are easier to use. There is a misunderstood, my callback function is not declared in the imported module, but in the main module; the window class definition is in the imported module. I try to do that : connect a callback to an instance of my window. Note that 'delete_event' in turn _does_ supply an event parameter, so a single-argument signature won't work for it. Use *args, and use delete_event - it's safer :-) Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] leave_notify event?
[pygtk-0.6.6, gtk+-1.2.7, python 2.1, i86 linux 2.2.16] I have some text and entry widgets, and when the user changes the value in one of them and moves on to another widget in the GUI, I need to grab the changes and put them in the database. I've tried: self.comment_text.connect('leave_notify_event', self.leave_event, self.comment_text) def leave_event(self, a, ev, c): for s in dir(ev): print s, eval('ev.%s' % s) but it's not clear how to decode the event object. The 'type' field is certainly == gtk.GDK.LEAVE_NOTIFY == 11, but I get this event on entering AND twice on leaving the widget! How can I distinguish these? Sometimes the 'detail' field varies, but it doesn't seem reliable. Or is there some altogether different approach to this problem? Thanks, -- George Young E.g. output: detail 0 focus 0 mode 0 send_event 0 state 0 subwindow None time -1065713290 type 11 window GdkWindow at 83522c8 x 5.0 x_root 1289.0 y 104.0 y_root 755.0 -- I cannot think why the whole bed of the ocean is not one solid mass of oysters, so prolific they seem. Ah, I am wandering! Strange how the brain controls the brain! -- Sherlock Holmes in The Dying Detective ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] leave_notify event?
george young wrote: [pygtk-0.6.6, gtk+-1.2.7, python 2.1, i86 linux 2.2.16] I have some text and entry widgets, and when the user changes the value in one of them and moves on to another widget in the GUI, I need to grab the changes and put them in the database. I've tried: self.comment_text.connect('leave_notify_event', self.leave_event, self.comment_text) def leave_event(self, a, ev, c): for s in dir(ev): print s, eval('ev.%s' % s) but it's not clear how to decode the event object. The 'type' field is certainly == gtk.GDK.LEAVE_NOTIFY == 11, but I get this event on entering AND twice on leaving the widget! How can I distinguish these? Sometimes the 'detail' field varies, but it doesn't seem reliable. Or is there some altogether different approach to this problem? For this sort of thing, you are probably more interested in keyboard focus, rather than mouse focus. enter/leave notify events get triggered as the mouse pointer crosses window boundaries. If you want to know when the keyboard focus enters or leaves a widget (which is a different thing), use focus_in_event and focus_out_event. James. -- Email: [EMAIL PROTECTED] WWW: http://www.daa.com.au/~james/ ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] leave_notify event?
On Thu, 25 Oct 2001, James Henstridge wrote: I have some text and entry widgets, and when the user changes the value in one of them and moves on to another widget in the GUI, I need to grab the changes and put them in the database. I have a Form widget I am cooking that will do exactly this - you can notify a handler of your choice when data changes. It works nicely with Kiwi and I'll probably have it ready by next week sometime. If you want to know when the keyboard focus enters or leaves a widget (which is a different thing), use focus_in_event and focus_out_event. Right, I use focus_out_event and activate, and in some cases insert_text should be caught to update the UI in realtime. No point in saving to the database in the insert_text case of course, the overhead is murder. Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 272 3330 | NMFL ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk