Mark,

I quite like the idea of putting all QtCore "globals" to a separate namespace. However, maybe we could clean it up a bit while at it?

Apparently the PyQt4.QtCore module functions fall to three different categories:

pyqt.* for the Python-specific APIs
q.* for assorted utility functions in QtGlobal.h in C++
rest for QTextStream's utility functions

So, my proposal is we deal with these three categories separately (maybe even separate PSEPs?).

The q.* utility functions could maybe even stay in QtCore module namespace? They're probably not interfering with anything and importing them in QtCore would be consistent with native Qt's behaviour.

As for the pyqt.*, for QtCore.pyqtSignal (not even mentioned in the QtCore reference O_o) and QtCore.pyqtSlot we already made a decision in PSEP 100 to rename them to QtCore.signal and QtCore.slot. Of course, nothing prevents us from amending or changing that decision... Would it work if all of these would be moved to the Qt module and the pyqt prefix would be removed?

As for the QTextStream's utility functions, IMO they could be moved to a module of their own. Maybe PySide.Stream?

The Compatibility module you suggested could then import all of these in the right places.

This is already off the QtCore cleanup topic but I also really dislike the whole C++ -like stream syntax (or at least having it imported to Python). I wonder would it be a too big and unnecessary deviation providing no functional advantage but maybe we could offer at least an alternative method-call syntax, e.g.:

stream.write(movie.title).write(movie.acquired).write(movie.notes)

instead of

stream << movie.title << movie.acquired << movie.notes ?


Cheers,

ma.


On 23.04.2010 15:41, ext Mark Summerfield wrote:
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:-)


_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to