From a9857a5e4f93b93dfdfba1411e10d0443bc48d1a Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Fri, 5 Dec 2008 17:13:51 +0900 Subject: [PATCH] wrap errors, improve earliest card message --- ankiqt/ui/main.py | 23 ++++++++++++++++++++++- ankiqt/ui/utils.py | 1 + 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/ankiqt/ui/main.py b/ankiqt/ui/main.py index 3c4db34ad..2aa4fd9f2 100644 --- a/ankiqt/ui/main.py +++ b/ankiqt/ui/main.py @@ -115,6 +115,7 @@ class AnkiQt(QMainWindow): self.timer.setInterval(interval) def onTimeout(self): + print self.pool ui.utils.showText(_("""\ An error occurred. Please copy the following message into a bug report.\n\n""" + self.pool)) self.pool = "" @@ -286,7 +287,27 @@ An error occurred. Please copy the following message into a bug report.\n\n""" + if delay > 86400: return if delay < 0: - sys.stderr.write("earliest time returned negative value\n") + c = self.deck.getCard() + if c: + c = (c.id, c.question, c.due, c.combinedDue, c.isDue, c.type) + sys.stderr.write(""" +earliest time returned %f + +failed is: +%s + +rev: +%s + +new: +%s + +getCard() returns: +%s""" % (delay, + self.deck.s.all("select * from failedCards"), + self.deck.s.all("select * from revCardsOld"), + self.deck.s.all("select * from acqCardsOrdered"), + c)) return t = QTimer(self) t.setSingleShot(True) diff --git a/ankiqt/ui/utils.py b/ankiqt/ui/utils.py index cfa5b7458..aaa45667a 100644 --- a/ankiqt/ui/utils.py +++ b/ankiqt/ui/utils.py @@ -44,6 +44,7 @@ def showText(text, parent=None): d.setWindowTitle("Anki") v = QVBoxLayout() l = QLabel(text) + l.setWordWrap(True) l.setTextInteractionFlags(Qt.TextSelectableByMouse) v.addWidget(l) buts = QDialogButtonBox.Ok