[ Index ]
 

Code source de PHP PEAR 1.4.5

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/PEAR/PackageFileManager/GUI/ -> Gtk.php (sommaire)

(pas de description)

Poids: 2099 lignes (80 kb)
Inclus ou requis:0 fois
Référencé: 0 fois
Nécessite: 5 fichiers
 PEAR/Registry.php
 PEAR/PackageFileManager/File.php
 PEAR/PackageFileManager.php
 PEAR/Config.php
 PEAR/Packager.php

Définit 1 class

PEAR_PackageFileManager_GUI_Gtk:: (33 méthodes):
  PEAR_PackageFileManager_GUI_Gtk()
  show()
  getWidget()
  about()
  showWarnings()
  checkBeforeQuit()
  _createApplication()
  _buildMenu()
  _buildNotebook()
  _addNotebookPage()
  _createPackagePage()
  _createReleasePage()
  _createWarningsPage()
  _createAddMaintainersPage()
  _createAddDependenciesPage()
  _createAddReplacementsPage()
  _setPackageDirEntry()
  _setPackageOptions()
  _setReleaseOptions()
  _previewFile()
  _writePackageFile()
  _packagePackage()
  _getDependencies()
  _switchToWidget()
  _addReplacement()
  _addToCList()
  _treeToCList()
  _toggleOptional()
  _addDependencies()
  _addMaintainer()
  _listDevelopers()
  _importPackageOptions()
  _pushWarning()


Classe: PEAR_PackageFileManager_GUI_Gtk  - X-Ref

A Gtk GUI frontend for the PEAR_PackageFileManager class.

A PHP-GTK 1 frontend for the PEAR_PackageFileManager class.
It makes it easier for developers to create and maintain
PEAR package.xml files.

Features:
- Update existing package files or create new ones
- Import values from an existing package file
- Drag-n-Drop package directory into the application for easy
loading (requires PEAR::Gtk_FileDrop)
- Set package level information (package name, description, etc.)
- Set release level information (version, release notes, etc.)
- Easily add maintainers
- Browse package files as a tree and click to add a dependency
- Add install time global and file replacements
- Package file preview window
- Package the package using the new package file

Example:
More detail can be found in
doc/PEAR_PackageFileManager_GUI_Gtk/example.php

<code>
if (!extension_loaded('gtk')) {
dl( 'php_gtk.' . PHP_SHLIB_SUFFIX);
}

require_once 'PEAR/PackageFileManager/GUI/Gtk.php';
$pfmGtk =& new PEAR_PackageFileManager_GUI_Gtk();
$pfmGtk->show();
gtk::main();
</code>

PEAR_PackageFileManager_GUI_Gtk($isMain = true)   X-Ref
Constructor.

Creates the package file manager and then calls the
method to create the rest of the application.

param: boolean $isMain Whether or not this class is the
return: void

show()   X-Ref
Shows all widgets.

