[IPython-dev] make ctrl-c stop causing a crash exit with %gui and PyQt5

Erik Hvatum ice.rikh at gmail.com
Fri May 8 20:58:55 EDT 2015


Pull request created: https://github.com/ipython/ipython/pull/8421

FYI, the inputhook.py file in question lives in the main IPython repo.
This doesn't seem to impact qtconsole with IPython kernel running in a
different thread, although it may actually come into play if one sends an
interrupt signal directly to the kernel after causing the kernel to install
Qt event loop integration.

Regarding qtconsole itself, is it possible to use a style sheet to disable
text antialiasing, set window opacity, and select theme?  I currently do
these things in a very hackish way:

diff --git a/qtconsole/console/console_widget.py
b/qtconsole/console/console_widget.py
index c27c8de..5da0989 100644
--- a/qtconsole/console/console_widget.py
+++ b/qtconsole/console/console_widget.py
@@ -735,6 +735,7 @@ class ConsoleWidget(MetaQObjectHasTraits('NewBase',
(LoggingConfigurable, QtGui.
         """ Sets the base font for the ConsoleWidget to the specified
QFont.
         """
         font_metrics = QtGui.QFontMetrics(font)
+        font.setStyleStrategy(QtGui.QFont.NoAntialias)
         self._control.setTabStopWidth(self.tab_width *
font_metrics.width(' '))

         self._completion_widget.setFont(font)
diff --git a/qtconsole/console/ipython_widget.py
b/qtconsole/console/ipython_widget.py
index ead85d5..b37e148 100644
--- a/qtconsole/console/ipython_widget.py
+++ b/qtconsole/console/ipython_widget.py
@@ -439,7 +439,7 @@ class IPythonWidget(FrontendWidget):
     # 'IPythonWidget' interface

#---------------------------------------------------------------------------

-    def set_default_style(self, colors='lightbg'):
+    def set_default_style(self, colors='linux'):
         """ Sets the widget style to the class defaults.

         Parameters
diff --git a/qtconsole/console/mainwindow.py
b/qtconsole/console/mainwindow.py
index 386a7f3..c7cbb20 100644
--- a/qtconsole/console/mainwindow.py
+++ b/qtconsole/console/mainwindow.py
@@ -61,6 +61,7 @@ class MainWindow(QtGui.QMainWindow):
         """

         super(MainWindow, self).__init__()
+        self.setWindowOpacity(0.9)
         self._kernel_counter = 0
         self._app = app
         self.confirm_exit = confirm_exit

ipython qtconsole once accepted a --colors option that I could use to
select theme, but that went away.  This may really be a tech support
question; feel free to point me towards appropriate docs :)

Thanks,
Erik

PS: I like disabling text AA so that the 33 year old DOS console font, largely
manually traced to make a truetype font
<http://esoerik.blogspot.no/2012/10/remaking-windows-terminal-blocky-font.html>,
looks good on OS X, or Yosemite National Park, or whatever kids call it.
It's distinctly possible that I am one of perhaps 20 people on the planet
who actually want to disable text AA.

On Fri, May 8, 2015 at 5:24 PM, Thomas Kluyver <takowl at gmail.com> wrote:

> Thanks Erik! Do you want to make a pull request with that change against
> https://github.com/jupyter/qtconsole ?
>
> Best wishes,
> Thomas
>
> On 8 May 2015 at 15:17, Erik Hvatum <ice.rikh at gmail.com> wrote:
>
>> Patch attached.  I think I'm fixing a straightforward oversight;
>> create_inputhook_qt4 wants a an InputHookManager object as its first
>> argument, not an InputHookBase.  However, we get away with supplying the
>> wrong object until someone hits ctrl-c.  Passing the right object makes
>> graceful ctrl-c event loop integration work properly, rather than causing
>> IPython to exit.
>>
>> This seems familiar, but I'm not finding anything when I search.
>> Apologies if this issue is old news :)
>>
>> Cheers,
>> Erik
>>
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
>>
>
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150508/401c7e72/attachment.html>


More information about the IPython-dev mailing list