def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: m = "%s\n%s" % (msg, e.message) detail = str(traceback.format_exc()) qmb = QMessageBox(QMessageBox.Critical, "Error", m) qmb.setDetailedText(detail) qmb.resize(400, qmb.size().height()) qmb.exec_()
def report_error(self, message, detail): """ Display an error in a modal :param message: A short description of the error :type message: str :param detail: A longer description :type detail: str """ qmb = QMessageBox(QMessageBox.Critical, "Error", message) qmb.setDetailedText(detail) qmb.resize(400, qmb.size().height()) qmb.exec_()
def report_error(error, factory, curfile): import traceback retry = QMessageBox.Retry cancel = QMessageBox.Cancel buttons = retry | cancel detail = traceback.format_exc() msg = "\n".join(["Could not load %s (wrong load method?)" % curfile, "File load method: %s" % factory.label]) detail = "\n\n".join(["Error message: %s" % error, detail]) mb = QMessageBox(QMessageBox.Critical, "Data Load Error", msg) mb.setDetailedText(detail) mb.setDefaultButton(cancel) mb.setStandardButtons(buttons) ok = mb.exec_() return ok == retry
def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: import traceback from glue.utils.qt import QMessageBoxPatched as QMessageBox m = "%s\n%s" % (msg, e) detail = str(traceback.format_exc()) if len(m) > 500: detail = "Full message:\n\n%s\n\n%s" % (m, detail) m = m[:500] + '...' qmb = QMessageBox(QMessageBox.Critical, "Error", m) qmb.setDetailedText(detail) qmb.show() qmb.raise_() qmb.exec_() sys.exit(1)
def wrapper(*args, **kwargs): try: return func(*args, **kwargs) except Exception as e: # Make sure application has been started from glue.utils.qt import get_qapp # Here to avoid circ import get_qapp() m = "%s\n%s" % (msg, e) detail = str(traceback.format_exc()) if len(m) > 500: detail = "Full message:\n\n%s\n\n%s" % (m, detail) m = m[:500] + '...' qmb = QMessageBox(QMessageBox.Critical, "Error", m) qmb.setDetailedText(detail) qmb.show() qmb.raise_() qmb.exec_() sys.exit(1)
def finalize(self): config = PluginConfig.load() for name in self._checkboxes: config.plugins[name] = self._checkboxes[name].checkState(0) > 0 try: config.save() except Exception: import traceback detail = str(traceback.format_exc()) from glue.utils.qt import QMessageBoxPatched as QMessageBox message = QMessageBox(QMessageBox.Critical, "Error", "Could not save plugin configuration") message.setDetailedText(detail) message.exec_() return self.accept()
def show_msg(): mb = QMessageBox(QMessageBox.Critical, title, msg) mb.setDetailedText(self._terminal_exception) mb.exec_()