On 2010-04-23, you wrote:
[snip]
> While reading the document more carefully through, I noticed the mention
> about pyqtConfigure(). We really should find an implementation-agnostic
> name for it. Of course, it's better still to support pyqtConfigure() as
> well but we could make it throw a warning.
>
> Another issue with pyqtConfigure is that the name is in my opionion
> somewhat non-descriptive and misleading: What does it configure? Is it
> releated to the pyqtconfig module?
>
> Ouch. Just realized that's not the only utility function with a similar
> name, pyqtProperty was just taken for defining new Qt properties. These
> were already discussed in PSEP 100 for pyqtSignal and pyqtSlot. A quick
> check for PyQt 4.6 revealed these in QtCore:
>
> pyqtProperty
> pyqtRemoveInputHook
> pyqtRestoreInputHook
> pyqtSignal
> pyqtSignature
> pyqtSlot
> pyqtWrapperType
>
> (and pyqtConfigure in QObject)
>
> Maybe it would be cleanest if we just let the pyqtConfigure name stay in
> PSEP 101 and make a separate PSEP for proposing implementation-agnostic
> names for these functions?
If you want compatibility I guess the names are needed. In fact,
annoyingly PyQt adds a whole load of names if you do from ... import *,
including these:
'bin_', 'bom', 'center', 'dec', 'endl', 'fixed', 'flush', 'forcepoint',
'forcesign', 'hex_', 'left', 'lowercasebase', 'lowercasedigits',
'pyqtRemoveInputHook', 'pyqtRestoreInputHook', 'pyqtSignal',
'pyqtSignature', 'pyqtSlot', 'pyqtWrapperType', 'qAbs',
'qUnregisterResourceData', 'qVersion', 'qWarning', 'qrand', 'qsrand',
'reset', 'right', 'scientific', 'showbase', 'uppercasebase',
'uppercasedigits', 'ws'
These are just from PyQt4.QtCore and I've deleted quite a few!
Personally, I think it would be much better if from ... import * only
imported names beginning with Q or q.
As for the pyqt*() names, I don't see why PySide couldn't use qt*()
names instead but with the ability to import them as pyqt*() names if
necessary.
So for a pure PySide app:
from PySide.QtCore import *
from PySide.QtGui import *
This would only bring in names that begin with Q and qt.
For non-Qt names, I'd suggest putting them in a Qt namespace, so
Qt.bin(), Qt.bom(), ..., Qt.ws(), plus PySide-specific ones like
Qt.qtConfigure() (equivalent to PyQt4's pyqtConfigure()).
But for a PySide/PyQt app:
try:
from PySide.QtCore import *
from PySide.QtGui import *
from PySide.Qt import *
from PySide.Compatibility import *
except ImportError:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
The Compatability module would just have renamings, e.g.:
# Compatability.py
import PySide
import PySide.Qt
pyqtConfigure = PySide.Qt.qtConfigure
PYQT_VERSION_STR = PySide.VERSION_STR
...
Anyway, that's my 2c:-)
--
Mark Summerfield, Qtrac Ltd, www.qtrac.eu
C++, Python, Qt, PyQt - training and consultancy
"Rapid GUI Programming with Python and Qt" - ISBN 0132354187
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside