Skip to content

Commit

Permalink
[pyqgis-console] Sets minimum height for input area based of font metric
Browse files Browse the repository at this point in the history
  • Loading branch information
slarosa committed Oct 3, 2013
1 parent 50542b9 commit 9de5745
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion python/console/console_sci.py
Expand Up @@ -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)
Expand All @@ -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()
Expand All @@ -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()
Expand Down

0 comments on commit 9de5745

Please sign in to comment.