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)})
def done(self): self.watched_streams -= 1 if self.watched_streams == 0: status = self.child.wait() self.child = None if status == 0: self.success(self.stdout) else: if status == 1 and not self.error: return False # Cancelled dialog.alert(None, _("Command failed with exit code %(status)d:\n%(error)s\n") % {'status': status, 'error': self.error})
def report_exception(self, ex, tb=None): if not isinstance(ex, SafeException): if tb is None: warning(ex, exc_info=True) else: warning(ex, exc_info=(type(ex), ex, tb)) if isinstance(ex, AssertionError): # Assertions often don't say that they're errors (and are frequently # blank). ex = repr(ex) if self.systray_icon: if hasattr(self.systray_icon, "set_blinking"): self.systray_icon.set_blinking(True) self.systray_icon.set_tooltip(str(ex) + "\n" + _("(click for details)")) else: dialog.alert(self.window, str(ex) or repr(ex))
def resp(box, r): if r == gtk.RESPONSE_OK: text = '' for title, buffer in self.frames: start = buffer.get_start_iter() end = buffer.get_end_iter() text += '%s\n\n%s\n\n' % (title, buffer.get_text(start, end, include_hidden_chars = False).strip()) try: message = self.report_bug(iface, text) except Exception as ex: dialog.alert(None, _("Error sending bug report: {ex}".format(ex = ex)), type = gtk.MESSAGE_ERROR) else: dialog.alert(None, _("Success: {msg}").format(msg = message), type = gtk.MESSAGE_INFO) self.destroy() else: self.destroy()