From 0bc8b0f24f8de58d18a061d230eacd888d588423 Mon Sep 17 00:00:00 2001 From: David Aguilar Date: Thu, 9 Jan 2014 17:28:27 -0800 Subject: [PATCH] commitmsg: remove event filter to avoid spurious resizing The commit message editor changes its minimum size when its focus changes. This allowed a nice behavior where it can be resized down so that the description is not visible. This is problematic because changing focus to/from the commit message editor causes the dock widgets to resize themselves, which is not wanted. Set a sane minimum size on the description field and remove the event filters so that we no longer futz with the minimum size. This prevents the spurious resizing. Signed-off-by: David Aguilar --- cola/widgets/commitmsg.py | 20 ++++++-------------- 1 file changed, 6 insertions(+), 14 deletions(-) diff --git a/cola/widgets/commitmsg.py b/cola/widgets/commitmsg.py index ab9e48cf..f93a9d25 100644 --- a/cola/widgets/commitmsg.py +++ b/cola/widgets/commitmsg.py @@ -505,28 +505,15 @@ class CommitSummaryLineEdit(HintedLineEdit): class CommitMessageTextEdit(SpellCheckTextEdit): + def __init__(self, parent=None): hint = N_('Extended description...') SpellCheckTextEdit.__init__(self, hint, parent) self.extra_actions = [] - self.setMinimumSize(QtCore.QSize(1, 1)) self.action_emit_leave = add_action(self, 'Shift Tab', self.emit_leave, 'Shift+tab') - self.installEventFilter(self) - - def eventFilter(self, obj, event): - if event.type() == QtCore.QEvent.FocusIn: - height = QtGui.QFontMetrics(self.font()).height() * 3 - height += defs.spacing * 4 - self.setMinimumSize(QtCore.QSize(1, height)) - - elif event.type() == QtCore.QEvent.FocusOut: - self.setMinimumSize(QtCore.QSize(1, 1)) - - return False - def contextMenuEvent(self, event): menu, spell_menu = self.context_menu() if self.extra_actions: @@ -584,3 +571,8 @@ class CommitMessageTextEdit(SpellCheckTextEdit): def emit_leave(self): self.emit(SIGNAL('leave()')) + + def setFont(self, font): + SpellCheckTextEdit.setFont(self, font) + fm = self.fontMetrics() + self.setMinimumSize(QtCore.QSize(1, fm.height() * 2)) -- 2.11.4.GIT