File: apt-gtk.py

package info (click to toggle)
python-apt 0.7.100.1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 2,748 kB
  • ctags: 1,919
  • sloc: cpp: 8,937; python: 5,750; makefile: 89; sh: 9
file content (29 lines) | stat: -rw-r--r-- 682 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/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"].is_installed:
        cache["xterm"].mark_delete()
    else:
        cache["xterm"].mark_install()
    progress.show_terminal(expanded=True)
    cache.commit(progress.fetch, progress.install)
    gtk.main()

if __name__ == "__main__":
    main()