fix clayout preview, js errors

.exec_() and webengineview don't seem to play nicely together
This commit is contained in:
Damien Elmes 2016-07-07 12:32:27 +10:00
parent f8e300ab1d
commit d94c011c88
2 changed files with 5 additions and 11 deletions

View file

@ -48,7 +48,8 @@ class CardLayout(QDialog):
self.setLayout(v1) self.setLayout(v1)
self.redraw() self.redraw()
restoreGeom(self, "CardLayout") restoreGeom(self, "CardLayout")
self.exec_() self.setWindowModality(Qt.ApplicationModal)
self.show()
def redraw(self): def redraw(self):
self.cards = self.col.previewCards(self.note, 2) self.cards = self.col.previewCards(self.note, 2)
@ -227,12 +228,10 @@ Please create a new card type first."""))
base = getBase(self.mw.col) base = getBase(self.mw.col)
self.tab['pform'].frontWeb.stdHtml( self.tab['pform'].frontWeb.stdHtml(
ti(mungeQA(self.mw.col, c.q(reload=True))), self.mw.reviewer._styles(), ti(mungeQA(self.mw.col, c.q(reload=True))), self.mw.reviewer._styles(),
bodyClass="card card%d" % (c.ord+1), head=base, bodyClass="card card%d" % (c.ord+1), head=base),
js=anki.js.browserSel)
self.tab['pform'].backWeb.stdHtml( self.tab['pform'].backWeb.stdHtml(
ti(mungeQA(self.mw.col, c.a()), type='a'), self.mw.reviewer._styles(), ti(mungeQA(self.mw.col, c.a()), type='a'), self.mw.reviewer._styles(),
bodyClass="card card%d" % (c.ord+1), head=base, bodyClass="card card%d" % (c.ord+1), head=base),
js=anki.js.browserSel)
clearAudioQueue() clearAudioQueue()
if c.id not in self.playedAudio: if c.id not in self.playedAudio:
playFromText(c.q()) playFromText(c.q())

View file

@ -458,12 +458,7 @@ class Editor(object):
ord = self.card.ord ord = self.card.ord
else: else:
ord = 0 ord = 0
# passing parentWindow leads to crash on windows at the moment CardLayout(self.mw, self.note, ord=ord, parent=self.parentWindow,
if isWin:
parent=None
else:
parent=self.parentWindow
CardLayout(self.mw, self.note, ord=ord, parent=parent,
addMode=self.addMode) addMode=self.addMode)
if isWin: if isWin:
self.parentWindow.activateWindow() self.parentWindow.activateWindow()