fixed CQ for bitmessageqt.messageview module

This commit is contained in:
coolguy-cell 2020-06-05 17:36:16 +05:30
parent 217a5c0c5b
commit 859eeafcfe
No known key found for this signature in database
GPG Key ID: CD3A42E1D470AD70

View File

@ -1,12 +1,14 @@
""" """
src/bitmessageqt/messageview.py Custom message viewer with support for switching between HTML and plain
=============================== text rendering, HTML sanitization, lazy rendering (as you scroll down),
zoom and URL click warning popup
""" """
from PyQt4 import QtCore, QtGui from PyQt4 import QtCore, QtGui
from safehtmlparser import SafeHTMLParser from safehtmlparser import SafeHTMLParser
from tr import _translate
class MessageView(QtGui.QTextBrowser): class MessageView(QtGui.QTextBrowser):
@ -49,11 +51,12 @@ class MessageView(QtGui.QTextBrowser):
"""Mouse wheel scroll event handler""" """Mouse wheel scroll event handler"""
# super will actually automatically take care of zooming # super will actually automatically take care of zooming
super(MessageView, self).wheelEvent(event) super(MessageView, self).wheelEvent(event)
if (QtGui.QApplication.queryKeyboardModifiers() & if (
QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier
) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical:
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
QtGui.QApplication.activeWindow().statusBar().showMessage( QtGui.QApplication.activeWindow().statusBar().showMessage(_translate(
QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom))) "MainWindow", "Zoom level %1%").arg(str(zoom)))
def setWrappingWidth(self, width=None): def setWrappingWidth(self, width=None):
"""Set word-wrapping width""" """Set word-wrapping width"""