Skip to content

Commit

Permalink
Download selections in the parent process to allow interaction in the…
Browse files Browse the repository at this point in the history
… GUI
  • Loading branch information
talex5 committed Dec 30, 2011
1 parent b8b9d36 commit e2d2256
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
2 changes: 1 addition & 1 deletion 0compile.xml
Expand Up @@ -41,7 +41,7 @@ For a full tutorial, see 0compile's homepage.</description>
<environment insert="0publish" mode="replace" name="0COMPILE_0PUBLISH"/> <environment insert="0publish" mode="replace" name="0COMPILE_0PUBLISH"/>
</requires> </requires>
<requires interface="http://0install.net/2007/interfaces/ZeroInstall.xml"> <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"/> <environment insert="" mode="replace" name="0COMPILE_ZEROINSTALL"/>
</requires> </requires>
</group> </group>
Expand Down
31 changes: 31 additions & 0 deletions autocompile.py
Expand Up @@ -117,6 +117,12 @@ def valid_autocompile_feed(binary_feed):
buildenv = BuildEnv(need_config = False) buildenv = BuildEnv(need_config = False)
buildenv.config.set('compile', 'interface', policy.root) buildenv.config.set('compile', 'interface', policy.root)
buildenv.config.set('compile', 'selections', 'selections.xml') 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 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])) local_feed = os.path.join(local_feed_dir, '%s-%s-%s.xml' % (buildenv.iface_name, version, arch._uname[-1]))
Expand Down Expand Up @@ -262,6 +268,31 @@ def downloads_changed(self):
def confirm_import_feed(self, pending, valid_sigs): def confirm_import_feed(self, pending, valid_sigs):
return handler.Handler.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): class GTKAutoCompiler(AutoCompiler):
def __init__(self, config, iface_uri, options): def __init__(self, config, iface_uri, options):
config.handler.compiler = self config.handler.compiler = self
Expand Down

0 comments on commit e2d2256

Please sign in to comment.