detect broken pyqt4.6 and recover/warn

This commit is contained in:
Damien Elmes 2010-01-22 17:51:51 +09:00
parent d4491869c1
commit 85a6f4197d
3 changed files with 11 additions and 3 deletions

View file

@ -185,10 +185,10 @@ interval, factor, noCount, priority, (select tags from facts where
facts.id = cards.factId), (select created from facts where facts.id = cards.factId), (select created from facts where
facts.id = cards.factId) from cards where id = :id""", facts.id = cards.factId) from cards where id = :id""",
id=self.cards[index.row()][0]) id=self.cards[index.row()][0])
# storing this in a local var first avoids a segfault if ankiqt.ui.utils.pyQtBroken:
end = self.index(idx, 1) raise
self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.emit(SIGNAL("dataChanged(QModelIndex,QModelIndex)"),
index, end) index, self.index(index.row(), 1))
except: except:
# called after search changed # called after search changed
pass pass

View file

@ -1654,6 +1654,11 @@ learnt today")
removeHook("showQuestion", self.onCardStats) removeHook("showQuestion", self.onCardStats)
def onShowGraph(self): def onShowGraph(self):
if ui.utils.pyQtBroken:
ui.utils.showInfo(
"Your PyQt installation is broken. "
"Please upgrade or downgrade PyQt.")
return
self.setStatus(_("Loading graphs (may take time)...")) self.setStatus(_("Loading graphs (may take time)..."))
self.app.processEvents() self.app.processEvents()
import anki.graphs import anki.graphs

View file

@ -264,3 +264,6 @@ class ProgressWin(object):
self.app.processEvents() self.app.processEvents()
time.sleep(0.1) time.sleep(0.1)
self.diag.cancel() self.diag.cancel()
import PyQt4.pyqtconfig as PyConf;
pyQtBroken = PyConf.Configuration().pyqt_version_str.startswith("4.6")