Skip to content

Instantly share code, notes, and snippets.

@slarosa
Created October 8, 2013 21:05
Show Gist options
  • Select an option

  • Save slarosa/6891670 to your computer and use it in GitHub Desktop.

Select an option

Save slarosa/6891670 to your computer and use it in GitHub Desktop.
patch console_sci.py
--- a/python/console/console_sci.py
+++ b/python/console/console_sci.py
@@ -90,7 +90,6 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
# not too small
#self.setMinimumSize(500, 300)
- self.setMinimumHeight(20)
self.setWrapMode(QsciScintilla.WrapCharacter)
self.SendScintilla(QsciScintilla.SCI_EMPTYUNDOBUFFER)
@@ -112,6 +111,13 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
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 settingsShell(self):
# Set Python lexer
self.setLexers()
@@ -129,6 +135,9 @@ class ShellScintilla(QsciScintilla, code.InteractiveInterpreter):
else:
self.setAutoCompletionSource(self.AcsNone)
+ # Sets minimum height for input area based of font metric
+ self._setMinimumHeight()
+
def showHistory(self):
if not self.historyDlg.isVisible():
self.historyDlg.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment