3 from optparse
import OptionParser
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("-m", "--main", help="name of the file to execute")
11 parser
.add_option("-n", "--no-self-update", help="don't check for updates to the GUI itself", action
='store_true')
12 parser
.add_option("-r", "--refresh", help="check for updates of all interfaces", action
='store_true')
13 parser
.add_option("-v", "--verbose", help="more verbose output", action
='count')
14 parser
.add_option("-V", "--version", help="display version information", action
='store_true')
16 parser
.disable_interspersed_args()
18 (options
, args
) = parser
.parse_args()
22 logger
= logging
.getLogger()
23 if options
.verbose
== 1:
24 logger
.setLevel(logging
.INFO
)
26 logger
.setLevel(logging
.DEBUG
)
29 print "0launch-gui (zero-install) " + gui
.version
30 print "Copyright (C) 2005 Thomas Leonard"
31 print "This program comes with ABSOLUTELY NO WARRANTY,"
32 print "to the extent permitted by law."
33 print "You may redistribute copies of this program"
34 print "under the terms of the GNU General Public License."
35 print "For more information about these matters, see the file named COPYING."
42 interface_uri
= args
[0]
45 from zeroinstall
.injector
import model
, autopolicy
, namespaces
48 if not hasattr(gtk
, 'combo_box_new_text'):
51 gtk
.rc_parse_string('style "scrolled" { '
52 'GtkScrolledWindow::scrollbar-spacing = 0}\n'
53 'class "GtkScrolledWindow" style : gtk "scrolled"\n')
55 if options
.no_self_update
is not True:
56 gui_policy
= autopolicy
.AutoPolicy(namespaces
.injector_gui_uri
)
57 if gui_policy
.need_download():
58 # Need to refresh the GUI itself first!
59 prog_args
= ['--no-self-update']
61 prog_args
+= ['--main', options
.main
]
63 prog_args
+= sys
.argv
[1:]
65 interface_uri
= namespaces
.injector_gui_uri
66 options
.download_only
= False
68 policy
= gui
.GUIPolicy(interface_uri
, prog_args
,
69 download_only
= bool(options
.download_only
),
70 refresh
= bool(options
.refresh
),