Re: [pygtk] glc
On 11 Feb 2002, Phil Porter wrote: > I use a version of glc to help me write pygtk code. I have modified it > to create classes that I can inherit from. I dont know if the author is > still maintaning it. The script that I run still has some bugs in it, > but I generally just pull out what I need, paste it into my projects and > work on it from there. I think gladepyc does a similar job. http://www.fcoutant.freesurf.fr/gladepyc.html 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] how to get the glade file
I'm certainly not the first one to encounter the problem. I have an application with a gtk gui built using libglade. Right now, the glade file is in the same directory as the python file, and this works as long as I launch the python script from that directory. I would like to make things a bit more less 'hardcoded'. I've come up with the following hack. Let's say the python module is called my_application.py, and the glade file is my_application.glade. In the module I have: import my_application # import oneself import os.path GLADE_FILE = os.path.join(os.path.dirname(my_application.__file__), 'my_application.glade') It does the job, but I'm not sure that this ios the right way of doing things. Any comments ? 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
Re: [pygtk] glade and libglade
On Tue, 5 Feb 2002, Alexandre Fayolle wrote: > So it looks like the > GtkMenuItem > fichier1 > GNOMEUIINFO_MENU_FILE_TREE... are > causing a breakage somewhere, since this is where I got the > pixmaps from. > > Anyone has an idea on how to solve this? OK, answering to myself once more. A quick search in the archives gave me http://www.daa.com.au/pipermail/pygtk/2001-July/001487.html The solution is indeed to import gnome.ui at the beginning of the program. Cheers, 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
Re: [pygtk] glade and libglade
On Tue, 5 Feb 2002, Alexandre Fayolle wrote: > [alf@gemini glade]$ python glade.py grammar_editor.glade > > GLib-CRITICAL **: file gstring.c: line 329 (g_string_prepend): assertion > `val != NULL' failed. > IMLIB ERROR: Cannot allocate XImage buffer > > Gdk-CRITICAL **: file gdkwindow.c: line 1406 > (gdk_window_get_visual): assertion `window != NULL' failed. > Segmentation fault (core dumped) Toying a bit more with gdb gave me the following: Reading symbols from /usr/lib/python2.1/site-packages/_gladegnomemodule.so... done. Reading symbols from /usr/lib/libglade-gnome.so.0...done. Reading symbols from /usr/lib/libgnomeui.so.32...done. Reading symbols from /usr/lib/libart_lgpl.so.2...done. Reading symbols from /usr/lib/libgdk_imlib.so.1...done. Reading symbols from /usr/X11R6/lib/libSM.so.6...done. Reading symbols from /usr/X11R6/lib/libICE.so.6...done. Reading symbols from /usr/lib/libgnome.so.32...done. Reading symbols from /usr/lib/libgnomesupport.so.0...done. Reading symbols from /lib/libdb.so.3...done. #0 gnome_stock_paint (stock=0x8226fb8, pixmap=0x822ad28) at gnome-stock.c:366 366 gpixmap->pixmap = gdk_pixmap_new(pixmap->pixmap, So it looks like the GtkMenuItem fichier1 GNOMEUIINFO_MENU_FILE_TREE... are causing a breakage somewhere, since this is where I got the pixmaps from. Anyone has an idea on how to solve this? TIA 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] glade and libglade
I'm using glade 0.5.9, and libglade 0.17 with gnome-python 1.4.2. Are there any known incompatibilities between theses 3 versions ? The reason I'm asking is that I get a core dump when I try to load the XML file within Python: [alf@gemini glade]$ python glade.py grammar_editor.glade GLib-CRITICAL **: file gstring.c: line 329 (g_string_prepend): assertion `val != NULL' failed. IMLIB ERROR: Cannot allocate XImage buffer Gdk-CRITICAL **: file gdkwindow.c: line 1406 (gdk_window_get_visual): assertion `window != NULL' failed. Segmentation fault (core dumped) I've tried to upgrade to glade 0.6.4, but resolving the dependencies is proving to be quite a nightmare, so if there's an easier way, I'd rather try it. 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] glc
Does anyone here know if glc (http://glc.sf.net/) is still maintained? 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
Re: Threads on win32 (Re: [pygtk] Porting PyGTK on Win32)
On Thu, 24 Jan 2002, Michael Gilfix wrote: > So you only need to set the timer and then you can use locking > regularly? How does that affect the load on the machine? I'll > give it a shot when I get home later tonight then. Do you know why > that fixes it? I think that this enables the other threads to get some CPU by forcing a context switch. But I have not deved deep enough in the intricacies of python threading lib and win32gtk's to be sure of what's going wrong in the first place. 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
Threads on win32 (Re: [pygtk] Porting PyGTK on Win32)
On Thu, 24 Jan 2002, Michael Gilfix wrote: > The old port can be found here: > >ftp://ftp.logilab.org/pub/win32/ > > However, that port has problems with threads (read: they don't work). > Cedric, does your port have threading support? If so, it'd be a life > saver... A trick to get threads to work properly that was sent to the list some time ago (I don't remember who I should credit for it, but it works very well) is to add a timeout function that does a very short sleep, for instance 1e-3 seconds, using timeout_add(...), for instance: from gtk import * import time import sys def sleeper(): time.sleep(.001) return 1 # don't forget this otherwise the timeout will be removed if __name__== '__main__': # do other inits here if sys.platform == 'win32': timeout_add(400,sleeper) mainloop() You should adjust the value of the period of the timeout so that your app still runs smoothly. Another limitation of gtk on Win32 is that the input_add function does not work. The callback function gets called each time an event occurs in the app, so you should avoid it. 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
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
Re: [pygtk] Compiled versions of _gtk.pyd and libglade.pyd forPython2.1.1
On Thu, 18 Oct 2001, Christian Robottom Reis wrote: > On Thu, 18 Oct 2001, Rodrigo Senra wrote: > > > of those ? I have pygtk-0.6.8 all set, but I am having some > > problems with these 2 DLLs. > > There were supposed to be precompiled pygtk versions at > http://hans.breuer.org/ports/default.htm Python 1.5.2 and 2.0 only. 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
Re: [pygtk] Compiled versions of _gtk.pyd and libglade.pyd forPython2.1.1
On Thu, 18 Oct 2001, Rodrigo Senra wrote: > Hi, > > Does anybody have compiled versions of _gtk.pyd and libglade.pyd > that operate with Python2.1.1 upon Windows ? If so, would be > too much impertinence of mine to ask you to e-mail me a copy > of those ? I have pygtk-0.6.8 all set, but I am having some > problems with these 2 DLLs. ftp://ftp.logilab.org/pub/win32/pygtk/pygtk_py21/setup.exe This gets you an installer that sets up gtk and pygtk/libglade. 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] GtkCList.set_compare_func()
Hello, I could not find the set_compare_func() method in the GtkCList class. How can I sort a column holding numerical values ? 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] [ANN] xmltools 1.3.4
Logilab has released a xmltools 1.3.4. Python XmlTools is a set of high level tools to help using XML in python. It relies heavily on PyXml and 4Suite to access XML resources. Right now it features two pyGTK widgets: XmlTree and XmlEditor, which can respectively display and edit an XML document in a graphical fashion. Both widgets are used in the NARVAL project. The main focus of this release is fixing an encoding handling bug that would cause the application to crash on Windows machines. You can find information about xmltools on http://www.logilab.org/xmltools/ The download site is ftp://ftp.logilab.org/pub/xmltools/ 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
Re: [pygtk] Help installing pygtk, libglade in Windows - please(fwd)
Frank Miles wrote: > I'm trying to install pygtk and libglade on a Win9x system. The local > Windows guy advises me that it is necessary to edit the Windows registry > to install DLLs. Is this truly the case with the DLLs associated with > these? Well, AFAIK, this is simply not true. The DLLs just have to be in your PATH, so what is generally done on windows is putting them in c:\windows You may be interested to try out the installer I've made for pygtk. It's available on ftp://ftp.logilab.org/pub/win32/pygtk It does not feature libglade, but if you tell me where libglade for windows can be found I'll be glad(e) to include it. ;o) Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] weird problems with diacritics and GtkText
On Sun, 10 Jun 2001, James Henstridge wrote: > On Sun, 10 Jun 2001, Alexandre Fayolle wrote: > > I seem to have omitted some crucial piece of information : the client is > > running on a win2K box, and the server on a linux machine. I tried to > > reproduce this with the client running on a linux box and failed. I > > suspect a unicode problem. > > That makes sense. The win32 port of gtk+ uses UTF-8 as its character > encoding -- not latin1 which the server is most likely using. You will > need to do a Latin1 -> UTF-8 conversion, which is most easily done with > Python >= 1.6. Note that you don't want to do such a conversion on the > X11 version of gtk until 2.0 comes out :) Thanks. The solution I found (in order to keep using python 1.52) was to use the xml.unicode module that ships with the python 1.52 version of xml-sig tools. Cheers, Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] weird problems with diacritics and GtkText
On Sat, 9 Jun 2001, Alexandre Fayolle wrote: > Now, if the input has some diacritic characters, it is properly echoed. If > the response has some diacritic characters, it is *not* displayed in the > GtkText widget, though the print statement on the console shows perfectly > normal characters. > > Due to external constraints, the client runs on python 1.52, and the > server on python 2.0, but this doesn't seem to be an issue, since, as I > said, the print statement shows nice \351 for é, and \352 for ê, for > instance. I seem to have omitted some crucial piece of information : the client is running on a win2K box, and the server on a linux machine. I tried to reproduce this with the client running on a linux box and failed. I suspect a unicode problem. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] weird problems with diacritics and GtkText
Hello, I'm having a very strange problem with GtkText and diacritic characters. I'm working on the client interface of a client server program. Basically, the client has a text field in which the user can input text. When he presses Enter, the text is echoed in a GtkText widget, and sent to the server via xmlrpc. The answer is then displayed with a print on the console and displayed in the GtkText. Now, if the input has some diacritic characters, it is properly echoed. If the response has some diacritic characters, it is *not* displayed in the GtkText widget, though the print statement on the console shows perfectly normal characters. Due to external constraints, the client runs on python 1.52, and the server on python 2.0, but this doesn't seem to be an issue, since, as I said, the print statement shows nice \351 for é, and \352 for ê, for instance. I'm stuck, and will appreciate any input on the matter (we are supposed to demo the piece of code on monday, and, though everything else works fairly well, this one bug is really annoying) TIA Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] New version of the windows installer
Hi there, The version of the pygtk for win32 installer I announced a few weeks ago was broken (one missing DLL, and the DLL were copied to c:\windows\system on win9x machines, which is not on the standard PATH). This has been fixed. The fixed version is available from ftp://ftp.logilab.org/pub/win32/pygtk/ Cheers, Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Windows installer available
A windows installer for pygtk is available at ftp://ftp.logilab.org/pub/win32 Two versions are available, one for python 1.52 and one for python 2.0 This is a simple wrapup of Hans Breuer's work on the win32 port of pygtk and Tor Lillquist's win32 port of Gtk+. The installer was generated with Inno Setup. The Python20 version was not tested locally, so any feedback is welcome. It is my hope that this installer will help people using pygtk on windows. The script to generate the installer with Inno Setup is available on request. Alexandre Fayolle -- http://www.logilab.com http://www.logilab.org/narval Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] GtkTree?
On Thu, 3 May 2001, mallum wrote: > wierd this is what I was doing. But with 8 bit vals ; > > eg - my_col=window.get_colormap().alloc(0,255,255) > > with you 16 bit vals it seem to work ! Yes this is very confusing at first (esp. when combined with the Gtk Color selector which returns float values in the [0,1] range...) Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] GtkTree?
On Thu, 3 May 2001, mallum wrote: > I've been having this problem as well with a clist. Unfortunatly the solution given >here > wont work for me as I only want to change individual row colors rather than > all of them. Would it be possiblke to reverse individual row foreground and > background colors - this would do for me ? I'm sorry I missed the beginning of the thread, so this message might be completely unrelated. If so please excuse me. I don't know how to specifically reverse the colors of a row, but this is how I change the background color a an individual row in a GtkCList After the widget is realized, I allocate a new color: my_col=window.get_colormap().alloc(65535,51400,51400) and then I use list.ser_background(row,my_col), with row being the row number of the list. Since a GtkCTree is a GtkCList, this should work too? Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] how to contribute
On Thu, 29 Mar 2001, Fabien COUTANT wrote: > PS: this will be used to complete a tool I wrote: > http://www.fcoutant.freesurf.fr/gladepyc.html This could be a very useful tool. What has stopped me using glade so far is the lack of Windows support which is one of the target of the application I'm working on. I think I'll give a try to gladepyc soon. Cheers, Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Find a row from CTreeNode
On Tue, 23 Jan 2001, Phillip Ezolt wrote: > I've search and searched but can't find the answer to the following question: > > Given a GtkCTreeNode, how do I find its row number? As far as I know, you can't (but I may well be wrong). However, you should not need to do this, since all GtkCList methods requiring a row number are available in GtkCTree with the GtkCTreeNode as an argument (the name of the method is then prefixed by 'node_'. May I ask why you need to access this information? Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
RE: [pygtk] Win32 Question
On Thu, 18 Jan 2001, Steffes, Ryan wrote: > > Okay, I've done both installed the gimp (which works fine) and put the > gtk-1.3.dll gdk-1.3.dll and even gnu-intl.dll in windows\system\ > Still giving me: > > C:\Tools\Python>python > Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32 > Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam Beware: the current version on hans.breuer.org is for python 2.0, however an alternate version of _gtk.pyd for pythopn 1.5.2 is available. If you're using the python 2.0 version, the missing DLL is python's. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Win32 Question
On Thu, 18 Jan 2001, Steffes, Ryan wrote: > Since the port on Han's page doesn't seem to come with instructions, and the > one on James' page is geared toward Linux, I don't know quite what to do > with the bindings I have. > > My problem is this, I downloaded Han's ports and stuck them in > (path to python)/lib/*.py > and > (path to python)/dll/_gtk.pyd > > Python finds gtk and _gtk but insists the _gtk needs a DLL to run. Any clue > what DLL this is and what I ought do? I'm thinking this has to do with the > gtkmodule file, but as I'm running win32 It needs the gtk+ DLLs. You can grab them from Tor Lillquist (sorry about the spelling) win32 gtk+ port, as said on Hans Breuer's page, that is http://user.sgic.fi/~tml/gimp/win32/downloads.html. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] CTrees, ctyles and colours
On Thu, 18 Jan 2001 [EMAIL PROTECTED] wrote: > I'm trying to change the style of an entry in a CTree. I can change the font, > but I'm having no luck with the colour. > > style.font = gtk.load_font(font) > style.fg[gtk.STATE_NORMAL] = gtk.GdkColor(fg[0], fg[1], fg[2]) > style.bg[gtk.STATE_NORMAL] = gtk.GdkColor(bg[0], bg[1], bg[2]) > > The values in fg and bg range from 0..255; I got them out of a colour selector. > The font is being correctly applied but the colours remain the defaults. > > I've tried setting the colours directly, but if I do that I end up with black > on black. Anyone know what's going on? Try using values between 0 and 65535 for a try. This should solve your problem. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] python2, unicode and GtkCTree
On Thu, 11 Jan 2001, James Henstridge was catching up with his mail, and he wrote: > Alexandre Fayolle wrote: > > > > A long time ago (last millenium, that is), the supreme authority on pygtk, > > James Henstridge, wrote: > > > > > you should be able to pass unicode strings into just about all pygtk > > > functions, and they will be converted to the default encoding." > > (http://www.mail-archive.com/pygtk@daa.com.au/msg01963.html) > > I said that about the version of pygtk I am developing for use with GTK > 2.0 (which is not yet fully usable). It does not apply to the GTK 1.2 > targetted versions (however, thanks for reminding me to check through > the devel version for incorrect uses of PyString_Check though). Ah, OK, I had misunderstood your mail. I'll use encode() then. Thanks a lot. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Win32 && Python2.0
> John Draughn wrote: > > To any: > > It appears that the current port of PyGTK will only work with 1.5.2 > Python. I'd like to utilize the bindings with Python2.0. Does anyone > know of any solutions please respond. > I think that you should check again http://hans.breuer.org/ports, since the current port of PyGtk for Win32 only works with Python 2.0 (there's a .pyd file provided for Python 1.5.2 for those who need it, though). Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] GtkToolbar style
Hello, I think I've encountered a small cosmetic bug in GtkToolbar: it looks like specifying a style has no effect. I tried setting a style in the constructor or later with the set_style method, and I always end up with GTK.TOOLBAR_BOTH I'm using pygtk 0.6.6, gtk+ 1.2.8 on a redhat 6.2 box. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] python2, unicode and GtkCTree
A long time ago (last millenium, that is), the supreme authority on pygtk, James Henstridge, wrote: > you should be able to pass unicode strings into just about all pygtk > functions, and they will be converted to the default encoding." (http://www.mail-archive.com/pygtk@daa.com.au/msg01963.html) I'm having troubles when adding unicode strings to a CTree: File "c:\python20\gtk.py", line 1348, in insert_node is_leaf, expanded) TypeError: sequence item not a string Is this one of the pygtk functions where unicode is not handled ? Best wishes for 2001! Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] How do I figure out how big a string is going to beusing a font?
On Thu, 4 Jan 2001, Edward Muller wrote: > How do I figure out how big a string is going to be using a font? Use the GdkFont.extents(string) method. Check the GdkFont class in description.py (should be in /usr/doc/pygtk-xxx) for more info. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Win32 problem with input_add (Re: [pygtk] g_source_add equivalent)
On Thu, 23 Nov 2000, Alexandre Fayolle wrote: > On Tue, 21 Nov 2000, James Henstridge wrote: > > > Use the input_add function. It should do what you want. > > OK, it works perfectly under linux. However, I'm having troubles when I > test the code under WinNT. I get the following assertion failure printouts > on the console, and of course, the socket does not respond afterwards. > > GLib-WARNING **: 220 isn't a (emulated) file descriptor > > GLib-CRITICAL **: file giochannel.c: line 115 (g_io_add_watch_full): > assertion ` > channel != NULL' failed > > GLib-CRITICAL **: file giochannel.c: line 60 (g_io_channel_unref): > assertion `ch > annel != NULL' failed According to Tor Lillqvist, the author of the gtk win32 port, the problem is that sockets are not handled in the current version of the win32 port of gdk_input_add(). I'm working with him to fix this, and I'll keep the list informed. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] g_source_add equivalent
On Tue, 21 Nov 2000, James Henstridge wrote: > Use the input_add function. It should do what you want. OK, it works perfectly under linux. However, I'm having troubles when I test the code under WinNT. I get the following assertion failure printouts on the console, and of course, the socket does not respond afterwards. GLib-WARNING **: 220 isn't a (emulated) file descriptor GLib-CRITICAL **: file giochannel.c: line 115 (g_io_add_watch_full): assertion ` channel != NULL' failed GLib-CRITICAL **: file giochannel.c: line 60 (g_io_channel_unref): assertion `ch annel != NULL' failed The code is the following: def setup_local_soap_server(self,port,handler_class): import socket self.soap_port = port self.handler_class = handler_class self.soap_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) self.soap_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR,1) self.soap_socket.bind(('',port)) self.soap_socket.listen(5) from gtk import input_add import GDK input_add(self.soap_socket,GDK.INPUT_READ, self.handle_incoming_soap_request) Maybe ther's a problem in the pygtk win32 port, or in the gtk win32 port itself. Any help on where to look for the bug would be precious. Thanks Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] g_source_add equivalent
On Tue, 21 Nov 2000, James Henstridge wrote: > Use the input_add function. It should do what you want. Yes, it looks great. Do you have any information about the arguments that are passed to the callback function? Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] g_source_add equivalent
Hello, I need to monitor a server socket from within a pygtk application. glib has a g_source_add() function that would suit my needs. Is there some way to access this function from pygtk? If not, what would you suggest as an alternative. Monitoring the socket in another thread can't be done because this won't work on win32 for some obscure reason. I could also add a timeout and poll from the socket, but I'd rather not if I can avoid it. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] python 2.0 support
On Thu, 16 Nov 2000, D-Man wrote: > > For what system? Redhat 6.2 and windows. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] python 2.0 support
Is there a release of Pygtk compiled for Python 2.0 available somewhere? Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] [ANNOUNCE] xmltools
I'm releasing the xmltools package. Python XmlTools is a set of high level tools to help using XML in python. Right now it features two pyGTK widgets: XmlTree and XmlEditor, which can respectively display and edit an XML document in a graphical user interface. Both widget are used in the Narval project. The home page is http://www.logilab.org/xmltools/ Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] have anybody tried to adapt pygtk to work on Win32?
On Sat, 4 Nov 2000, Vlad Harchev wrote: > Hi, > > Have anybody tried to hack pygtk to work on Win32? Any successful attempts? > May be somebody is currently working on it? > There's a Win32 port available form http://hans.breuer.org/port. It works fine except for some very weird things with threads, and the lack of GdkImLib support. You need several DLLs from win32 GTK (there's a pointer to the page of the GTK+ win32 port on the Hans Breuer's page, but if you are lazy or have a slow connection, you may want to use the tarball I made for Narval, which is available at ftp://ftp.logilab.org/pub/win32/Win32Gtk-shared-libs.tgz (it features only the required DLLs, without the header files stuff) : just unpack it to your system32 directory (or actually anywhere in your PATH), and here it goes. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] TypeError exception without traceback
On Fri, 3 Nov 2000, Aaron Optimizer Digulla wrote: > James, can you have a look, please ? I have one of these in the > program I'm currently working on and it's impossible to find :-( > (no, it's not in timeout_add()). I encountered a similar problem sometimes ago, and was able to trace it back using the sys.settrace function. I do not have kept the trace function I used back then, since I reused the file to match other degugging chores in the meantime. The one I have right now in my directory looks like : def trace(frame,event,arg): if event == 'call' and frame.f_lineno == 49 and frame.f_code.co_name == '__i nit__' : i = 0 f = frame while f and i<20: i = i+1 co = f.f_code print co.co_filename,co.co_name,co.co_firstlineno f = f.f_back return trace sys.settrace(trace) Maybe you can adapt the test at the beginning to suit your need. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] Threading problem using pygtk on Win32
Hello, I'm using happily pygtk to develop Horn the user interface for Narval (http://www.logilab.org). It runs very well under Linux, but I'm having big troubles getting something under Windows. It looks like there's something wrong with the thread support in pygtk win32 edition. I checked Hans Breuer patch over pygtk 0.6.4 and it does look like there's a known issue with threading in the patch, from the comments I saw. If we cut down to the skeletton of the app, the implementation is something equivallent to: --8<--- from gtk import mainloop, timeout_add import time import thread,Queue queue = Queue.Queue(10) def ping_thread(): while 1: t = time.time() print 'ping',t queue.put_nowait(t) time.sleep(0.7) def pong(): try: while 1: t0 = queue.get_nowait() t1 = time.time() print 'pong',t1, t1-t0 except: return 1 thread.start_new_thread(ping_thread,()) timeout_add(1000,pong) mainloop() -8< This works fine under linux, but under windows (winnt4.0, runnning on a P133), I get pongs comming with a 9 seconds lag. So my question is: * is it just because my NT box is waay to slow ? * has it something to do with lines 31-32 of the patch which state: +#if defined (_MSC_VER) +#undef WITH_THREAD /* no thread support on win32 yet */ In that case what would be required to implement the thread support on win32 ? I'm not yet very familiar with the innards of the python bindings of gtk nor with the win32 port of GTK+, but I'm ready to get my shirt wet, since I really need this feature. Any help/suggestion welcome. Alexandre Fayolle -- http://www.logilab.com Narval is the first software agent available as free software (GPL). LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] subclasses and attributes
Hi, I have a class derived from GtkDialog, and set up a callback on a button using connect_object and passing the derived dialog as an argument. The problem is that when the dialog is passed to to callback function, it has been cast into a GtkWindow object and I cannot access the controld I defined as member variables in my class: Traceback (innermost last): File "/usr/lib/python1.5/site-packages/gtk.py", line 125, in __call__ ret = apply(self.func, a) File "Narval/narval/Horn.py", line 358, in narval_home_changed path = selector.selectionEntry.get_text() File "/usr/lib/python1.5/site-packages/gtk.py", line 908, in __getattr__ return GtkWindow.__getattr__(self, attr) File "/usr/lib/python1.5/site-packages/gtk.py", line 75, in __getattr__ raise AttributeError, attr AttributeError: selectionEntry I suppose I'm not the first one to encounter the problem. Are there any workarounds ? -- Alexandre Fayolle http://www.logilab.com LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Moving CPU hog into another thread
On Mon, 23 Oct 2000, Aaron Optimizer Digulla wrote: > I'm looking for an example how to create a stable, multi-threaded > PyGTK application which has a thread that runs some time-consuming > process which can update its current status in a status window > while the user can still use the rest of the app. You may want to check the Narval Project and the Horn gui (I know, this is shameless advertising, but he asked for it ;o) > My problem is mainly how to get the data from one thread to another > (ie. at a certain time, my time-consuming process has data to display. > How do I put that data in the GUI ??). We use a Queue object for communication between the threads. The main (non-gui) application is Narval, and when it knows a gui (Horn) is connected, it sends messages in a Queue. The queue is read every 500ms using a gtk timeout, and depending on what's found in the queue, the gui is updated. -- Alexandre Fayolle http://www.logilab.com LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] GtkCTreeNode bug in 0.6.6
Hi, I'm experiencing incoherent behaviour in pygtk 0.6.6 with GtkCTreeNode objects. Depending on where they come from, they do not behave in the same fashion. Specifically, it is not possible to access the attributes described in description.py from the GtkCTreeNode obtained by tree.selection (where tree is a GtkCTree): File "Narval/narval/gui/XmlEditor.py", line 125, in add_attribute_activated if self.tree.selection.children: AttributeError: children -- Alexandre Fayolle http://www.logilab.com - "Mais où est donc Ornicar ?" - LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Questions about accelerators.
On Fri, 29 Sep 2000, Dave Belfer-Shevett wrote: > This is -OUTSTANDING- information. I have just one teeny weeny question, > which will cement me as a Newbie. :) We where all newbies once. > On Fri, 29 Sep 2000, Alexandre Fayolle wrote: > > struct GdkEventKey > > { > > GdkEventType type; > > GdkWindow *window; > > gint8 send_event; > > guint32 time; > > guint state; > > guint keyval; > > gint length; > > gchar *string; > > }; > > > Etc. I understand that it's an GdkEventKey struct. There's a lot of > structures returned from GTK. I understand there are methods associated > with Objects that come back (ala a 'set_text' associated with a GtkEntry > field, etc). > > But how do I retrieve values from the structure? ala, 'gint' is within > the structure. How do I get that value, with an explicit > get_gint() method associated with the object? Ahem. In the above snippet of doc, 'gint' is a type, not a member. ;o) The python mappings are very easy to use: the keyevent parameter you get is a python object with attributes that match the names of the C structure members. If you want to react on a ^C, for example, you can do something like: import GDK def keyevent_handler(widget,keyevent): if keyevent.keyval=GDK.C and keyevent.state=GDK.CONTROL_MASK: # do something here pass Does this answer your question? -- Alexandre Fayolle http://www.logilab.com - "Mais où est donc Ornicar ?" - LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] Questions about accelerators.
On Fri, 29 Sep 2000, Dave Belfer-Shevett wrote: > > ta = widgets.get_widget('sp_sendtext') > ta.signal_connect('key_press_event',sendkey) > > Which triggers > > def sendkey(): > print "Key pressed! " > return FALSE > > But I get: > > [shevett@cheetah]:~/python/spanker/proj1$ ./spanker.py > Traceback (innermost last): > File "/usr/local/lib/python1.5/site-packages/gtk.py", line 125, in > __call__ > ret = apply(self.func, a) > TypeError: no arguments expected > > Wha'd i do wrong? your handler takes no argument, and gtk tries to call it with arguments, hence the error. You could do def sendkeys(*args): if you don't care about which key was pressed, or def senkeys(widget,keyevent): if you want to get some info. The key event has the following fields (from the gtk documentation project): struct GdkEventKey { GdkEventType type; GdkWindow *window; gint8 send_event; guint32 time; guint state; guint keyval; gint length; gchar *string; }; GdkEventType type the type of the event (GDK_KEY_PRESS or GDK_KEY_RELEASE). GdkWindow *window the window which received the event. gint8 send_event TRUE if the event was sent explicitly (e.g. using XSendEvent). guint32 time the time of the event in milliseconds. guint state a bit-mask representing the state of the modifier keys (e.g. Control, Shift and Alt) and the pointer buttons. See GdkModifierType. guint keyval the key that was pressed or released. See the header file for a complete list of GDK key codes. gint length the length of string. gchar *string a null-terminated multi-byte string containing the composed characters resulting from the key press. When text is being input, in a GtkEntry for example, it is these characters which should be added to the input buffer. When using Input Methods to support internationalized text input, the composed characters appear here after the pre-editing has been completed. -- Alexandre Fayolle http://www.logilab.com - "Mais où est donc Ornicar ?" - LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] GtkCTree Doesn't Work
On Mon, 18 Sep 2000, Eric Gillespie, Jr. wrote: > With Gnome-Python 1.0.53 from Debian unstable, i can't seem to > attach any data to a row in a CTree. I don't know of any other > way to find what the user selected. Even if i were to catch the > selection signal, i would still have the same problem of mapping > the node to useful data. Am i missing something obvious? You are using the wrong method: to attach data to a row in a GtkCTree, you need to call ctree.node_set_row_data(node, "hey") ^ By the way, you will have something much better if you insert your nodes using a list of labels, as in: node = ctree.insert_node(None, None, ['hey']) (a GtkCTree can have multiple columns, and you need to provide a list of strings to insert a new item. By default, there is only one column, and it is the tree column, so a one element list is fine) Cheers Alexandre, who might have been asking the same question just one month ago... -- Alexandre Fayolle http://www.logilab.com - "Mais où est donc Ornicar ?" - LOGILAB, Paris (France). ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] CTree silly question
How can I get the parent of a node in a CTree ? I want to insert a node as a sibling of the node that's been clicked, but tree.insert_node cannot take a None parameter for the parent and a non-None parameter for the sibling (I get Gtk-CRITICAL **: file gtkctree.c: line 3644 (gtk_ctree_insert_node): assertion `GTK_CTREE_ROW (sibling)->parent == parent' failed.). Using Gtk, I would be able to use the GTK_TREE_ROW to get the row from the node, and then look at the parent field of the row. Is there somethoing similar in pygtk somewhere ? (even if it's an ugly workaround, I'm interested...) -- Alexandre Fayolle Logilab ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] GtkBox.pack_start() problem
Hi, I have a problem with the pack_start and pack_end methods of GtkH/VBox: it seems to me that both of them they are always packing the widget at the 'end' of my box. Is it a known problem of pygtk or gtk ? I'm using pygtk-0.6.6 with gtk+-1.2.6 on a redhat 6.2 machine. Here is a demo session : >>> from gtk import * >>> import GTK >>> w=GtkWindow(GTK.WINDOW_DIALOG,'test') >>> box=GtkVBox() >>> w.add(box) >>> box.pack_start(GtkLabel('label 1')) >>> box.pack_start(GtkLabel('label 2')) >>> box.pack_end(GtkLabel('label 3')) >>> w.show_all() >>> while events_pending():mainiteration() ... >>> w.show_all() >>> while events_pending():mainiteration() ... And I get 3 labels, 'label 1', 'label 2' and 'label 3' in that order (instead of the expected 'label 2', 'label 1', 'label 3') Any help appreciated (as you might have guessed, I'm trying to pack a widget at the beginning of my VBox...) -- Alexandre Fayolle Logilab ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] expanded tree item
En réponse à George Young <[EMAIL PROTECTED]>: > I'm also developing an application with gtktree. Ctree sounds > promising...BUT: is there any documentation on ctree? All I found was a > page > in the tutorial mentioning that ctree didn't have any... I'm using the doc available from the Gtk documentation project, which says interesting things about CTrees (http://www.gtk.org page/rdp, esp. http://developer.gnome.org/doc/API/gtk/gtkctree.html). If you read french, there is a very good book called 'Programmation Linux avec GTK+', by David Odin (ed. Eyrolles, ISBN 2-212-09115-X). It covers most features of GTK+ 1.2, with the notable exception of drag and drop. Alexandre Fayolle http://alexandre.fayolle.free.fr ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] expanded tree item
James Henstridge a écrit : > > This is a GtkCTree you are speaking about, aren't you ? I'm using a plain > > GtkTree. > > Then I would recommend switching to a GtkCTree. Out of the two tree > widgets available in gtk+-1.2, the ctree is much less broken (GtkTree > occasionally has weird problems that are difficult to track down, and > sometimes almost impossible to fix). OK, I'll switch, then. Is it the same thing with GtkList vs GtkCList ? By the way, do you now if things like editable lists/trees (like in Java Swing) are planned for inclusion in gtk 2.0 ? (in other words, is it better for me to wait, or shall I start working on such things now if I know I'll need them in some near future?) Alexandre Fayolle ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
Re: [pygtk] expanded tree item
En réponse à Aaron Optimizer Digulla <[EMAIL PROTECTED]>: > Quoting Alexandre Fayolle <[EMAIL PROTECTED]>: > > > How can I know if a GtkTreeItem is expanded ? > > Use ctree.get_node_info(node)[7]. It's != when the node is > expanded. This is a GtkCTree you are speaking about, aren't you ? I'm using a plain GtkTree. Alexandre Fayolle http://alexandre.fayolle.free.fr ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk
[pygtk] expanded tree item
Hello, How can I know if a GtkTreeItem is expanded ? Thanks Alexandre Fayolle ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk