[Kde-bindings] [Bug 284404] New: Use API 2 for python plasma scriptengine

Phil Thompson phil at riverbankcomputing.com
Tue Oct 18 21:10:25 UTC 2011


On Tue, 18 Oct 2011 20:00:01 +0000, James Roe <roejames12 at hotmail.com>
wrote:
> https://bugs.kde.org/show_bug.cgi?id=284404
> 
>            Summary: Use API 2 for python plasma scriptengine
>            Product: bindings
>            Version: unspecified
>           Platform: Ubuntu Packages
>         OS/Version: Linux
>             Status: UNCONFIRMED
>           Severity: wishlist
>           Priority: NOR
>          Component: general
>         AssignedTo: kde-bindings at kde.org
>         ReportedBy: roejames12 at hotmail.com
> 
> 
> Version:           unspecified (using KDE 4.7.2) 
> OS:                Linux
> 
> PyQt4 has API 1 (default for Python 2), and API 2 (default for Python
3).
> But
> you can manually set the API in Python 2 to API 2, using something such
as:
> 
> import sip
> for item in ('QDate', 'QDateTime', 'QString', 'QTextStream', 'QTime'
>              'QUrl', 'QVariant'):
>     sip.setapi(item, 2)
> 
> Why is API 2 better?
> To put it short, API 2 converts Qt types to native Python types. It
makes
> code
> seamless. For example, you wouldn't need to use QString anymore, just a
> regular
> python str. This of course applies to other types like lists, dicts,
etc.
> 
> Take a look at this PSEP which better describes the differences.
> http://www.pyside.org/docs/pseps/psep-0101.html
> 
> Considering the nature of this request, it's probably best to do this
for
> all
> KDE4 Python bindings as well, to keep things consistent.
> 
> WARNING: This has the potential to break many widgets and programs which
> depend
> on PyKDE4! But this is really for the ultimate benefit of everyone
> however. :)
> Porting code form the old to the new style shouldn't be too hard either.

No, no, no - this is a really, really stupid idea. Multiple API support is
a tool for migrating Python v2 applications to Python v3. It would not only
break every application but it would also break every 3rd party library
that used PyQt/PyKDE.

Phil



More information about the Kde-bindings mailing list