Beispiel #1
0
 def __init__(self):
     QObject.__init__(self)
     self.offlinemanager = OfflineManager()
     self.offlinemanager.setActionHandler(self.handler)
     self.offlinemanager.setExceptionHandler(self.exceptionHandler)
     self.connect(self.offlinemanager, SIGNAL("operationChanged(QString)"),
                  SIGNAL("operationChanged(QString)"))
     self.connect(self.offlinemanager, SIGNAL("totalProgress(int)"),
                  SIGNAL("totalProgress(int)"))
     self.connect(self.offlinemanager, SIGNAL("currentProgress(int)"),
                  SIGNAL("currentProgress(int)"))
     self.connect(self.offlinemanager, SIGNAL("finished()"),
                  SIGNAL("finished()"))
 def __init__(self):
     QObject.__init__(self)
     self.offlinemanager = OfflineManager()
     self.offlinemanager.setActionHandler(self.handler)
     self.offlinemanager.setExceptionHandler(self.exceptionHandler)
     self.connect(self.offlinemanager, SIGNAL("operationChanged(QString)"), SIGNAL("operationChanged(QString)"))
     self.connect(self.offlinemanager, SIGNAL("totalProgress(int)"), SIGNAL("totalProgress(int)"))
     self.connect(self.offlinemanager, SIGNAL("currentProgress(int)"), SIGNAL("currentProgress(int)"))
     self.connect(self.offlinemanager, SIGNAL("finished()"), SIGNAL("finished()"))
Beispiel #3
0
class Operation(QObject):
    def __init__(self):
        QObject.__init__(self)
        self.offlinemanager = OfflineManager()
        self.offlinemanager.setActionHandler(self.handler)
        self.offlinemanager.setExceptionHandler(self.exceptionHandler)
        self.connect(self.offlinemanager, SIGNAL("operationChanged(QString)"),
                     SIGNAL("operationChanged(QString)"))
        self.connect(self.offlinemanager, SIGNAL("totalProgress(int)"),
                     SIGNAL("totalProgress(int)"))
        self.connect(self.offlinemanager, SIGNAL("currentProgress(int)"),
                     SIGNAL("currentProgress(int)"))
        self.connect(self.offlinemanager, SIGNAL("finished()"),
                     SIGNAL("finished()"))

    def handler(self, package, signal, args):
        if signal == "cancelled":
            KApplication.kApplication().quit()

    def startProcesses(self, archive):
        self.offlinemanager.startProcesses(archive)

    def exceptionHandler(self, message):
        message = str(message)

        if "urlopen error" in message or "Socket Error" in message:
            errorTitle = i18n("Network Error")
            errorMessage = i18n(
                "Please check your network connections and try again.")
        elif "Access denied" in message or "tr.org.pardus.comar.Comar.PolicyKit" in message:
            errorTitle = i18n("Authorization Error")
            errorMessage = i18n("You are not authorized for this operation.")
        else:
            errorTitle = i18n("Pisi Error")
            errorMessage = message

        self.messageBox = QtGui.QMessageBox(errorTitle, errorMessage,
                                            QtGui.QMessageBox.Critical,
                                            QtGui.QMessageBox.Ok, 0, 0)
        self.messageBox.exec_()
        KApplication.kApplication().quit()
class Operation(QObject):
    def __init__(self):
        QObject.__init__(self)
        self.offlinemanager = OfflineManager()
        self.offlinemanager.setActionHandler(self.handler)
        self.offlinemanager.setExceptionHandler(self.exceptionHandler)
        self.connect(self.offlinemanager, SIGNAL("operationChanged(QString)"), SIGNAL("operationChanged(QString)"))
        self.connect(self.offlinemanager, SIGNAL("totalProgress(int)"), SIGNAL("totalProgress(int)"))
        self.connect(self.offlinemanager, SIGNAL("currentProgress(int)"), SIGNAL("currentProgress(int)"))
        self.connect(self.offlinemanager, SIGNAL("finished()"), SIGNAL("finished()"))

    def handler(self, package, signal, args):
        if signal == "cancelled":
            KApplication.kApplication().quit()

    def startProcesses(self, archive):
        self.offlinemanager.startProcesses(archive)

    def exceptionHandler(self, message):
        message = str(message)

        if "urlopen error" in message or "Socket Error" in message:
            errorTitle = i18n("Network Error")
            errorMessage = i18n("Please check your network connections and try again.")
        elif "Access denied" in message or "tr.org.pardus.comar.Comar.PolicyKit" in message:
            errorTitle = i18n("Authorization Error")
            errorMessage = i18n("You are not authorized for this operation.")
        else:
            errorTitle = i18n("Pisi Error")
            errorMessage = message

        self.messageBox = QtGui.QMessageBox(
            errorTitle, errorMessage, QtGui.QMessageBox.Critical, QtGui.QMessageBox.Ok, 0, 0
        )
        self.messageBox.exec_()
        KApplication.kApplication().quit()