Much improved tooltips; each column has its own text:
[zeroinstall.git] / 0launch-gui
blob4925b8b12f62c223e4ea0a8b9f2d6e881ba4e093
1 #!/usr/bin/env python
2 import os, sys
3 from optparse import OptionParser
4 import gui
6 __builtins__._ = lambda x: x
8 parser = OptionParser(usage="usage: %prog [options] interface [args]")
9 parser.add_option("-d", "--download-only", help="fetch but don't run", action='store_true')
10 parser.add_option("-n", "--no-self-update", help="don't check for updates to the GUI itself", action='store_true')
11 parser.add_option("-r", "--refresh", help="check for updates of all interfaces", action='store_true')
12 parser.add_option("-v", "--version", help="display version information", action='store_true')
14 parser.disable_interspersed_args()
16 (options, args) = parser.parse_args()
18 if options.version:
19 print "0launch-gui (zero-install) " + gui.version
20 print "Copyright (C) 2005 Thomas Leonard"
21 print "This program comes with ABSOLUTELY NO WARRANTY,"
22 print "to the extent permitted by law."
23 print "You may redistribute copies of this program"
24 print "under the terms of the GNU General Public License."
25 print "For more information about these matters, see the file named COPYING."
26 sys.exit(0)
28 if len(args) < 1:
29 parser.print_help()
30 sys.exit(1)
32 interface_uri = args[0]
33 prog_args = args[1:]
35 from zeroinstall.injector import model, autopolicy, namespaces
36 import gtk
38 if not hasattr(gtk, 'combo_box_new_text'):
39 import combo_compat
41 gtk.rc_parse_string('style "scrolled" { '
42 'GtkScrolledWindow::scrollbar-spacing = 0}\n'
43 'class "GtkScrolledWindow" style : gtk "scrolled"\n')
45 if options.no_self_update is not True:
46 gui_policy = autopolicy.AutoPolicy(namespaces.injector_gui_uri)
47 if gui_policy.need_download():
48 # Need to refresh the GUI itself first!
49 prog_args = ['--no-self-update'] + sys.argv[1:]
50 interface_uri = namespaces.injector_gui_uri
51 download_only = False
53 policy = gui.GUIPolicy(interface_uri, prog_args,
54 download_only = bool(options.download_only),
55 refresh = bool(options.refresh))
56 policy.main()