
``apt.progress.gtk2`` --- GTK widgets
*************************************

GObject-powered progress classes and a GTK+ status widget.


GObject progress classes
========================

class apt.progress.gtk2.GDpkgInstallProgress(term)

   An InstallProgress for local installations.

   Signals:

      * status-changed(str: status, int: percent)

      * status-started()  - Not Implemented yet

      * status-finished()

      * status-timeout() - When the maintainer script hangs

      * status-error() - When an error happens

      * status-conffile() - On Conffile

   run(debfile)

      Install the given package.

   updateInterface()

      Called periodically to update the interface.

      Emits: status-timeout() [When a timeout happens]

class apt.progress.gtk2.GFetchProgress

   A Fetch Progress with GObject signals.

   Signals:

      * status-changed(str: description, int: percent)

      * status-started()

      * status-finished()

class apt.progress.gtk2.GInstallProgress(term)

   Installation progress with GObject signals.

   Signals:

      * status-changed(str: status, int: percent)

      * status-started()

      * status-finished()

      * status-timeout()

      * status-error()

      * status-conffile()

   childExited(term, pid, status)

      Called when a child process exits

   conffile(current, new)

      Called during conffile.

      Emits: status-conffile()

   error(pkg, errormsg)

      Called when an error happens.

      Emits: status-error()

   finishUpdate()

      Called when the update finished.

      Emits: status-finished()

   fork()

      Fork the process.

   startUpdate()

      Called when the update starts.

      Emits: status-started()

   statusChange(pkg, percent, status)

      Called when the status changed.

      Emits: status-changed(status, percent)

   updateInterface()

      Called periodically to update the interface.

      Emits: status-timeout() [When a timeout happens]

   waitChild()

      Wait for the child process to exit.

class apt.progress.gtk2.GOpProgress

   Operation progress with GObject signals.

   Signals:

      * status-changed(str: operation, int: percent)

      * status-started()  - Not Implemented yet

      * status-finished()

   done()

      Called when all operation have finished.

   update(percent)

      Called to update the percentage done


GTK+ Class
==========

class apt.progress.gtk2.GtkAptProgress

   Graphical progress for installation/fetch/operations.

   This widget provides a progress bar, a terminal and a status bar
   for showing the progress of package manipulation tasks.

   cancel_download()

      Cancel a currently running download.

   clear()

      Reset all status information.

   dpkg_install

      Return the install progress handler for dpkg.

   fetch

      Return the fetch progress handler.

   hide_terminal()

      Hide the expander with the terminal widget.

   install

      Return the install progress handler.

   open

      Return the cache opening progress handler.

   show()

      Show the Box

   show_terminal(expanded=False)

      Show the expander for the terminal.

      Show an expander with a terminal widget which provides a way to
      interact with dpkg


Example
=======

   #!/usr/bin/python
   """Example for gtk widgets"""
   import pygtk
   pygtk.require("2.0")
   import gtk

   import apt.progress.gtk2


   def main():
       """Main function."""
       win = gtk.Window()
       win.connect("destroy", gtk.main_quit)
       progress = apt.progress.gtk2.GtkAptProgress()
       win.set_title("GtkAptProgress Demo")
       win.add(progress)
       progress.show()
       win.show()
       cache = apt.cache.Cache(progress.open)
       if cache["xterm"].isInstalled:
           cache["xterm"].markDelete()
       else:
           cache["xterm"].markInstall()
       progress.show_terminal(expanded=True)
       cache.commit(progress.fetch, progress.install)
       gtk.main()

   if __name__ == "__main__":
       main()
