Document and mark workarounds.

This commit is contained in:
Florian Bruhin 2014-09-02 20:44:58 +02:00
parent a98a4f5a10
commit 4caec2becb
11 changed files with 31 additions and 6 deletions

View File

@ -207,6 +207,7 @@ class CommandDispatcher:
count: The tab index to print, or None.
"""
if not qtutils.check_print_compat():
# WORKAROUND (remove this when we bump the requirements to 5.3.0)
raise cmdexc.CommandError(
"Printing on Qt < 5.3.0 on Windows is broken, please upgrade!")
tab = self._tabs.cntwidget(count)
@ -224,6 +225,7 @@ class CommandDispatcher:
count: The tab index to print, or None.
"""
if not qtutils.check_print_compat():
# WORKAROUND (remove this when we bump the requirements to 5.3.0)
raise cmdexc.CommandError(
"Printing on Qt < 5.3.0 on Windows is broken, please upgrade!")
tab = self._tabs.cntwidget(count)

View File

@ -65,7 +65,7 @@ class BrowserPage(QWebPage):
self._view = view
if PYQT_VERSION > 0x050300:
# This is broken in Qt <= 5.3.0.
# WORKAROUND (remove this when we bump the requirements to 5.3.1)
# See http://www.riverbankcomputing.com/pipermail/pyqt/2014-June/034385.html
# pylint: disable=invalid-name
self.javaScriptPrompt = self._javascript_prompt
@ -242,14 +242,19 @@ class BrowserPage(QWebPage):
return super().extension(ext, opt, out)
return handler(opt, out)
except: # pylint: disable=bare-except
# Due to a bug in PyQt, exceptions inside extension() get swallowed
# for some reason.
# WORKAROUND:
#
# Due to a bug in PyQt, exceptions inside extension() get
# swallowed:
# http://www.riverbankcomputing.com/pipermail/pyqt/2014-August/034722.html
#
# We used to re-raise the exception with a single-shot QTimer here,
# but that lead to a strange proble with a KeyError with some
# random jinja template stuff as content. For now, we only log it,
# so it doesn't pass 100% silently.
#
# FIXME: This should be fixed with PyQt 5.3.2 - re-check when it's
# out and raise the exception normally if possible.
log.webview.exception("Error inside WebPage::extension")
return False

View File

@ -114,6 +114,7 @@ class ModeManager(QObject):
@property
def mode(self):
"""Read-only property for the current mode."""
# WORKAROUND
# For some reason, on Ubuntu (Python 3.3.2, PyQt 5.0.1, Qt 5.0.2) there
# is a lingering exception here sometimes. With this construct, we
# clear this exception which makes no sense at all anyways.

View File

@ -146,6 +146,8 @@ class NetworkManager(QNetworkAccessManager):
req.setRawHeader('Accept-Language'.encode('ascii'),
accept_language.encode('ascii'))
if PYQT_VERSION < 0x050301:
# WORKAROUND (remove this when we bump the requirements to 5.3.1)
#
# If we don't disable our message handler, we get a freeze if a
# warning is printed due to a PyQt bug, e.g. when clicking a
# currency on http://ch.mouser.com/localsites/

View File

@ -140,6 +140,8 @@ def fix_harfbuzz(args):
IMPORTANT: This needs to be done before QWidgets is imported in any way!
WORKAROUND (remove this when we bump the requirements to 5.3.1)
Args:
args: The argparse namespace.
"""

View File

@ -41,6 +41,7 @@ try:
except ImportError:
colorlog = None
else:
# WORKAROUND
# colorlog calls colorama.init() which we don't want, also it breaks our
# sys.stdout/sys.stderr if they are None. Bugreports:
# https://code.google.com/p/colorama/issues/detail?id=61

View File

@ -114,6 +114,7 @@ def get_args(namespace):
def check_print_compat():
"""Check if printing should work in the given Qt version."""
# WORKAROUND (remove this when we bump the requirements to 5.3.0)
return not (os.name == 'nt' and version_check('5.3.0', operator.lt))

View File

@ -232,6 +232,8 @@ def qurl_from_user_input(urlstr):
IPv6, so we first try to handle it as a valid IPv6, and if that fails we
use QUrl.fromUserInput.
WORKAROUND - https://bugreports.qt-project.org/browse/QTBUG-41089
Args:
urlstr: The URL as string.

View File

@ -170,7 +170,7 @@ def get_standard_dir(typ):
appname = qapp.applicationName()
if (typ == QStandardPaths.ConfigLocation and
path.split(os.sep)[-1] != appname):
# Workaround for
# WORKAROUND - see
# https://bugreports.qt-project.org/browse/QTBUG-38872
path = os.path.join(path, appname)
if not os.path.exists(path):
@ -182,6 +182,7 @@ def get_standard_dir(typ):
def actute_warning():
"""Display a warning about the dead_actute issue if needed."""
# WORKAROUND (remove this when we bump the requirements to 5.3.0)
# Non linux OS' aren't affected
if not sys.platform.startswith('linux'):
return

View File

@ -104,7 +104,8 @@ class CompletionView(QTreeView):
self.setItemsExpandable(False)
self.setExpandsOnDoubleClick(False)
self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff)
# QTBUG? This is a workaround for weird race conditions with invalid
# WORKAROUND
# This is a workaround for weird race conditions with invalid
# item indexes leading to segfaults in Qt.
#
# Some background: http://bugs.quassel-irc.org/issues/663

View File

@ -65,7 +65,13 @@ class TextBase(QLabel):
This update the elided text after setting the text, and also works
around a weird QLabel redrawing bug where it doesn't redraw correctly
when the text is empty -- we explicitely need to call repaint() to
resolve this. See http://stackoverflow.com/q/21890462/2085149
resolve this.
More info:
http://stackoverflow.com/q/21890462/2085149
https://bugreports.qt-project.org/browse/QTBUG-36945
https://codereview.qt-project.org/#/c/79181/
Args:
txt: The text to set (string).
@ -73,6 +79,7 @@ class TextBase(QLabel):
super().setText(txt)
self._update_elided_text(self.geometry().width())
if not txt:
# WORKAROUND
self.repaint()
def resizeEvent(self, e):