Bug 284404 - Use API 2 for python plasma scriptengine
Summary: Use API 2 for python plasma scriptengine
Status: RESOLVED UNMAINTAINED
Alias: None
Product: bindings
Classification: Developer tools
Component: pykde (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR wishlist
Target Milestone: ---
Assignee: kde-bindings
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-18 20:00 UTC by James Roe
Modified: 2018-11-17 05:28 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.