Please note: The regular issues associated with show_all()
still apply. show_all() does not always trickle all of the
way down to the very last child widget. For more info please
see the PHP-GTK website {@link http://gtk.php.net}

return: void

getWidget()   X-Ref
Returns the main application window.

This is a standard PEAR-PHP-GTK method. It has
been added for consistency. It would be useful if
the PEAR_Frontend_Gtk class had a "New Package"
feature. The PEAR_Frontend_Gtk code could just
instantiate this class and call getWidget(). It
could then show the window when ever it wanted or
make some changes to the window itself. It could
even pull the child from the window and embed the
rest of this application in itself.

return: &object

about()   X-Ref
Creates and shows an about window.

The about window contains the package name, current
package version number, the list of developers and where
to find the latest information for the package.

It would be nice if this window also told the user what
version of PEAR_PackageFileManager was being used but I
don't know that that information is necessarily part of
this package.

return: void

showWarnings($message = NULL)   X-Ref
Shows the warnings in the text area.

Each warning will be displayed on its own line.

param: string $message Optional message to add to the warnings.
return: void

checkBeforeQuit($killMainLoop)   X-Ref
Checks to see if the file has been saved before destroying the
main window.

The user should save their file before the application closes.
If they have not, they will be prompted to save or close any
way.

This method will also kill the main gtk loop if told to. If
this class is imbedded in another class, you probably don't
want to do that. Pass false to the constructor to prevent
this from happening.

param: boolean $killMainLoop
return: void

_createApplication($isMain)   X-Ref
Creates the main PHP-GTK application.

param: boolean $isMain Whether or not this class is the
return: void

_buildMenu()   X-Ref
Builds the application's menu.

The menu is used for such things as the open and save
dialogs. The menu should also have an about option and
an exit option.

return: object  A container holding the menu.

_buildNotebook()   X-Ref
Builds the main display widget.

To make the user interface more navigable, a GtkNotebook
is used. This lets the user appear to be working through
a wizard when they are actually just changing pages.

return: &object

_addNotebookPage($page, $last = true)   X-Ref
Appends the given container to the notebook.

param: array   $page array(container, label)
param: boolean $last Whether this page should be the last page or not
return: integer

_createPackagePage()   X-Ref
Creates the page for displaying the package file manager
options that relate to the entire package, regardless of
the release.

Package options are those such as: base install directory,
the license, the package name, etc.

return: array

_createReleasePage()   X-Ref
Creates the page for displaying the package file
manager release options fields.

The release options consist of features including, the
release date, the package version and state, and the
release notes.

Options that do not relate to individual releases are
covered on a seperate page.

return: array

_createWarningsPage()   X-Ref
Creates a page for displaying (and clearing) warnings.

The warnings page consists of a text area and a button.
The text area should be set to wrap text but not be
editable. The button should clear the text area of any
warnings.

return: array

_createAddMaintainersPage()   X-Ref
Creates a page for gathering information about developers.

The add maintainer page needs to get the developer's name,
handle, email address and role. The role should be a
GtkCombo which doesn't allow the user to enter anything
that is not a valid role.

return: array

_createAddDependenciesPage()   X-Ref
Add the widgets that make up the dependencies page.

The dependencies page consists of one widget to
display installed packages, one widget to display
packages selected as dependencies, a button to clear
the selected list and a button to add the dependencies.

return: array

_createAddReplacementsPage()   X-Ref
Creates the container and label for the add replacements
page.

Replacements are install time search and replace strings
that can be used to set certain package variables to
values found on the user's system or that are specific
to the version of the installed package.

This package uses a replacement to put the proper version
number in the about window so that I don't have to go and
recode that every time.

return: array   The page container and a label for the tab.

_setPackageDirEntry(&$entry, &$fileSelection)   X-Ref
Updates the package file directory entry with the value
from the file selection.

Takes the value of the file selection and assigns it to
the entry widget. We have to use a helper method because
we need the value in real time. After the value is set,
the file selection is hidden.

param: object &$entry         The GtkEntry that should get the value.
param: object &$fileSelection The GtkFileSelection holding the value.
return: void

_setPackageOptions($dirEntry, $nameEntry, $baseInstall,$summaryEntry, $descriptionText)   X-Ref
Sets that relate to the entire package, regardless of
the release.

Package options are those such as: base install directory,
the license, the package name, etc. We can't set the options
until we have the rest from the release page. Therefore we
must temporarily store them in the _options member.

If all goes well, the user will be taken to the next page.

param: object  $dirEntry    The GtkEntry holding the package directory.
param: object  $nameEntry   The GtkEntry holding the package name.
param: object  $baseInstall The GtkEntry holding the base install directory.
return: void

_setReleaseOptions($state, $verEntry, $notesArea)   X-Ref
Sets the package file anager release options.

The release options consist of features including, the
release date, the package version and state, and the
release notes.

Options that do not relate to individual releases are
adde with {@link _setPackageOptions}.

This method sets all the options including the package
options. If there are errors, the user will be taken to
the warnings page. If there are no errors the user will
be taken to the add maintainers page.

param: object  $state     The GtkCombo holding the state.
param: object  $verEntry  The GtkEntry holding the version.
param: object  $notesArea The GtkText holding the release notes.
return: void

_previewFile()   X-Ref
Calls the package file manager's debug method.

The file should always be previewed before it is saved.

return: void

_writePackageFile()   X-Ref
Writes the package file to package.xml.

The package file should be tested first using the
{@link _previewFile} method. The file is written to the
directory given as the package file directory on the
package page.

If there are problems writing the file, the user will
be taken to the warnings page.

return: void

_packagePackage()   X-Ref
Uses PEAR to package the package.

Does the same thing that calling $ pear package package.xml
would do but doesn't require the user to use the command
line.

return: void

_getDependencies($cList)   X-Ref
Adds the dependencies from the package file to the cList.

This method adds the dependencies currently listed in the
package file to the cList. This will not retrieve any real
time additions.

param: object  $cList The list that should display the packages.
return: void

_switchToWidget($entry, &$toWidgets, $toBox)   X-Ref
Swaps out the current to widget with the needed one.

The to widget gets changed to a widget that will let
the user enter an appropriate value. This can be either
an entry or a combo.

This method can be used for both the global and file
replacements.

param: object  $entry      The GtkEntry whose value was changed.
param: array   &$toWidgets The possible to widgets.
param: object  $toBox      The box that will hold the widget.
return: void

_addReplacement($pathWidget, $typeWidget, $toWidget, $fromWidget, $success)   X-Ref
Adds the replacement information to the package file manager.

Both the global and file replacements use this method. The
difference is that global replacements do not supply a file
path.

param: object  $pathWidget The widget holding the file path.
param: object  $typeWidget The widget holding the replace type.
param: object  $toWidget   The widget holding the to value.
param: object  $fromWidget The widget holding the from value.
param: object  $status     The label that will inform success.
return: void

_addToCList($cList, $data)   X-Ref
Adds the data array to the GtkCList.

First this method checks to see if the data is already
present. (It only checks the first column.) Then it
adds the data.

param: object  $cList The GtkCList to which data will be added.
param: array   $data  The elements to be added to the list.

_treeToCList($tree, $node, $unknown, $list)   X-Ref
Takes data from the GtkCTree and puts it in the GtkCList.

This is used to take the values from the dependency tree
and put them in the dependency list. Values are not added
as dependencies until the add dependencies button is
pressed.

When a row is selected, the tree and node are passed to this
method. When the node is created, some data was stored with
it. That data is the package name and the version. After the
data is extracted, it is passed to the cList.

param: object  $tree    The GtkCTree containing the selected node.
param: object  $node    The GtkCTree that was selected.
param: mixed   $unknown Who knows. Seriously, if you do email me.
param: object  $list    The GtkCList that will hold the data from
return: void

_toggleOptional($cList, $row, $col, $event)   X-Ref
Toggles the optional status of a dependency when it is
selected.

PFM lets you mark a package as an optional dependency.
This means that a given package will be used if it is
available but it is not required for proper operation.
This package is optionally dependent on Gtk_FileDrop
and also PHP_Compat. This package will work without
them but if you have them it will add more features.

param: object  $cList The GtkClist that holds the data.
param: integer $row   The row that was selected (starts at 0)
param: integer $col   The column that was selected (starts at 0)
param: object  $event The 'select-row' event
return: void

_addDependencies($cList)   X-Ref
Adds the selected packages as dependencies.

All packages from the GtkCList are added as dependencies to
the package being built. As of 2005-03-18, only package
dependencies may be added using this tool. Other types (php,
etc.) may be added at a later date.

param: object  $cList The GtkCList holding the packages.
return: void

_addMaintainer($handle, $role, $name, $email, $currentList)   X-Ref
Adds a maintainer to the package file.

Checks that all of the information was given then tries
to add the maintainer. If there is a problem, the user
will be taken to the warnings page.

param: object  $handle The entry that has the developer's handle.
param: object  $role   The combo that has the developer's role.
param: object  $name   The entry that has the developer's name.
param: object  $email  The entry that has the developer's email.
param: object  $currentList The GtkCList that will show the developers.
return: void

_listDevelopers($cList)   X-Ref
Adds the developers from the previous release to the given
GtkCList.

This method is used when the developers page is created. It
puts the developers from the previous release into the cList.
Developers added as of this release are added by
{@link _addMaintainer()}.

param: object  $cList The GtkCList that will have the developer added.
return: void

_importPackageOptions($packageDirEntry, $packageNameEntry,$baseEntry, $summaryEntry, $descriptionText)   X-Ref
Imports the options from a previously created file.

After importing the options, this method also updates the
values of some widgets.

param: object  $packageDirEntry  The GtkEntry holding the package directory.
param: object  $pacakgeNameEntry The GtkEntry holding the package name.
param: object  $baseEntry        The GtkEntry holding the base install directory.
param: object  $summaryEntry     The GtkEntry holding the package summary.
param: object  $descriptiontText The GtkText holding the package description.
return: void

_pushWarning($code, $info)   X-Ref
Adds a warning to the warning stack.

After adding the error to the stack, the user is taken to the
warnings page. When the page is switched, warnings are popped
off of the stack.

param: integer $code
param: array   $info Associative array of message replacement info.
return: void



Généré le : Sun Feb 25 14:08:00 2007 par Balluche grâce à PHPXref 0.7