1 """Code for the B{0desktop} command."""
3 # Copyright (C) 2009, Thomas Leonard
4 # See the README file for details, or visit http://0install.net.
6 from zeroinstall
import _
8 from optparse
import OptionParser
11 def main(command_args
):
12 """Implements the logic of the 0desktop command.
13 @param command_args: the command-line arguments"""
14 parser
= OptionParser(usage
=_("usage: %prog [options] [URI]"))
15 parser
.add_option("-m", "--manage", help=_("manage added applications"), action
='store_true')
16 parser
.add_option("-v", "--verbose", help=_("more verbose output"), action
='count')
17 parser
.add_option("-V", "--version", help=_("display version information"), action
='store_true')
19 (options
, args
) = parser
.parse_args(command_args
)
22 logger
= logging
.getLogger()
23 if options
.verbose
== 1:
24 logger
.setLevel(logging
.INFO
)
26 logger
.setLevel(logging
.DEBUG
)
27 hdlr
= logging
.StreamHandler()
28 fmt
= logging
.Formatter("%(levelname)s:%(message)s")
29 hdlr
.setFormatter(fmt
)
30 logger
.addHandler(hdlr
)
34 print "0desktop (zero-install) " + zeroinstall
.version
35 print "Copyright (C) 2009 Thomas Leonard"
36 print _("This program comes with ABSOLUTELY NO WARRANTY,"
37 "\nto the extent permitted by law."
38 "\nYou may redistribute copies of this program"
39 "\nunder the terms of the GNU Lesser General Public License."
40 "\nFor more information about these matters, see the file named COPYING.")
46 interface_uri
= args
[0]
51 import pygtk
; pygtk
.require('2.0')
55 from zeroinstall
.gtkui
.applistbox
import AppListBox
, AppList
56 from zeroinstall
.injector
.iface_cache
import iface_cache
57 box
= AppListBox(iface_cache
, AppList())
59 from zeroinstall
.gtkui
.addbox
import AddBox
60 box
= AddBox(interface_uri
)
62 box
.window
.connect('destroy', gtk
.main_quit
)