def receive(self, proc, buf, length): l = unicode(QString.fromUtf8(buf, length)).split("\n") self.buf.append(l[0]) if len(l) > 1: self.output("".join(self.buf)) for i in l[1:-1]: self.output(i) self.buf = [l[-1]]
def comarError(self, exception): if "urlopen error" in exception.message or "Socket Error" in exception.message: KMessageBox.error(None, i18n("Network error. Please check your network connections and try again."), i18n("COMAR Error")) elif "Access denied" in exception.message: message = i18n("You are not authorized for this operation.") KMessageBox.sorry(None, message, i18n("Error")) else: KMessageBox.error(None, QString.fromUtf8(str(exception)), i18n("COMAR Error")) self.errHandler()
def exceptionHandler(self, exception=None): exception = exception or self.lastError if "urlopen error" in str(exception) or "Socket Error" in str(exception): KMessageBox.error(None, i18n("Network error. Please check your network connections and try again or check your repository addresses."), i18n("COMAR Error")) elif "Access denied" in str(exception): message = i18n("You are not authorized for this operation.") KMessageBox.sorry(None, message, i18n("Error")) elif "PYCURL ERROR" in str(exception): message = i18n("Please check your network connection or repository addresses.") KMessageBox.sorry(None, message, i18n("Error")) else: KMessageBox.error(None, QString.fromUtf8(str(exception)), i18n("COMAR Error")) self.errHandler()