[pygtk] Pipes and freezes
Just wondering if this is an email address for Steven Howe who is originally from Sidcup, Kent, UK and may be living in Australia? Thanks Kristin Hillenbrand (Storey) Kristin Hillenbrand Acting Senior Manager, Social Policy Strategic Policy and Supports Workforce Supports Division Employment, Immigration and Industry 12th Floor, Capital Health Centre 10030 - 107th Street Edmonton, AB T5J 3E4 Phone (780) 422-6332 Cell (780) 718-5643 Fax (780) 422-6324 [EMAIL PROTECTED] This communication is intended for the use of the recipient to which it is addressed, and may contain confidential, personal, and or privileged information. Please contact us immediately if you are not the intended recipient of this communication, and do not copy, distribute, or take action relying on it. Any communication received in error, or subsequent reply, should be deleted or destroyed. ___ 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] Pipes and freezes
Steven Howe ha scritto: Yes, checkout gtk.input_add_full. http://www.moeraki.com/pygtktutorial/pygtk2tutorial/ch-TimeoutsIOAndIdleFunctions.html The tutorial needs some updating. It describes only three args, but it takes more. Everyone after the third are passed to the third arg, which should be a function call. example: gtk.input_add_full( self.dsk.progressFile, /* the file to monitor */ gtk.gdk.INPUT_READ,/* flag to input_add_full */ self.dsk.readProgress, /* route to call when there is data in self.dsk.progressFile */ self.updategui ) /* additional parms to pass */ inside dsk.readProgress, (another class) def readProgress( self, fx, mode, updateFunction=None ) Here's were the tutoral is screwy. gtk.input_add_full calls readProgress (arg[2]) and passes it: (arg[0],arg[1], arg[3], ) So given: gtk.input_add_full( arg0,arg1,arg2,arg3,...argN) when there is data gtk.input_add_full will call arg2 like: arg2(arg0,arg1,arg3...argN) arg2, your routine should read and process the data stream. It must return TRUE if you want gtk.input_add_full, to continue to watch for new data. When you are done close your file stream and return FALSE, My function, readProgress, reads the data, updates class variables, calls updategui, and returns TRUE (until the end of file is reached). updategui looks like: def updategui( self ): while gtk.events_pending() : gtk.mainiteration() return This function is optional. If your readProgress routine is long, you'll want to do it. on the gui side of the program, I set timeouts to read the class dsk variables, and update a progress bar. Hope that's enough sample code to guide you. Steven Howe <[EMAIL PROTECTED]> On Mon, 2004-04-26 at 23:58, Dario Mèndez wrote: Greetings everyone, I've just began PyGTK developing today and I started to get my GTKmm kernel compilation utility "ported" to PyGTK. In order to display the make ouput I used a particular Glib method (spawn_async_with_pipes). I've tryed looking around, but I didn't find any equivalent, so I hooked up the old popen(), wich, of course, freezes the window during the make process. Does anybody know a way to display the popen output while the process is running? Thanks in advance ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ OK, never mind, I've got it working, thanks, I didn't read it completely so I missed the explanation of how gtk.input_add_full() works. Thanks again -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=&d=28-4 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Pipes and freezes
Steven Howe ha scritto: Yes, checkout gtk.input_add_full. http://www.moeraki.com/pygtktutorial/pygtk2tutorial/ch-TimeoutsIOAndIdleFunctions.html The tutorial needs some updating. It describes only three args, but it takes more. Everyone after the third are passed to the third arg, which should be a function call. example: gtk.input_add_full( self.dsk.progressFile, /* the file to monitor */ gtk.gdk.INPUT_READ,/* flag to input_add_full */ self.dsk.readProgress, /* route to call when there is data in self.dsk.progressFile */ self.updategui ) /* additional parms to pass */ inside dsk.readProgress, (another class) def readProgress( self, fx, mode, updateFunction=None ) Here's were the tutoral is screwy. gtk.input_add_full calls readProgress (arg[2]) and passes it: (arg[0],arg[1], arg[3], ) So given: gtk.input_add_full( arg0,arg1,arg2,arg3,...argN) when there is data gtk.input_add_full will call arg2 like: arg2(arg0,arg1,arg3...argN) arg2, your routine should read and process the data stream. It must return TRUE if you want gtk.input_add_full, to continue to watch for new data. When you are done close your file stream and return FALSE, My function, readProgress, reads the data, updates class variables, calls updategui, and returns TRUE (until the end of file is reached). updategui looks like: def updategui( self ): while gtk.events_pending() : gtk.mainiteration() return This function is optional. If your readProgress routine is long, you'll want to do it. on the gui side of the program, I set timeouts to read the class dsk variables, and update a progress bar. Hope that's enough sample code to guide you. Steven Howe <[EMAIL PROTECTED]> On Mon, 2004-04-26 at 23:58, Dario Mèndez wrote: Greetings everyone, I've just began PyGTK developing today and I started to get my GTKmm kernel compilation utility "ported" to PyGTK. In order to display the make ouput I used a particular Glib method (spawn_async_with_pipes). I've tryed looking around, but I didn't find any equivalent, so I hooked up the old popen(), wich, of course, freezes the window during the make process. Does anybody know a way to display the popen output while the process is running? Thanks in advance ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ There's something I can't understand, do I have to assign self.dsk.progressFile = popen(...) before doing the gtk.input_add_full() thing? Thanks -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=&d=28-4 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Pipes and freezes
John Finlay ha scritto: Steven Howe wrote: Yes, checkout gtk.input_add_full. http://www.moeraki.com/pygtktutorial/pygtk2tutorial/ch-TimeoutsIOAndIdleFunctions.html The tutorial needs some updating. It describes only three args, but it takes more. Everyone after the third are passed to the third arg, which should be a function call. Steve's right the tutorial needs updating. However, I think, that you should use the gobject.io_add_watch() function instead of gtk.input_add_full() in new code since the latter is just a binding to the former. I believe input_add_full() is deprecated in PyGTK 2.4 John ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ OK, Thanks. I'll try this out -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=&d=28-4 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Pipes and freezes
- Original Message Da: Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> To: Dario Mèndez <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] Oggetto: Re: [pygtk] Pipes and freezes Data: 28/04/04 01:14 > > A Ter, 2004-04-27 às 07:58, Dario Mèndez escreveu: > > Greetings everyone, I've just began PyGTK developing today and I started > > to get my GTKmm kernel compilation utility "ported" to PyGTK. > > > > In order to display the make ouput I used a particular Glib method > > (spawn_async_with_pipes). > > > > I've tryed looking around, but I didn't find any equivalent, so I hooked > > up the old popen(), wich, of course, freezes the window during the make > > process. > > > > Does anybody know a way to display the popen output while the process is > > running? > > Just like in C, in Python use gobject.input_add to know when to read > from child stdout. Seems very simple. Or do you have a more specific > problem? > > > Thanks in advance > > ___ > > pygtk mailing list [EMAIL PROTECTED] > > http://www.daa.com.au/mailman/listinfo/pygtk > > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ > -- > Gustavo J. A. M. Carneiro > <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> > > Uhm... I'm actually using this to read the make ouput def compile_kernel(self, widget): textbuffer = gtk.TextBuffer() fin = os.popen("uname -r") ker_ver = fin.readline() fin.close() self.compile_status.set_buffer(textbuffer) fin = os.popen("cd /usr/src/linux && make && make modules_install && cp arch/i386/boot/bzImage /boot/bzImage-" + ker_ver) line = None while line != '': line = fin.readline() textbuffer.insert_at_cursor(line) fin.close() return I've never knew anything about gobjects, have you got some kind of reference (possibly an example)? Thanks -- Email.it, the professional e-mail, gratis per te: http://www.email.it/f Sponsor: Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=&d=20040428 ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Pipes and freezes
Steven Howe wrote: Yes, checkout gtk.input_add_full. http://www.moeraki.com/pygtktutorial/pygtk2tutorial/ch-TimeoutsIOAndIdleFunctions.html The tutorial needs some updating. It describes only three args, but it takes more. Everyone after the third are passed to the third arg, which should be a function call. Steve's right the tutorial needs updating. However, I think, that you should use the gobject.io_add_watch() function instead of gtk.input_add_full() in new code since the latter is just a binding to the former. I believe input_add_full() is deprecated in PyGTK 2.4 John ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Pipes and freezes
Yes, checkout gtk.input_add_full. http://www.moeraki.com/pygtktutorial/pygtk2tutorial/ch-TimeoutsIOAndIdleFunctions.html The tutorial needs some updating. It describes only three args, but it takes more. Everyone after the third are passed to the third arg, which should be a function call. example: gtk.input_add_full( self.dsk.progressFile, /* the file to monitor */ gtk.gdk.INPUT_READ,/* flag to input_add_full */ self.dsk.readProgress, /* route to call when there is data in self.dsk.progressFile */ self.updategui ) /* additional parms to pass */ inside dsk.readProgress, (another class) def readProgress( self, fx, mode, updateFunction=None ) Here's were the tutoral is screwy. gtk.input_add_full calls readProgress (arg[2]) and passes it: (arg[0],arg[1], arg[3], ) So given: gtk.input_add_full( arg0,arg1,arg2,arg3,...argN) when there is data gtk.input_add_full will call arg2 like: arg2(arg0,arg1,arg3...argN) arg2, your routine should read and process the data stream. It must return TRUE if you want gtk.input_add_full, to continue to watch for new data. When you are done close your file stream and return FALSE, My function, readProgress, reads the data, updates class variables, calls updategui, and returns TRUE (until the end of file is reached). updategui looks like: def updategui( self ): while gtk.events_pending() : gtk.mainiteration() return This function is optional. If your readProgress routine is long, you'll want to do it. on the gui side of the program, I set timeouts to read the class dsk variables, and update a progress bar. Hope that's enough sample code to guide you. Steven Howe <[EMAIL PROTECTED]> On Mon, 2004-04-26 at 23:58, Dario Mèndez wrote: > Greetings everyone, I've just began PyGTK developing today and I started > to get my GTKmm kernel compilation utility "ported" to PyGTK. > > In order to display the make ouput I used a particular Glib method > (spawn_async_with_pipes). > > I've tryed looking around, but I didn't find any equivalent, so I hooked > up the old popen(), wich, of course, freezes the window during the make > process. > > Does anybody know a way to display the popen output while the process is > running? > Thanks in advance > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Steven Howe <[EMAIL PROTECTED]> ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
Re: [pygtk] Pipes and freezes
A Ter, 2004-04-27 às 07:58, Dario Mèndez escreveu: > Greetings everyone, I've just began PyGTK developing today and I started > to get my GTKmm kernel compilation utility "ported" to PyGTK. > > In order to display the make ouput I used a particular Glib method > (spawn_async_with_pipes). > > I've tryed looking around, but I didn't find any equivalent, so I hooked > up the old popen(), wich, of course, freezes the window during the make > process. > > Does anybody know a way to display the popen output while the process is > running? Just like in C, in Python use gobject.input_add to know when to read from child stdout. Seems very simple. Or do you have a more specific problem? > Thanks in advance > ___ > pygtk mailing list [EMAIL PROTECTED] > http://www.daa.com.au/mailman/listinfo/pygtk > Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/ -- Gustavo J. A. M. Carneiro <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
[pygtk] Pipes and freezes
Greetings everyone, I've just began PyGTK developing today and I started to get my GTKmm kernel compilation utility "ported" to PyGTK. In order to display the make ouput I used a particular Glib method (spawn_async_with_pipes). I've tryed looking around, but I didn't find any equivalent, so I hooked up the old popen(), wich, of course, freezes the window during the make process. Does anybody know a way to display the popen output while the process is running? Thanks in advance ___ pygtk mailing list [EMAIL PROTECTED] http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/