def _on_trans_finished(self, trans, enum):
     """callback when a aptdaemon transaction finished"""
     if enum == enums.EXIT_FAILED:
         # daemon died are messages that result from broken
         # cancel handling in aptdaemon (LP: #440941)
         # FIXME: this is not a proper fix, just a workaround
         if trans.error_code == enums.ERROR_DAEMON_DIED:
             logging.warn("daemon dies, ignoring: %s" % excep)
         else:
             msg = "%s: %s\n%s\n\n%s" % (
                 _("Error"),
                 enums.get_error_string_from_enum(trans.error_code),
                 enums.get_error_description_from_enum(trans.error_code),
                 trans.error_details)
             logging.error("error in _on_trans_finished '%s'" % msg)
             # show dialog to the user and exit (no need to reopen
             # the cache)
             dialogs.error(
                 None, 
                 enums.get_error_string_from_enum(trans.error_code),
                 enums.get_error_description_from_enum(trans.error_code),
                 trans.error_details)
     # send finished signal
     try:
         pkgname = trans.meta_data["sc_pkgname"]
         del self.pending_transactions[pkgname]
         self.emit("transaction-progress-changed", pkgname, 100)
     except KeyError:
         pass
     # if it was a cache-reload, trigger a-x-i update
     if trans.role == enums.ROLE_UPDATE_CACHE:
         self.update_xapian_index()
     # send appropriate signals
     self.emit("transactions-changed", self.pending_transactions)
     self.emit("transaction-finished", enum != enums.EXIT_FAILED)
    def upgrade_finish(self, transaction, exit_state):
        if exit_state == EXIT_FAILED:
            error_string = get_error_string_from_enum(transaction.error.code)
            error_desc = get_error_description_from_enum(transaction.error.code)

        text = "Upgrade finished"

        reboot_required_path = Path("/var/run/reboot-required")
        if reboot_required_path.exists():
            text = text + "\n" + "Restart required"
        self.progressBar.setVisible(False)

        if(len(self.errors)>0):
            text = text + "\n With some Errors"
            self.plainTextEdit.appendPlainText("Error Resume:\n")
            for error in self.errors:
                self.plainTextEdit.setEnabled(False)
                self.plainTextEdit.insertPlainText(error + "\n")
                self.plainTextEdit.insertPlainText(error_string + "\n")
                self.plainTextEdit.insertPlainText(error_desc + "\n")
                self.plainTextEdit.moveCursor(QTextCursor.End)

        self.label.setText(text)
        self.closeBtn.setVisible(True)
        self.closeBtn.setEnabled(True)
        self.plainTextEdit.setEnabled(True)
Exemple #3
0
 def _on_finished(self, trans, status, action):
     error_string = None
     error_desc = None
     trans_failed = False
     if status == EXIT_FAILED:
         error_string = get_error_string_from_enum(trans.error.code)
         error_desc = get_error_description_from_enum(trans.error.code)
         if self.trans_failed_msg:
             trans_failed = True
             error_desc = error_desc + "\n" + self.trans_failed_msg
     # tell unity to hide the progress again
     self.unity.set_progress(-1)
     is_success = (status == EXIT_SUCCESS)
     try:
         self._action_done(action,
                           authorized=True,
                           success=is_success,
                           error_string=error_string,
                           error_desc=error_desc,
                           trans_failed=trans_failed)
     except TypeError:
         # this module used to be be lazily imported and in older code
         # trans_failed= is not accepted
         # TODO: this workaround can be dropped in Ubuntu 20.10
         self._action_done(action,
                           authorized=True,
                           success=is_success,
                           error_string=error_string,
                           error_desc=error_desc)
    def update_finish(self, transaction, exit_state):
        self.label.setText("Update Cache Finished")
        if exit_state == EXIT_FAILED:
            error_string = get_error_string_from_enum(transaction.error.code)
            error_desc = get_error_description_from_enum(transaction.error.code)
            self.textEdit.insertPlainText(error_string + "\n")
            self.textEdit.insertPlainText(error_desc + "\n")

        self.upgrade()
 def _on_finished(self, trans, status, action, close_on_done):
     error_string = None
     error_desc = None
     if status == EXIT_FAILED:
         error_string = get_error_string_from_enum(trans.error.code)
         error_desc = get_error_description_from_enum(trans.error.code)
     elif status == EXIT_SUCCESS and close_on_done:
         sys.exit(0)
     # tell unity to hide the progress again
     self.unity.set_progress(-1)
     self.emit("action-done", action, True, status == EXIT_SUCCESS,
               error_string, error_desc)
 def _on_finished(self, trans, status, action):
     error_string = None
     error_desc = None
     if status == EXIT_FAILED:
         error_string = get_error_string_from_enum(trans.error.code)
         error_desc = get_error_description_from_enum(trans.error.code)
     # tell unity to hide the progress again
     self.unity.set_progress(-1)
     is_success = (status == EXIT_SUCCESS)
     self._action_done(action,
                       authorized=True, success=is_success,
                       error_string=error_string, error_desc=error_desc)
 def _on_finished(self, trans, status, action):
     error_string = None
     error_desc = None
     if status == EXIT_FAILED:
         error_string = get_error_string_from_enum(trans.error.code)
         error_desc = get_error_description_from_enum(trans.error.code)
     # tell unity to hide the progress again
     self.unity.set_progress(-1)
     is_success = (status == EXIT_SUCCESS)
     self._action_done(action,
                       authorized=True,
                       success=is_success,
                       error_string=error_string,
                       error_desc=error_desc)
