Re: PEAR Installer GUI project
| From: | Stig S. Bakken | Date: | Sun, 26 May 2002 07:58:56 +0000 |
| Subject: | Re: PEAR Installer GUI project | ||
| References: | 1 2 3 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-6421@lists.php.net to get a copy of this message | ||
On Sat, 2002-05-25 at 03:11, Alan Knowles wrote:
> Ok, updated docs.akbkhome.com/pear to reflect current CVS and the
> installer..
>
> Stig, it would be nice if you add a bit more phpdoc comments on
> PEAR_Command_* and PEAR_Registry (and similar) so that the input/return
> values are clearer - I'll survive without, bit a few notes would help :)
I will do that.
> Ok, the gtk installer would have a few small issues, that would involve
> breaking a few methods up..
>
> From the simplest aspect.The 'Confirm' process..
>
> in the CLI. you print 'are you sure', and just wait for the user to type
> 'Yes' etc. on stdin.
>
> in GTK. you display a window, tell the window what to do (what method to
> call) when the user and presses ok or cancel. - eg. you dont normally
>
> if ($this->ui->confirm('some message')) {
> do stuff..
>
> you would do something a bit like this..
>
> $this->ui->confirm_ok('some
> message',array(&$this,'install_confirmed'));
> // this is usually easier to deal with.
> or
> $this->ui->confirm_ok('some message',array(&$this,'install')) =
> and it
> would call the same method with a 'confirmed flag'
Ok, so I'll just assign each user interaction with some ID, and the Gtk
frontend can register the replies in advance?
> from the registry command code.doList();
>
> array('caption' => 'Installed packages:',
> 'border' => true));
> foreach ($installed as $package) {
> if ($i++ % 20 == 0) {
> $this->ui
> <http://docs.akbkhome.com/pear/classes/PEAR_Command_Registry.html#$ui>->tableRow(
> array('Package', 'Version', 'State'),
> array('bold' => true));
> }
> $this->ui
> <http://docs.akbkhome.com/pear/classes/PEAR_Command_Registry.html#$ui>->tableRow(array($package['package'],
> $package['version'],
> @$package['release_state']));
> }
>
>
>
> dealing with tables like this is a bit wierd... In gtk, doList should
> probably just return array( $installed,$list), or maybe just ignore this
> class and access the registry class directly.
> . - it would have been nice to see $package->version,
> $package->release_state, rather than $package[] so the package data
> structure could have been documented easily as a class... (bit late now
> I guess :)
Yeah, this still has to be cleaned up and generalized a bit. But now
that a Gtk expert finally rears his head, we'll fix that. ;-)
> The GTK version would probably start up,
> Ask the PEAR_Registry Class for a list of available classes (as array
> of objects?)
> use this list to build a Collumned Tree with flags for new/installed
> ..... etc.
> this could be expandable to show classes/methods/vars contained with
> in each package.......(phase II)
>
> when you select a package - you get to see dependancies.... author,
> version status etc. in detail/ options to install/remove
> when you select a class - you get to see some documentation/
> overview....(phase II)
>
> A PEAR config tab - where do want to install etc.....
Yup. There should be plenty of information you can get from PEAR_Config
for implementing a config tab. You're able to determine if a parameter
should be accompagnied by a file selector, a dropdown/select box or a
simple checkbox.
> it may be advantagous to add progress information - eg. if you are
> installing a package that auto downloads dependancies
>
> $this->ui->progress_dialog('Transfering 1/2',1)
> $this->ui->progress_dialog('Transfering 2/2',2)
> $this->ui->progress_dialog_close();
A status indication callback is already in place in the downloading
function (PEAR_Common::downloadHttp).
> The other issue that make life difficult is that code like this in
> PEAR_Remote will totally freeze the user interface if the application
> (you have to either use while(gtk::event_pending())
> gtk::main_interation();
> or use gtk_input_add($fp,array(&$this,'got_data'));
>
>
> }
> while (trim(fgets($fp, 2048)) != ''); // skip rest of headers
> while ($chunk = fread($fp, 10240)) {
> $response .= $chunk;
> }
>
> and again break the method up - so that it call
> this->ui->fetch_data($fp,array(&$this,'tranfer_completed'));
>
> thats all for this morning..
Right. More Frontend class fodder then.
- Stig