Beispiel #1
0
	def set(new):
		try:
			blocker = slave.invoke_master(["set-impl-stability", impl_details['from-feed'], impl_details['id'], new])
			yield blocker
			tasks.check(blocker)
			from zeroinstall.gui import main
			main.recalculate()
		except Exception:
			logger.warning("set", exc_info = True)
			raise
Beispiel #2
0
	def ok(feed, config = config, interface = interface, chooser = chooser):
		try:
			blocker = slave.add_local_feed(interface.uri, feed)
			yield blocker
			tasks.check(blocker)

			chooser.destroy()
			from zeroinstall.gui import main
			main.recalculate()
		except Exception as ex:
			dialog.alert(None, _("Error in feed file '%(feed)s':\n\n%(exception)s") % {'feed': feed, 'exception': str(ex)})
Beispiel #3
0
		def remove_feed(button):
			try:
				model, iter = self.tv.get_selection().get_selected()
				feed_uri = model[iter][Feeds.URI]
				blocker = slave.remove_feed(interface.uri, feed_uri)
				yield blocker
				tasks.check(blocker)
				from zeroinstall.gui import main
				main.recalculate()
			except Exception as ex:
				import traceback
				traceback.print_exc()
				config.handler.report_error(ex)
Beispiel #4
0
	def set_stability_policy(self):
		try:
			i = self.stability.get_active()
			if i == 0:
				new_stability = None
			else:
				new_stability = ['stable', 'testing', 'developer'][i-1]
			blocker = slave.invoke_master(["set-stability-policy", self.interface.uri, new_stability])
			yield blocker
			tasks.check(blocker)
			from zeroinstall.gui import main
			main.recalculate()
		except Exception as ex:
			warning("set_stability_policy", exc_info = ex)
Beispiel #5
0
def add_remote_feed(config, parent, interface):
	try:
		d = gtk.MessageDialog(parent, 0, gtk.MESSAGE_QUESTION, gtk.BUTTONS_CANCEL,
			_('Enter the URL of the new source of implementations of this interface:'))
		d.add_button(gtk.STOCK_ADD, gtk.RESPONSE_OK)
		d.set_default_response(gtk.RESPONSE_OK)
		entry = gtk.Entry()

		align = gtk.VBox(False, 0)
		align.set_border_width(4)
		align.add(entry)
		d.vbox.pack_start(align)
		entry.set_activates_default(True)

		entry.set_text('')

		d.vbox.show_all()

		error_label = gtk.Label('')
		error_label.set_padding(4, 4)
		align.pack_start(error_label)

		d.show()

		def error(message):
			if message:
				error_label.set_text(message)
				error_label.show()
			else:
				error_label.hide()

		while True:
			got_response = DialogResponse(d)
			yield got_response
			tasks.check(got_response)
			resp = got_response.response

			error(None)
			if resp == gtk.RESPONSE_OK:
				try:
					url = entry.get_text()
					if not url:
						raise zeroinstall.SafeException(_('Enter a URL'))

					fetch = slave.add_remote_feed(interface.uri, url)
					if fetch:
						d.set_sensitive(False)
						yield fetch
						d.set_sensitive(True)
						tasks.check(fetch)

						d.destroy()
						from zeroinstall.gui import main
						main.recalculate()
				except zeroinstall.SafeException as ex:
					error(str(ex))
			else:
				d.destroy()
				return
	except Exception as ex:
		import traceback
		traceback.print_exc()
		config.handler.report_error(ex)
Beispiel #6
0
	def compile(self, interface, autocompile = True):
		blocker = slave.invoke_master(["gui-compile", interface.uri, autocompile])
		yield blocker
		tasks.check(blocker)
		from zeroinstall.gui import main
		main.recalculate()