work around adjustHeightToFit() crashing on Linux

This commit is contained in:
Damien Elmes 2017-08-10 15:03:05 +10:00
parent a57b913450
commit c668efa4b4

View file

@ -13,7 +13,8 @@ import json
from aqt.qt import * from aqt.qt import *
import anki import anki
import aqt.forms import aqt.forms
from anki.utils import fmtTimeSpan, ids2str, stripHTMLMedia, htmlToTextLine, isWin, intTime, isMac from anki.utils import fmtTimeSpan, ids2str, stripHTMLMedia, htmlToTextLine, isWin, intTime,\
isMac, isLin
from aqt.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter, \ from aqt.utils import saveGeom, restoreGeom, saveSplitter, restoreSplitter, \
saveHeader, restoreHeader, saveState, restoreState, applyStyles, getTag, \ saveHeader, restoreHeader, saveState, restoreState, applyStyles, getTag, \
showInfo, askUser, tooltip, openHelp, showWarning, shortcut, mungeQA showInfo, askUser, tooltip, openHelp, showWarning, shortcut, mungeQA
@ -1798,6 +1799,11 @@ class BrowserToolbar(Toolbar):
self.web.onBridgeCmd = self._linkHandler self.web.onBridgeCmd = self._linkHandler
self.web.stdHtml(self.html(), self.css()) self.web.stdHtml(self.html(), self.css())
self.update() self.update()
if isLin:
# adjust height on a delay to work around a qt crash when
# opening the browser
self.browser.mw.progress.timer(10, self.web.adjustHeightToFit, False)
else:
self.web.adjustHeightToFit() self.web.adjustHeightToFit()
def update(self): def update(self):