[IPython-dev] Qt api selection re. ipython and matplotlib
Eric Firing
efiring at hawaii.edu
Tue Jul 5 03:42:18 EDT 2011
On 07/04/2011 06:51 PM, MinRK wrote:
> On Mon, Jul 4, 2011 at 20:57, Eric Firing<efiring at hawaii.edu> wrote:
>> On 07/04/2011 04:26 PM, Darren Dale wrote:
>>> On Mon, Jul 4, 2011 at 9:17 PM, Fernando Perez<fperez.net at gmail.com> wrote:
>>>> Hi folks,
>>>>
>>>> Eric Firing, Darren Dale and others in the MPL team are trying to work
>>>> out the Qt API selection issues after our own updates, but there are
>>>> some technical questions in there that require more knowledge about Qt
>>>> than I have. The MPL pull request is:
>>>>
>>>> https://github.com/matplotlib/matplotlib/pull/390
>>>>
>>>> which follows our own recent changes:
>>>>
>>>> https://github.com/ipython/ipython/pull/550#issuecomment-1490217
>>>>
>>>> Evan has already done the lion's share of the work on this topic, but
>>>> I figured I'd ping the list in case someone else can also jump in,
>>>> since I myself am kind of useless on the details of Qt itself.
>>>
>>> Note that this is probably not specific to matplotlib, but rather
>>> IPython's qt gui support. IPython.external.qt is setting the sip api
>>> level for PyQt4 to api version 2. Version 2 is not the default for
>>> python-2, which means that ipython would not be able to run PyQt4 apps
>>> or scripts that use QString or QVariant, both of which are officially
>>> supported in the default PyQt4 api. It will impact a lot of users and
>>> a lot of projects.
>>
>> Reference:
>>
>> http://developer.qt.nokia.com/wiki/Differences_Between_PySide_and_PyQt
>>
>> It seems that the mpl qt4 backend works with Version 1 or 2 (and with
>> PyQt4 or PySide) given just a little bit of compatibility shimming. If
>> ipython can similarly get by with a few shims, so that it does not need
>> to set the Version, then the problem is solved once those shims are
>> identified and installed.
>>
>> If I remove the version-setting from qt.py, then ipython still works
>> with mpl and PyQt4 via "ipython pylab=qt", but it does not work with
>> qtconsole or with PySide.
>
> I don't think we are going to rewrite the whole qtconsole to support
> version 1 for 0.11 this week. What we can do is change the default
> behavior in qt_for_kernel,
> (https://github.com/ipython/ipython/blob/master/IPython/external/qt_for_kernel.py)
> which is where code that interacts with other applications gets
> imported. Currently, we use our v2 import unless matplotlib<= 1.0.1
> is detected. However, we can change that default to be more
> conservative. User code (e.g. matplotlib code, integration with other
> apps) is not in the same process as the QtConsole, so we can have v1
> code in the kernel with v2 in the frontend.
I updated mpl pull request #390 and added ipython pull request #550 with
a strawman plan based on mpl rcParams. A quick test indicates that it
makes qtconsole work with pylab=qt with either PyQt4 or PySide selected
in mpl, and it also works with the ipython console with PyQt4, but not
with PySide. I don't know why the latter does not work.
Eric
>
> -MinRK
>
>>
>> Eric
>> _______________________________________________
>> IPython-dev mailing list
>> IPython-dev at scipy.org
>> http://mail.scipy.org/mailman/listinfo/ipython-dev
>>
More information about the IPython-dev
mailing list