From 2597ac63f68b855c4c6b2bc63ed54acce084994c Mon Sep 17 00:00:00 2001 From: mailchuck Date: Sat, 23 Jan 2016 09:55:12 +0100 Subject: [PATCH] Zooming info percent based an single step Zooming in message body view / compose works in single steps irrespective of wheel sensitivity, and info about zoom level is displayed in percent rather than font pixel size. --- src/bitmessageqt/messagecompose.py | 12 +++++------- src/bitmessageqt/messageview.py | 8 +++----- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/src/bitmessageqt/messagecompose.py b/src/bitmessageqt/messagecompose.py index 5718aa32..ff0849a5 100644 --- a/src/bitmessageqt/messagecompose.py +++ b/src/bitmessageqt/messagecompose.py @@ -9,14 +9,12 @@ class MessageCompose(QtGui.QTextEdit): def wheelEvent(self, event): if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: - numDegrees = event.delta() / 8 - numSteps = numDegrees / 15 - zoomDiff = numSteps + self.currentFont().pointSize() - self.defaultFontPointSize - if numSteps > 0: - self.zoomIn(numSteps) + if event.delta() > 0: + self.zoomIn(1) else: - self.zoomOut(-numSteps) - QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1").arg(str(zoomDiff))) + self.zoomOut(1) + zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize + QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom))) # super will actually automatically take care of zooming super(MessageCompose, self).wheelEvent(event) diff --git a/src/bitmessageqt/messageview.py b/src/bitmessageqt/messageview.py index 36002710..faa21cd2 100644 --- a/src/bitmessageqt/messageview.py +++ b/src/bitmessageqt/messageview.py @@ -35,13 +35,11 @@ class MessageView(QtGui.QTextBrowser): super(MessageView, self).mousePressEvent(event) def wheelEvent(self, event): - if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: - numDegrees = event.delta() / 8 - numSteps = numDegrees / 15 - zoomDiff = numSteps + self.currentFont().pointSize() - self.defaultFontPointSize - QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1").arg(str(zoomDiff))) # super will actually automatically take care of zooming super(MessageView, self).wheelEvent(event) + if (QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: + zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize + QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg(str(zoom))) def confirmURL(self, link): reply = QtGui.QMessageBox.warning(self,