1 # Copyright (C) 2006, Thomas Leonard
2 # See http://0install.net/0compile.html
4 # This is normally called by 0launch's GUI.
8 from zeroinstall
import SafeException
10 from support
import BuildEnv
, _
13 "gui [--no-prompt] [SOURCE-URI]"
14 if args
and args
[0] == '--no-prompt':
16 # This option no longer has any effect, since it is the default.
17 # However, old versions of 0launch's GUI pass it (< 0.52)
27 def get_dir_callback(default_dir
):
28 compile_dir
= gui_support
.choose_dir(_('Create build directory'), default_dir
)
31 raise SafeException("Cancelled at user's request")
32 setup
.do_setup(args
, get_dir_callback
)
34 raise SafeException("usage: 0compile gui URI")
37 box
= gui_support
.CompileBox(buildenv
.interface
)
38 box
.connect('destroy', lambda b
: gtk
.main_quit())
42 except KeyboardInterrupt:
44 except SafeException
, ex
:
45 gui_support
.alert(None, '%s' % ex
)
50 gui_support
.alert(None, '%s: %s' % (ex
.__class
__, ex
))
53 __main__
.commands
.append(do_gui
)