On Mon, Aug 11, 2003 at 12:48:29AM +0200, Olivier Blin wrote: > > I'm writing because of two problems. At first, I wanted to make a > > MessageDialog with a progress bar, while opening a process using > > popen2. My gtk.main() in this case stops executing program, so I can't > > move further. I think there *must* be something like gtk.main(), but > > letting go through whole program. Or mayber I'm wrong? > > Hi > > I've started a wrapper of Glib's spawning utilities. > See > http://developer.gnome.org/doc/API/2.0/glib/glib-Spawning-Processes.html > > I've wrapped 2 functions so far : > > gboolean g_spawn_command_line_async (const gchar *command_line, > GError **error); > This one let you start a program from your pygtk code, it is roughly the > same as fork() followed by exec(). > (very easy to wrap ...) > > gboolean g_spawn_command_line_sync (const gchar *command_line, > gchar **standard_output, > gchar **standard_error, > gint *exit_status, > GError **error); > > This one is more interesting for you, it is basically the same as > popen() (no standard input though) > (quite simple to wrap)
Is this code a candidate for inclusion in pygtk? Note that AFAICS this won't solve entirely the problem here: I suspect the intention is to spawn a process and, while it runs, update the progressbar. Unless you do some really smart measurement, you will have to use a hack (such as using a fixed time.sleep() between progressbar updates) to give the impression that you are "following" the output of the code. Or maybe.. Ah. I see your point. He can run g_spawn_command_line_sync() and then do a loop read()ing in a certain number of bytes and updating the progressbar as you go. Nice. Will that work for the OP, I wonder, though ;) > I can provide my code if anyone is interested, it may even be included > in pygtk FAQ, because popen() doesn't work as expected with > gnome-python. Yeah, feel free to add an item explaining this and the workaround. Take care, -- Christian Reis, Senior Engineer, Async Open Source, Brazil. http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL _______________________________________________ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
