Skip to content
Permalink
Browse files

[pyqgis-console] Sets minimum height for input area based of font metric

  • Loading branch information
slarosa committed Oct 3, 2013
1 parent 50542b9 commit 9de5745520724f522a6214476318a3ba99729081
Showing with 10 additions and 1 deletion.
  1. +10 −1 python/console/console_sci.py
@@ -91,7 +91,6 @@ def __init__(self, parent=None):

# not too small
#self.setMinimumSize(500, 300)
self.setMinimumHeight(20)

self.setWrapMode(QsciScintilla.WrapCharacter)
self.SendScintilla(QsciScintilla.SCI_EMPTYUNDOBUFFER)
@@ -113,6 +112,13 @@ def __init__(self, parent=None):
self.newShortcutCAS.activated.connect(self.autoCompleteKeyBinding)
self.newShortcutCSS.activated.connect(self.showHistory)

def _setMinimumHeight(self):
fnt = self.settings.value("pythonConsole/fontfamilytext", "Monospace")
fntSize = self.settings.value("pythonConsole/fontsize", 10, type=int)
fm = QFontMetrics(QFont(fnt, fntSize))

self.setMinimumHeight(fm.height() + 10)

def refreshSettingsShell(self):
# Set Python lexer
self.setLexers()
@@ -133,6 +139,9 @@ def refreshSettingsShell(self):
cursorColor = self.settings.value("pythonConsole/cursorColor", QColor(Qt.black))
self.setCaretForegroundColor(cursorColor)

# Sets minimum height for input area based of font metric
self._setMinimumHeight()

def showHistory(self):
if not self.historyDlg.isVisible():
self.historyDlg.show()

0 comments on commit 9de5745

Please sign in to comment.
You can’t perform that action at this time.