예제 #1
0
		def uri_dropped(iface):
			if not gtkutils.sanity_check_iface(self.window, iface):
				return False
			uri.set_text(iface)
			self.window.response(_RESPONSE_NEXT)
			print("ok")
			return True
예제 #2
0
 def uri_dropped(iface):
     if not gtkutils.sanity_check_iface(self.window, iface):
         return False
     uri.set_text(iface)
     self.window.response(_RESPONSE_NEXT)
     print("ok")
     return True
예제 #3
0
 def uri_dropped(iface):
     if not gtkutils.sanity_check_iface(self.window, iface):
         return False
     from zeroinstall.gtkui.addbox import AddBox
     box = AddBox(iface)
     box.window.connect('destroy', lambda dialog: self.populate_model())
     box.window.show()
     return True
예제 #4
0
		def uri_dropped(iface):
			if not gtkutils.sanity_check_iface(self.window, iface):
				return False
			from zeroinstall.gtkui.addbox import AddBox
			box = AddBox(iface)
			box.window.connect('destroy', lambda dialog: self.populate_model())
			box.window.show()
			return True
예제 #5
0
        def response(box, resp):
            if resp == _RESPONSE_NEXT:
                iface = uri.get_text()
                if not gtkutils.sanity_check_iface(self.window, iface):
                    return
                self.window.set_sensitive(False)
                self.set_keep_above(False)
                import subprocess
                child = subprocess.Popen(
                    ['0launch', '--gui', '--download-only', '--', iface],
                    stdout=subprocess.PIPE,
                    stderr=subprocess.STDOUT)
                errors = [b'']

                def output_ready(src, cond):
                    got = os.read(src.fileno(), 100)
                    if got:
                        errors[0] += got
                    else:
                        status = child.wait()
                        self.window.set_sensitive(True)
                        self.set_keep_above(True)
                        if status == 0:
                            update_details_page()
                            nb.next_page()
                            dialog_next.set_property('visible', False)
                            dialog_ok.set_property('visible', True)
                            dialog_ok.grab_focus()
                        else:
                            box = gtk.MessageDialog(
                                self.window, gtk.DIALOG_MODAL,
                                gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
                                _('Failed to run 0launch.\n') +
                                errors[0].decode('utf-8'))
                            box.run()
                            box.destroy()
                        return False
                    return True

                glib.io_add_watch(child.stdout, glib.IO_IN | glib.IO_HUP,
                                  output_ready)
            elif resp == gtk.RESPONSE_OK:
                finish()
            elif resp == _RESPONSE_PREV:
                dialog_next.set_property('visible', True)
                dialog_ok.set_property('visible', False)
                dialog_next.grab_focus()
                nb.prev_page()
                self.window.set_response_sensitive(_RESPONSE_PREV, False)
            else:
                box.destroy()
예제 #6
0
		def response(box, resp):
			if resp == _RESPONSE_NEXT:
				iface = uri.get_text()
				if not gtkutils.sanity_check_iface(self.window, iface):
					return
				self.window.set_sensitive(False)
				self.set_keep_above(False)
				import subprocess
				child = subprocess.Popen(['0launch',
						  '--gui', '--download-only',
						  '--', iface],
						  stdout = subprocess.PIPE,
						  stderr = subprocess.STDOUT)
				errors = [b'']
				def output_ready(src, cond):
					got = os.read(src.fileno(), 100)
					if got:
						errors[0] += got
					else:
						status = child.wait()
						self.window.set_sensitive(True)
						self.set_keep_above(True)
						if status == 0:
							update_details_page()
							nb.next_page()
							dialog_next.set_property('visible', False)
							dialog_ok.set_property('visible', True)
							dialog_ok.grab_focus()
						else:
							box = gtk.MessageDialog(self.window, gtk.DIALOG_MODAL, gtk.MESSAGE_ERROR, gtk.BUTTONS_OK,
								_('Failed to run 0launch.\n') + errors[0].decode('utf-8'))
							box.run()
							box.destroy()
						return False
					return True
				glib.io_add_watch(child.stdout,
							   glib.IO_IN | glib.IO_HUP,
							   output_ready)
			elif resp == gtk.RESPONSE_OK:
				finish()
			elif resp == _RESPONSE_PREV:
				dialog_next.set_property('visible', True)
				dialog_ok.set_property('visible', False)
				dialog_next.grab_focus()
				nb.prev_page()
				self.window.set_response_sensitive(_RESPONSE_PREV, False)
			else:
				box.destroy()