From 403330a52f5611b5b6b7c15bf162f3e6d97eae6b 2013-04-12 23:15:16 From: Min RK Date: 2013-04-12 23:15:16 Subject: [PATCH] Merge pull request #3152 from Carreau/qtconsole-config-size make qtconsole size at startup configurable use `(c.|--)IPythonWidget.(height|width)=` to change the startup value. --- diff --git a/IPython/frontend/qt/console/console_widget.py b/IPython/frontend/qt/console/console_widget.py index 987f14f..ea68ea3 100644 --- a/IPython/frontend/qt/console/console_widget.py +++ b/IPython/frontend/qt/console/console_widget.py @@ -155,6 +155,16 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): with the size of the font. """) + width = Integer(81, config=True, + help="""The width of the console at start time in number + of characters (will double with `hsplit` paging) + """) + + height = Integer(25, config=True, + help="""The height of the console at start time in number + of characters (will double with `vsplit` paging) + """) + # Whether to override ShortcutEvents for the keybindings defined by this # widget (Ctrl+n, Ctrl+a, etc). Enable this if you want this widget to take # priority (when it has focus) over, e.g., window-level menu shortcuts. @@ -469,12 +479,12 @@ class ConsoleWidget(LoggingConfigurable, QtGui.QWidget): # a fudge factor of one character here. # Note 2: QFontMetrics.maxWidth is not used here or anywhere else due # to a Qt bug on certain Mac OS systems where it returns 0. - width = font_metrics.width(' ') * 81 + margin + width = font_metrics.width(' ') * self.width + margin width += style.pixelMetric(QtGui.QStyle.PM_ScrollBarExtent) if self.paging == 'hsplit': width = width * 2 + splitwidth - height = font_metrics.height() * 25 + margin + height = font_metrics.height() * self.height + margin if self.paging == 'vsplit': height = height * 2 + splitwidth