more events pending....
| From: | firepages.com.au | Date: | Thu, 23 May 2002 18:45:41 +0000 |
| Subject: | more events pending.... | ||
| References: | 1 2 3 4 5 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-2038@lists.php.net to get a copy of this message | ||
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