[pygtk] Threads and applets (gnome.applet)
Hi, I've recently encountered some problems with threads in a (python) gnome panel applet. My problem is that any spawned threads don't seem to get scheduled and consequently never run (at least, not until the gtk mainloop exits). A simple example: = #!/usr/bin/python import sys sys.stdout = open('debug', 'w') # redirect stdout/stderr to a file sys.stderr = sys.stdout import gtk gtk.gdk.threads_init() # (!) import gnome.applet import gobject import thread import time class AppletClass(gnome.applet.Applet): def __init__(self, applet, iid): self.__gobject_init__() self.applet = applet self.label = gtk.Label('Hello World') self.applet.add(self.label) thread.start_new_thread(self.thread_function, ()) def thread_function(self): sys.stdout.write('Thread started.\n') sys.stdout.flush() while True: sys.stdout.write('I like threads.\n') sys.stdout.flush() time.sleep(1) gobject.type_register(AppletClass) def class_applet_factory(applet, iid): AppletClass(applet,iid) return gtk.TRUE gnome.applet.bonobo_factory("OAFIID:GNOME_PythonAppletSample_Factory", AppletClass.__gtype__, "hello", "0", class_applet_factory) = I expect this applet (with the appropriate bonobo .server file) to show a "Hello World" label in the panel and write "I love threads." to stdout (which is redirected to a file "debug" in this case). The widget part works fine, but the stdout thread is never run (nothing written to stdout). Points to note: * My applet (of which the above is a highly simplified version) used to work; a recent update of gnome-python seems to have broken it, but I'm not sure exactly when. * For threaded applications, gtk.gdk.threads_init() is supposed to be called before gtk.main, but in the case of an applet, aren't we already inside gtk.main? Can/should the threads_init call be moved elsewhere? * I'm running Debian (unstable), relevant packages: python2.3-gtk2 (2.4.1-2) python2.3-gnome (2.6.1-1) python2.3 (2.3.4-19) libgtk2.0-0 (2.4.14-2) libgnome2-0 (2.8.0-6) Does anybody know what/where the problem might be? Is it most likely a problem with gtk+, gnome, pygtk, pygnome or the Debian packaging? thanks, brad +--+--++ | Brad Tonkes, Research Fellow | | There were too many of us, | | Centre for Autonomous Systems, | _--_|\ | we had access to too much | | School of Computer Science and | / \ | money, too much equipment, | | Engineering| \_.--._* | and little by little, we | | UNSW, 2052 | v | went insane. | | NSW, Australia | || +--+--++ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] pygtk to use new-style classes?
Joey Tsai wrote: From the PyGTK reference, it appears that all pygtk classes derive from gobject.GObject. Since PyGTK depends on Python >= 2.2, are there any plans for the classes to Python new-style classes, so we get the joys of property() and super()? Is this request bug 128765? pygtk uses new style classes so super() and property() may be used. Are you asking if gobject properties can be mapped to Python properties? They can, but doing so would be an api change and would break existing code. There was some discussion of setting things up so that self.props. could be used to get / set gobject properties, but nothing has been implemented AFAIK. John ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] pygtk to use new-style classes?
From the PyGTK reference, it appears that all pygtk classes derive from gobject.GObject. Since PyGTK depends on Python >= 2.2, are there any plans for the classes to Python new-style classes, so we get the joys of property() and super()? Is this request bug 128765? signature.asc Description: Digital signature ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] pygtk 2.5.3 on win32
I am trying to compile pygtk 2.5.3 on win32. I get the following when it tries to link gobject.pyd: c:\mingw\bin\gcc.exe -mno-cygwin -mdll -O -Wall -DPYGTK_MAJOR_VERSION=2 -DPYGTK_ MINOR_VERSION=5 -DPYGTK_MICRO_VERSION=3 -DVERSION=\"2.5.3\" -IC:/GTK/include/gli b-2.0 -IC:/GTK/lib/glib-2.0/include -I. -Igtk -Igobject -Ic:\python24\include -I c:\python24\PC -c gobject/pygtype.c -o build\temp.win32-2.4\Release\gobject\pygt ype.o -mms-bitfields writing build\temp.win32-2.4\Release\gobject\gobject.def c:\mingw\bin\gcc.exe -mno-cygwin -shared -s build\temp.win32-2.4\Release\gobject \gobjectmodule.o build\temp.win32-2.4\Release\gobject\pygboxed.o build\temp.win3 2-2.4\Release\gobject\pygenum.o build\temp.win32-2.4\Release\gobject\pygflags.o build\temp.win32-2.4\Release\gobject\pygobject.o build\temp.win32-2.4\Release\go bject\pygmaincontext.o build\temp.win32-2.4\Release\gobject\pygmainloop.o build\ temp.win32-2.4\Release\gobject\pygparamspec.o build\temp.win32-2.4\Release\gobje ct\pygpointer.o build\temp.win32-2.4\Release\gobject\pygtype.o build\temp.win32- 2.4\Release\gobject\gobject.def -LC:/GTK/lib -Lc:\python24\libs -Lc:\python24\PC Build -lgobject-2.0 -lglib-2.0 -lintl -liconv -lpython24 -lmsvcr71 -o build\lib. win32-2.4\gobject.pyd build\temp.win32-2.4\Release\gobject\gobjectmodule.o(.text+0x39ba):gobjectmodule .c: undefined reference to `g_thread_init' error: command 'gcc' failed with exit status 1 I included the compile line from the last .o file so that you can see what the compile flags are as well. Anyone have any suggestions? -Chris -- Christopher Lambacher [EMAIL PROTECTED] ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] gtksourceview
Op do, 17-02-2005 te 12:13 -0200, schreef Jose de Paula Eufrasio Junior: >Hello there, > >someone has ported/compiled gtksourceview for win32 environment? > >[]s >core A quick Google search seems to tell it should be possible to compile gtksourceview on Windows. And gnome-python-extras shouldn't be much of a problem at all if the underlying packages compile. I have no idea where to find binaries for all this though, you'll have more luck trying to compile them yourself by the looks of it. -- StÃphan Kochen <[EMAIL PROTECTED]> ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] gtksourceview
Hello there, someone has ported/compiled gtksourceview for win32 environment? []s core ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] UIManager: missing control
Hi all, after updating my GTK+ libraries to 2.6 and PyGTK to 2.5 I started getting lots of deprecation warnings (again). The noisy way they're presented helped me deciding that I might as well do a major rewrite of my program to not just fix some minor problems but incorporate some bigger wishes as well. With the ItemFactory falling from grace and UIManager rising, I managed to get a first boilerplate of the UI rather quickly (couldn't have done it without the appwindow.py example in the examples directory of PyGTK, though). Alas, I'm missing a lot of control over the appearance of menus and toolbar buttons: It seems there's no way to switch of the icons in the menus and/or the labels in toolbar buttons. These buttons are easily twice the size of my older app (with the same 24x24 pixmaps!). Once I had room to spare, now they don't fit on 2 toolbar rows. Maybe if I created different action groups, but wouldn't that be against the very reason for their existance? Of course there's always the chance I overlooked something. Hans-J. __ Mit WEB.DE FreePhone mit hoechster Qualitaet ab 0 Ct./Min. weltweit telefonieren! http://freephone.web.de/?mc=021201 ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] ANNOUNCE - Python Comics Viewer - 0.9.9 released
Downloads: http://borco.net/html/PyComicsViewer/PyComicsViewer-0.9.9.tar.gz http://borco.net/html/PyComicsViewer/PyComicsViewer-0.9.9.zip http://borco.net/html/PyComicsViewer/PyComicsViewer-0.9.9.win32-py2.4.exe Homepage: http://borco.net/html/PyComicsViewer/ Changes: * finished the implementation of panning and mouse navigation * added a thumb preview page to the browser -- Ionutz Borcoman http://borco.net/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Cursur iter ?
Op do, 17-02-2005 te 11:07 +0530, schreef Somesh Bartakke: >am using TextView widget in a program. >i want to get Iter at current cursor position, >how to get it ? >i couldnt find the function for that . > >Somesh buf = gtk.TextBuffer() [...] insert = buf.get_mark('insert') iter = buf.get_iter_at_mark(insert) 'insert' is a special mark used to track the cursor position. It is builtin in the GtkTextBuffer. -- StÃphan Kochen <[EMAIL PROTECTED]> ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Cursur iter ?
Somesh Bartakke wrote: am using TextView widget in a program. i want to get Iter at current cursor position, how to get it ? i couldnt find the function for that . I have no idea if this is the best way to do it. But this is what I am doing and it works fine for me. This code is from a project that defines a TextView called file_textview using glade. But the signal handler is attached in the code rather than in glade. def init_text_display(self): self.text_view = self.widgets.get_widget('file_textview') self.text_buffer = self.text_view.get_buffer() self.text_buffer.connect('mark-set', self.on_insertion_moved) def on_insertion_moved(self, text_buffer, iter, text_mark): # see if the cursor has really moved offset = iter.get_offset() if self.last_offset != offset: self.last_offset = offset # processing here Greg ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/