Exemple #8
0
 def _show_error(self, error, parent):
     try:
         error.raise_exception()
     except aptdaemon.errors.NotAuthorizedError:
         raise sessioninstaller.errors.ModifyForbidden
     except aptdaemon.errors.TransactionCancelled:
         raise sessioninstaller.errors.ModifyCancelled
     except aptdaemon.errors.TransactionFailed as error:
         pass
     except sessioninstaller.errors.ModifyCancelled as error:
         raise error
     except Exception as error:
         error = aptdaemon.errors.TransactionFailed(enums.ERROR_UNKNOWN,
                                                    str(error))
     dia = aptdaemon.gtk3widgets.AptErrorDialog(error)
     if parent:
         dia.realize()
         dia.set_transient_for(parent)
     dia.run()
     dia.hide()
     msg = "%s - %s\n%s" % (enums.get_error_string_from_enum(error.code),
                           enums.get_error_description_from_enum(error.code),
                           error.details)
     raise sessioninstaller.errors.ModifyFailed(msg)
Exemple #9
0
        deferred.add_errback(self._show_error, parent)
        return deferred

    def _show_error(self, error, parent):
        try:
            error.raise_exception()
        except aptdaemon.errors.NotAuthorizedError:
            raise sessioninstaller.errors.ModifyForbidden
        except aptdaemon.errors.TransactionCancelled:
            raise sessioninstaller.errors.ModifyCancelled
        except aptdaemon.errors.TransactionFailed, error:
            pass
        except sessioninstaller.errors.ModifyCancelled, error:
            raise error
        except Exception, error:
            error = aptdaemon.errors.TransactionFailed(enums.ERROR_UNKNOWN,
                                                       str(error))
        dia = aptdaemon.gtk3widgets.AptErrorDialog(error)
        if parent:
            dia.realize()
            dia.set_transient_for(parent)
        dia.run()
        dia.hide()
        msg = "%s - %s\n%s" % (enums.get_error_string_from_enum(error.code),
                              enums.get_error_description_from_enum(error.code),
                              error.details)
        raise sessioninstaller.errors.ModifyFailed(msg)


# vim:ts=4:sw=4:et
Exemple #10
0
        deferred.add_errback(self._show_error, parent)
        return deferred

    def _show_error(self, error, parent):
        try:
            error.raise_exception()
        except aptdaemon.errors.NotAuthorizedError:
            raise sessioninstaller.errors.ModifyForbidden
        except aptdaemon.errors.TransactionCancelled:
            raise sessioninstaller.errors.ModifyCancelled
        except aptdaemon.errors.TransactionFailed, error:
            pass
        except sessioninstaller.errors.ModifyCancelled, error:
            raise error
        except Exception, error:
            error = aptdaemon.errors.TransactionFailed(enums.ERROR_UNKNOWN,
                                                       str(error))
        dia = aptdaemon.gtk3widgets.AptErrorDialog(error)
        if parent:
            dia.realize()
            dia.set_transient_for(parent)
        dia.run()
        dia.hide()
        msg = "%s - %s\n%s" % (enums.get_error_string_from_enum(
            error.code), enums.get_error_description_from_enum(
                error.code), error.details)
        raise sessioninstaller.errors.ModifyFailed(msg)


# vim:ts=4:sw=4:et