Permalink
Browse files

Download selections in the parent process to allow interaction in the…

… GUI
  • Loading branch information...
1 parent b8b9d36 commit e2d225696333286886baf61284d17f0720e70d49 @talex5 talex5 committed Dec 30, 2011
Showing with 32 additions and 1 deletion.
  1. +1 −1 0compile.xml
  2. +31 −0 autocompile.py
View
@@ -41,7 +41,7 @@ For a full tutorial, see 0compile's homepage.</description>
<environment insert="0publish" mode="replace" name="0COMPILE_0PUBLISH"/>
</requires>
<requires interface="http://0install.net/2007/interfaces/ZeroInstall.xml">
- <version not-before="1.2"/>
+ <version not-before="1.5-post"/>
<environment insert="" mode="replace" name="0COMPILE_ZEROINSTALL"/>
</requires>
</group>
View
@@ -117,6 +117,12 @@ def valid_autocompile_feed(binary_feed):
buildenv = BuildEnv(need_config = False)
buildenv.config.set('compile', 'interface', policy.root)
buildenv.config.set('compile', 'selections', 'selections.xml')
+
+ # Download any required packages now, so we can use the GUI to request confirmation, etc
+ download_missing = s.download_missing(self.config, include_packages = True)
+ if download_missing:
+ yield download_missing
+ tasks.check(download_missing)
version = s.selections[policy.root].version
local_feed = os.path.join(local_feed_dir, '%s-%s-%s.xml' % (buildenv.iface_name, version, arch._uname[-1]))
@@ -262,6 +268,31 @@ def downloads_changed(self):
def confirm_import_feed(self, pending, valid_sigs):
return handler.Handler.confirm_import_feed(self, pending, valid_sigs)
+ @tasks.async
+ def confirm_install(self, message):
+ from zeroinstall.injector.download import DownloadAborted
+ from zeroinstall.gtkui import gtkutils
+ import gtk
+ box = gtk.MessageDialog(self.compiler.dialog,
+ gtk.DIALOG_DESTROY_WITH_PARENT,
+ gtk.MESSAGE_QUESTION, gtk.BUTTONS_CANCEL,
+ message)
+ box.set_position(gtk.WIN_POS_CENTER)
+
+ install = gtkutils.MixedButton(_('Install'), gtk.STOCK_OK)
+ install.set_flags(gtk.CAN_DEFAULT)
+ box.add_action_widget(install, gtk.RESPONSE_OK)
+ install.show_all()
+ box.set_default_response(gtk.RESPONSE_OK)
+ box.show()
+
+ response = gtkutils.DialogResponse(box)
+ yield response
+ box.destroy()
+
+ if response.response != gtk.RESPONSE_OK:
+ raise DownloadAborted()
+
class GTKAutoCompiler(AutoCompiler):
def __init__(self, config, iface_uri, options):
config.handler.compiler = self

0 comments on commit e2d2256

Please sign in to comment.