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 __future__
import print_function
8 from zeroinstall
import _
, logger
10 from optparse
import OptionParser
13 def main(command_args
):
14 """Implements the logic of the 0desktop command.
15 @param command_args: the command-line arguments"""
16 parser
= OptionParser(usage
=_("usage: %prog [options] [URI]"))
17 parser
.add_option("-m", "--manage", help=_("manage added applications"), action
='store_true')
18 parser
.add_option("-v", "--verbose", help=_("more verbose output"), action
='count')
19 parser
.add_option("-V", "--version", help=_("display version information"), action
='store_true')
21 (options
, args
) = parser
.parse_args(command_args
)
24 if options
.verbose
== 1:
25 logger
.setLevel(logging
.INFO
)
27 logger
.setLevel(logging
.DEBUG
)
28 hdlr
= logging
.StreamHandler()
29 fmt
= logging
.Formatter("%(levelname)s:%(message)s")
30 hdlr
.setFormatter(fmt
)
31 logger
.addHandler(hdlr
)
35 print("0desktop (zero-install) " + zeroinstall
.version
)
36 print("Copyright (C) 2009 Thomas Leonard")
37 print(_("This program comes with ABSOLUTELY NO WARRANTY,"
38 "\nto the extent permitted by law."
39 "\nYou may redistribute copies of this program"
40 "\nunder the terms of the GNU Lesser General Public License."
41 "\nFor more information about these matters, see the file named COPYING."))
47 interface_uri
= args
[0]
52 import pygtk
; pygtk
.require('2.0')
56 from zeroinstall
.gtkui
.applistbox
import AppListBox
, AppList
57 from zeroinstall
.injector
.iface_cache
import iface_cache
58 box
= AppListBox(iface_cache
, AppList())
60 from zeroinstall
.gtkui
.addbox
import AddBox
61 box
= AddBox(interface_uri
)
63 box
.window
.connect('destroy', gtk
.main_quit
)