Bug 284404

Summary: Use API 2 for python plasma scriptengine
Product: [Developer tools] bindings Reporter: James Roe <roejames12>
Component: pykdeAssignee: kde-bindings
Status: RESOLVED UNMAINTAINED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description James Roe 2011-10-18 20:00:00 UTC
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:  
-

-
Comment 1 James Roe 2011-10-18 20:05:34 UTC
An alternative method, is to (by default) use API 1 like normal, but allow user code to set a setting which says to use API 2 instead (similar to the way we can do it in sip, but more like a toggle). This way it's a backward compatible change, and won't kill so many widgets and programs.
Comment 2 Andrew Crouthamel 2018-11-17 05:28:41 UTC
Hello, unfortunately this bug is being closed as unmaintained, per request of einar77.