cvs: pear /PEAR_Frontend_Gtk Gtk.php /PEAR_Frontend_Gtk/Gtk Install.php

From: Date: Sun, 02 Jun 2002 03:15:11 +0000
Subject: cvs: pear /PEAR_Frontend_Gtk Gtk.php /PEAR_Frontend_Gtk/Gtk Install.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-4347@lists.php.net to get a copy of this message
alan_k Sat Jun 1 23:15:11 2002 EDT Modified files: /pear/PEAR_Frontend_Gtk Gtk.php /pear/PEAR_Frontend_Gtk/Gtk Install.php Log: Move Install methods into Install, added more phpdoc Index: pear/PEAR_Frontend_Gtk/Gtk.php diff -u pear/PEAR_Frontend_Gtk/Gtk.php:1.9 pear/PEAR_Frontend_Gtk/Gtk.php:1.10 --- pear/PEAR_Frontend_Gtk/Gtk.php:1.9 Sat Jun 1 23:01:56 2002 +++ pear/PEAR_Frontend_Gtk/Gtk.php Sat Jun 1 23:15:10 2002 @@ -16,7 +16,7 @@ | Author: Alan Knowles <alan@akbkhome.com> | +----------------------------------------------------------------------+ - $Id: Gtk.php,v 1.9 2002/06/02 03:01:56 alan_k Exp $ + $Id: Gtk.php,v 1.10 2002/06/02 03:15:10 alan_k Exp $ */ require_once "PEAR.php"; @@ -383,63 +383,14 @@ $this->_widget_pages->set_page(2); } /*-------------------------------------Downloading --------------------------------*/ - /** - * size of current file being downloaded - * @var int - * @access private - */ - var $_activeDownloadSize =0; - /** - * Total number of files that are being downloaded - * @var int - * @access private - */ - - var $_downloadTotal=1; - /** - * How many files have been downloaded in this 'session' - * @var int - * @access private - */ - var $_downloadPos=0; - - /* + /* * PEAR_Command Callback - used by downloader * @param string message type * @param string message data */ function _downloadCallback($msg, $params) { - - switch ($msg) { - case 'setup': - return; - case 'saveas': - $this->_widget_downloading_filename->set_text("Downloading {$params}"); - $this->_widget_downloading_total_progressbar->set_percentage($this->_downloadPos/$this->_downloadTotal); - $this->_downloadPos++; - $this->_widget_downloading_total->set_text("Total {$this->_downloadPos}/{$this->_downloadTotal}"); - while(gtk::events_pending()) gtk::main_iteration(); - - return; - case 'start': - $this->_activeDownloadSize = $params; - $this->_widget_downloading_file_progressbar->set_percentage(0); - while(gtk::events_pending()) gtk::main_iteration(); - return; - case 'bytesread': - $this->_widget_downloading_file_progressbar->set_percentage($params / $this->_activeDownloadSize); - while(gtk::events_pending()) gtk::main_iteration(); - return; - case 'done': - - $this->_widget_downloading_total_progressbar->set_percentage($this->_downloadPos/$this->_downloadTotal); - - default: - if (is_object($params)) $params="OBJECT"; - echo "MSG: $msg ". serialize($params) . "\n"; - } - + $this->_install->_downloadCallback($msg, $params); } Index: pear/PEAR_Frontend_Gtk/Gtk/Install.php diff -u pear/PEAR_Frontend_Gtk/Gtk/Install.php:1.3 pear/PEAR_Frontend_Gtk/Gtk/Install.php:1.4 --- pear/PEAR_Frontend_Gtk/Gtk/Install.php:1.3 Sat Jun 1 23:01:56 2002 +++ pear/PEAR_Frontend_Gtk/Gtk/Install.php Sat Jun 1 23:15:11 2002 @@ -17,7 +17,7 @@ | Author: Alan Knowles <alan@akbkhome.com> | +----------------------------------------------------------------------+ - $Id: Install.php,v 1.3 2002/06/02 03:01:56 alan_k Exp $ + $Id: Install.php,v 1.4 2002/06/02 03:15:11 alan_k Exp $ */ /** @@ -31,9 +31,18 @@ class PEAR_Frontend_Gtk_Install { - + /** + * The Main User interface object + * @var object PEAR_Frontend_Gtk + */ var $ui; // main interface + /* + * Gtk Installer Constructor + * + * #TODO: most of this can be moved to the glade file!? + * @param object PEAR_Frontend_Gtk + */ function PEAR_Frontend_Gtk_Install(&$ui) { // connect buttons? @@ -43,7 +52,11 @@ $this->ui->_widget_download_list->set_column_auto_resize(2,TRUE); $this->ui->_widget_done_button->connect('pressed',array(&$this,'_callbackDone')); } - + /* + * Start the download process (recievs a list of package 'associative arrays' + * #TODO : recieve list of package objects to install/remove! + * + */ function start($list) { $this->ui->_widget_pages->set_page(1); @@ -72,12 +85,77 @@ } + /* + * GUI Callback - user presses the 'done button' + */ function _callbackDone() { $this->ui->_package_list->loadList(); $this->ui->_widget_pages->set_page(0); } - + /** + * size of current file being downloaded + * @var int + * @access private + */ + var $_activeDownloadSize =0; + /** + * Total number of files that are being downloaded + * @var int + * @access private + */ + + var $_downloadTotal=1; + /** + * How many files have been downloaded in this 'session' + * @var int + * @access private + */ + var $_downloadPos=0; + /* + * PEAR_Command Callback (relayed) - used by downloader + * @param string message type + * @param string message data + */ + + function _downloadCallback($msg, $params) { + + switch ($msg) { + case 'setup': + return; + + case 'saveas': + $this->ui->_widget_downloading_filename->set_text("Downloading {$params}"); + $this->ui->_widget_downloading_total_progressbar->set_percentage( + (float) ($this->_downloadPos/$this->_downloadTotal)); + $this->_downloadPos++; + $this->ui->_widget_downloading_total->set_text("Total {$this->_downloadPos}/{$this->_downloadTotal}"); + while(gtk::events_pending()) gtk::main_iteration(); + return; + + case 'start': + $this->_activeDownloadSize = $params; + $this->ui->_widget_downloading_file_progressbar->set_percentage(0); + while(gtk::events_pending()) gtk::main_iteration(); + return; + + case 'bytesread': + $this->ui->_widget_downloading_file_progressbar->set_percentage( + (float) ($params / $this->_activeDownloadSize)); + while(gtk::events_pending()) gtk::main_iteration(); + return; + + case 'done': + $this->ui->_widget_downloading_total_progressbar->set_percentage( + (float) ($this->_downloadPos/$this->_downloadTotal)); + + default: // debug - what calls this? + if (is_object($params)) $params="OBJECT"; + echo "MSG: $msg ". serialize($params) . "\n"; + } + } + + }

« previous php.pear.cvs (#4347) next »