Message editor updates
- Does not allow changing fonts (it's ignored once it's sent anyway), fixes #167 - Allows zooming, fixes #163
This commit is contained in:
parent
32b0d24be2
commit
9353e8eff7
|
@ -2274,7 +2274,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.comboBoxSendFrom.setCurrentIndex(0)
|
self.ui.comboBoxSendFrom.setCurrentIndex(0)
|
||||||
self.ui.lineEditTo.setText('')
|
self.ui.lineEditTo.setText('')
|
||||||
self.ui.lineEditSubject.setText('')
|
self.ui.lineEditSubject.setText('')
|
||||||
self.ui.textEditMessage.setText('')
|
self.ui.textEditMessage.reset()
|
||||||
if self.replyFromTab is not None:
|
if self.replyFromTab is not None:
|
||||||
self.ui.tabWidget.setCurrentIndex(self.replyFromTab)
|
self.ui.tabWidget.setCurrentIndex(self.replyFromTab)
|
||||||
self.replyFromTab = None
|
self.replyFromTab = None
|
||||||
|
@ -2324,7 +2324,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
|
|
||||||
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
|
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
|
||||||
self.ui.lineEditSubjectBroadcast.setText('')
|
self.ui.lineEditSubjectBroadcast.setText('')
|
||||||
self.ui.textEditMessageBroadcast.setText('')
|
self.ui.textEditMessageBroadcast.reset()
|
||||||
self.ui.tabWidget.setCurrentIndex(1)
|
self.ui.tabWidget.setCurrentIndex(1)
|
||||||
self.ui.tableWidgetInboxSubscriptions.setCurrentCell(0, 0)
|
self.ui.tableWidgetInboxSubscriptions.setCurrentCell(0, 0)
|
||||||
self.statusBar().showMessage(_translate(
|
self.statusBar().showMessage(_translate(
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
|
|
||||||
from PyQt4 import QtCore, QtGui
|
from PyQt4 import QtCore, QtGui
|
||||||
from messageview import MessageView
|
from messageview import MessageView
|
||||||
|
from messagecompose import MessageCompose
|
||||||
import settingsmixin
|
import settingsmixin
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -232,7 +233,7 @@ class Ui_MainWindow(object):
|
||||||
self.gridLayout_2_Widget = QtGui.QWidget()
|
self.gridLayout_2_Widget = QtGui.QWidget()
|
||||||
self.gridLayout_2_Widget.setLayout(self.gridLayout_2)
|
self.gridLayout_2_Widget.setLayout(self.gridLayout_2)
|
||||||
self.verticalSplitter_5.addWidget(self.gridLayout_2_Widget)
|
self.verticalSplitter_5.addWidget(self.gridLayout_2_Widget)
|
||||||
self.textEditMessage = QtGui.QTextEdit(self.sendDirect)
|
self.textEditMessage = MessageCompose(self.sendDirect)
|
||||||
self.textEditMessage.setObjectName(_fromUtf8("textEditMessage"))
|
self.textEditMessage.setObjectName(_fromUtf8("textEditMessage"))
|
||||||
self.verticalSplitter_5.addWidget(self.textEditMessage)
|
self.verticalSplitter_5.addWidget(self.textEditMessage)
|
||||||
self.verticalSplitter_5.setStretchFactor(0, 0)
|
self.verticalSplitter_5.setStretchFactor(0, 0)
|
||||||
|
@ -268,7 +269,7 @@ class Ui_MainWindow(object):
|
||||||
self.gridLayout_5_Widget = QtGui.QWidget()
|
self.gridLayout_5_Widget = QtGui.QWidget()
|
||||||
self.gridLayout_5_Widget.setLayout(self.gridLayout_5)
|
self.gridLayout_5_Widget.setLayout(self.gridLayout_5)
|
||||||
self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget)
|
self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget)
|
||||||
self.textEditMessageBroadcast = QtGui.QTextEdit(self.sendBroadcast)
|
self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast)
|
||||||
self.textEditMessageBroadcast.setObjectName(_fromUtf8("textEditMessageBroadcast"))
|
self.textEditMessageBroadcast.setObjectName(_fromUtf8("textEditMessageBroadcast"))
|
||||||
self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast)
|
self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast)
|
||||||
self.verticalSplitter_6.setStretchFactor(0, 0)
|
self.verticalSplitter_6.setStretchFactor(0, 0)
|
||||||
|
|
24
src/bitmessageqt/messagecompose.py
Normal file
24
src/bitmessageqt/messagecompose.py
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
|
||||||
|
class MessageCompose(QtGui.QTextEdit):
|
||||||
|
|
||||||
|
def __init__(self, parent = 0):
|
||||||
|
super(MessageCompose, self).__init__(parent)
|
||||||
|
self.setAcceptRichText(False) # we'll deal with this later when we have a new message format
|
||||||
|
self.defaultFontPointSize = self.currentFont().pointSize()
|
||||||
|
|
||||||
|
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)
|
||||||
|
else:
|
||||||
|
self.zoomOut(-numSteps)
|
||||||
|
QtGui.QApplication.activeWindow().statusBar().showMessage(QtGui.QApplication.translate("MainWindow", "Zoom level %1").arg(str(zoomDiff)))
|
||||||
|
# super will actually automatically take care of zooming
|
||||||
|
super(MessageCompose, self).wheelEvent(event)
|
||||||
|
|
||||||
|
def reset(self):
|
||||||
|
self.setText('')
|
Loading…
Reference in New Issue
Block a user