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

James Roe roejames12 at hotmail.com
Tue Oct 18 20:00:01 UTC 2011


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.

Reproducible: Didn't try

Steps to Reproduce:
-

Actual Results:  
-

Expected Results:  
-

-

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the Kde-bindings mailing list