Re: more events pending....
| From: | Rich Payne | Date: | Thu, 23 May 2002 18:45:44 +0000 |
| Subject: | Re: more events pending.... | ||
| References: | 1 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2039@lists.php.net to get a copy of this message | ||
I don't know about adding a timeout that calls the same function it was
started from. Don't know if that's allowed. Wouldn't it be easier just to
call start_ticker from a Gtk::timeout_add out side of the function and
just return true ?
--rdp
On Fri, 24 May 2002, firepages.com.au wrote:
> Hi yet again !
>
> imagine a script which downloads a file via FTP... , I am ftp_fget()'ting
> the file so I can check the progress of the download simply by checking the
> filesize of the file downloaded so far, this all works I can 'see' the file
> growing, I can check the filesize, but not in a loop?
>
> I want to be able to report (via status bar or whatever) the progress of the
> download so I hoped that the loop in start_ticker() & get_bytes() (which
> worked fine as a clock) would allow me to update something or other, however
> whilst the start_ticker() runs once and reports the initial filesize then
> nothing else happens until the download completes , I have tried
> event_pending in all sorts of weird and wonderful places, with so far little
> joy, any pointers greatly appreciated.
>
> function
> _bytes(){
> $this=@filesize('c:/gtkdev/gtkdev.zip');
> echo $this."bytes \n";
> }
> function start_ticker(){
> get_bytes();
> Gtk::timeout_add(1000, 'start_ticker');
> }
>
> / /there is a window and stuff here//
>
> /* this fires up the ftp class & returns the filesize of the file I want to download*/
> $f=new ftp('www.firepages.org', '', '');
> $thissize = $f->size('public_html/public/gtkdev.zip');
>
> /*hopefully start the loop that echos the current download -
> I have tried this before and after the events_pending*/
> start_ticker();
>
> while (gtk::events_pending())
> gtk::main_iteration();
>
> /*start downloading the file*/
> $f->fget('public_html/public/gtkdev.zip', 'c:/gtkdev/gtkdev.zip');
> /*when we have the file destroy the ftp object & connection*/
> $f->nuke();
>
> gtk::main();
>
>
>
> Regards,
> Simon Wheeler.
> firepages
>
>
>
>
>
--
Rich Payne
http://talisman.mv.com