def handler(self, signal, data): if len(data) > 1: args = data[1:] else: args = None if signal == "finished": command = str(data[0]) self.emit(PYSIGNAL("stepFinished(QString)"), (command,)) elif signal == "started": command = data[0] self.emit(PYSIGNAL("stepStarted(QString)"), (command,)) elif signal == "progress": print "progress" elif signal == "error": print "Error: ", str(data) elif signal == "status": if data[0] == "downloading": self.emit(PYSIGNAL("statusDownloading(int, int)"), (data[1], data[2])) elif data[0] == "installing": self.emit(PYSIGNAL("statusInstalling(QString, int, int)"), (data[1], data[2], data[3])) elif data[0] == "configuring": self.emit(PYSIGNAL("statusConfiguring()"), ()) elif signal == "warning": print "Warning: ", str(data) elif signal == "PolicyKit" and "policy.no" in data: message = i18n("You are not authorized for this operation.") KMessageBox.sorry(None, message, i18n("Error")) else: print "Got notification : %s with data : %s" % (signal, data)
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()
def handler(self, package, signal, data): if len(data) > 1: args = data[1:] else: args = None if signal == "finished": command = data[0] self.iface.com_lock.unlock() self.parent.finished(command) elif signal == "progress": self.parent.displayProgress(data) elif signal == "error": self.iface.com_lock.unlock() print "Error: ", str(data) self.lastError = str(data) self.delayTimer.start(500, True) elif signal == "cancelled": self.parent.finished("System.Manager.cancelled") elif signal == "started": operation = signal self.parent.pisiNotify(operation, args) elif signal == "status": operation = data[0] self.parent.pisiNotify(operation, args) elif signal == "warning": self.iface.com_lock.unlock() # self.parent.showWarningMessage(str(args)) print "Warning: ", str(data) self.parent.resetState() self.parent.refreshState() elif signal == "PolicyKit" and "policy.no" in data: message = i18n("You are not authorized for this operation.") KMessageBox.sorry(None, message, i18n("Error")) else: print "Got notification : %s with data : %s" % (signal, data)
def cancelError(self): message = i18n("You are not authorized for this operation.") self.errHandler() KMessageBox.sorry(None, message, i18n("Error"))
def ask_for_new(parent): if len(comlink.links) == 0: KMessageBox.sorry(parent, i18n("No package with COMAR network scripts are installed yet."), i18n("Install network packages!")) return win = Window(parent) return win
def sorry(message, **a): KMessageBox.sorry(KApplication.kApplication().mainWidget(), message)