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("-n", "--no-self-update", help="don't check for updates to the GUI itself", action
='store_true')
11 parser
.add_option("-r", "--refresh", help="refresh all used 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()
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."
32 interface_uri
= args
[0]
35 from zeroinstall
.injector
import model
, autopolicy
, namespaces
38 if not hasattr(gtk
, 'combo_box_new_text'):
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:]
51 interface_uri
= namespaces
.injector_gui_uri
54 policy
= gui
.GUIPolicy(interface_uri
, prog_args
,
55 download_only
= bool(options
.download_only
))
57 policy
.refresh_all(force
= False)