I wrote what is supposed to be a PSEP to deal with Qt properties and python properties, any comments are appreciated.
PSEP: 102 Title: Adopt PyQt's API 2 for PySide Version: $Revision$ Last-Modified: $Date$ Author: Hugo Parente Lima <[email protected]> Status: Accepted Type: Standards Track Content-Type: text/x-rst Created: 15-Jul-2010 Abstract ======== Python properties are the Python way of writing what is known in the C++ and Java world as getters and setters. This PSEP proposes the conversion of Qt getters and setters to Python properties. Rationale ========= A Qt property [#QtProperties] is basically formed by a property name, a getter and a setter method (the latter may be omitted for read only properties ). There are other fields but none of them are important for the scope of this PSEP. The purpose of this PSEP is to use Python properties instead of getters and setters to make PySide much more attractive to Python programmers, avoiding the cumbersome and un-Pythonic getter/setter idiom. Property names and name clashes =============================== The property names will be the same as the Qt property names, if possible. Qt follow a rule when defining they property names, if a property is called "foo", there is a getter called "foo()" and a setter called "setFoo(...)" unless "foo" is a bool, so the getter can be "isFoo" or "hasFoo", it depends on the meaning of "foo". So the name clashes probably can occur only on boolean properties where the, getter name is different from the property name. But the Qt API was specially crafted to avoid these clashes, anyway if they occur we can just rename the property or method to the better name available to avoid the name clash and continue with a pythonic API. Compatibility ============= The proposed API is incompatible with the known PySide and PyQt API, but since PySide is not yet widely used and hasn't reached version 1.0.0, it seems reasonable to break compatibility for the sake of getting PySide "right". References ========== .. [#QtProperties] Qt's Property System (http://doc.trolltech.com/latest/properties.html) Copyright ========= This document has been placed in the public domain. -- Hugo Parente Lima INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.openbossa.org/listinfo/pyside
