Announcemnet: PyGTK PackageKit

November 11, 2008 - 2 minute read -
Free/Libre and Open Source Software Ubuntu PackageKit

Recently I added support for asynchronous operations to the Python client of PackageKit. And on top of this a set of PyGTK widgets which make using PackageKit quite comfortable. The code is part of today’s 0.3.10 release.

The following widgets help to visualise the status and progress of a transaction:

  • PackageKitStatusIcon
  • PackageKitStatusAnimation
  • PackageKitStatusLabel
  • PackageKitProgressBar
  • PackageKitCancelButton - allows to cancel a running transaction
  • PackageKitProgressDialog - provides an all-in-one solution of the above widgets
  • PackageKitMessageDialog - presents messages and errors from PackageKit

You can see a video of the demo application in action:

As a prove of concept I replaced the call of Synaptic in gnome-app-install by PackageKit. Here is the corresponding screencast:

The following code snippet installs the package xterm with a graphical progress dialog:

from packagekit.client
import PackageKitClient
from packagekit.gtkwidgets
import PackageKitProgressDialog
from packagekit.enums import *

def on_exit(trans, exit, runtime):
    '''Handle exit state of a transaction e.g. erros or EULAs'''

# Initialize the client
pk = PackageKitClient()
# Get packages which provide xterm
packages = pk.Resolve(FILTER_NONE, "xterm")
# Setup the transaction to install the first package
trans = pk.InstallPackages([packages[0].id],
# Initialize the dialog window
dia = PackageKitProgressDialog()
# Connect the transaction to the dialog and run it

The API is not yet set into stone. So I am open for comments and feedback!