gtk.events_pending() freezes when I think it is TRUE



I am working on a python app that  (currently) is using a dialog box
that retrieves output from a forked application.  Most of the display is
fine until there is rapid text deletion and insertion emulating a
terminal screen output where the subprocess is sending a carriage return
without a linefeed, or rapid char insertion/backspace (ascii spinner
using '/-\|' characters)  From what I have googled the following routine
is needed (dprint statements are to direct debug prints to a terminal
screen).   All seems to be ok until the gtk.events_pending() call I
think should be returning TRUE.  But it never returns and all processes
in the app are showing 0% cpu time.  This particular crash is only
because the screen did not keep up to text additions and the window
display  needed to scroll down and was getting a little behind.

        def view_update():
            gtk.threads_enter()
            dprint('pending check')
            p = gtk.events_pending()
            dprint('events_pending? '+str(p))
            while p:
                dprint('an event')
                x = gtk.main_iteration()
                dprint('did main_iteration')
            gtk.threads_leave()
            dprint('pending done')

sample of debug print statements from test:
# escape sequences are only printed here for now and are not being used 
        at the moment


HOME = /home/brian
Process window realizing
begining run of os.read() loop
pending check
events_pending? 0
pending done
escape_seq=[31;01m
pending check
events_pending? 0
pending done
escape_seq=[0m
escape_seq=[31;01m
pending check
events_pending? 0
[snip]

[/snip]
pending check
events_pending? 0
pending done
pending check
events_pending? 0
pending done
pending check
         
------
end of snipit.  Actually that is the point where it froze about 3 hrs
ago, as I haven't killed it yet.

I have right after this crash, switched over to the idle python
interpreter shell and did a quick test:

import gtk
gtk.events_pending()
1


which returned true without freezing.

This problem has persisted thru 2 python versions and a recent gnome
update, although pygtk remains the same.

Anyone have any similatr problems or solutions?  Is this a pygtk bug? Or
am I just doing something wrong?

Any and all help greatly appreciated.

some info:
*  dev-python/pygtk
      Latest version available: 2.0.0
      Latest version installed: 2.0.0
      Size of downloaded files: 514 kB
      Homepage:    http://www.daa.com.au/~james/pygtk/
      Description: GTK+2 bindings for Python
      License:     LGPL-2.1
 
*  dev-lang/python
      Latest version available: 2.3.3
      Latest version installed: 2.3.3
      Size of downloaded files: 7,026 kB
      Homepage:    http://www.python.org
      Description: A really great language
      License:     PSF-2.2

And from our main gtk interface we are having this problem in:
 
gnome-base/gnome
Meta package for the GNOME desktop.
http://www.gnome.org/

Installed versions:
        Slot 2.0: 2.4.2
Available versions:
        Slot 1.4: 1.4-r3
        Slot 2.0: 2.0.2-r1, 2.2-r2, 2.2.1, 2.2.2-r1, 2.4, 2.4.1, (2.4.1_p1),
2.4.2

-- 
Brian <dol-sen telus net>




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]