On 2010-04-27, Matti Airas wrote:
> On 27.04.2010 10:32, ext Mark Summerfield wrote:
> >> 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?).
> >
> > Sure. Who is volunteering?
> 
> Ugh, apparently I am. :-)

;-)
 
> If the q.* utility functions are staying in QtCore, nothing needs to be
> said about them. So, we need one small PSEP for renaming and moving
> pyqt.* to PySide.Qt as well as another one for dealing with the streams.
> Or maybe two separate ones for the streams, one for removing the
> QTextStream utility functions from QtCore namespace and one for defining
> the QDataStream changes?
> 
> The pyqt.* renaming and QTextStream cleanup PSEPs sound simple enough
> "administrative tasks" for me to take but I'm not sure whether I have a
> deep enough view about the QDataStream changes to author that one...
> 
> > I'd prefer them to be Qt.signal and Qt.slot. People could still use the
> > bare names by doing: from Qt import signal, slot, but for those who
> > prefer to avoid from-style imports I think Qt.signal and Qt.slot are
> > nicer.
> 
> Yes, makes sense. This approach would also avoid the problem of possibly
> overloading the signal and slot function names in future Qt versions.
> 
> > Unfortunately PyQt also has
> >
> >      QDataStream.writeString()
> >      QDataStream.readString()
> >
> > which only writes/reads a QByteArray!
> 
> Couldn't be write unicodes/strs with the same writeString method? For
> reading, something else should obviously be invented.

Hmm, I guess you could do this:

    QDataStream.writeString(obj)
        # writes a QByteArray if given bytes or bytearray in Python 3,
        # or a str in Python 2
        # writes a QString if given a str in Python 3 or a unicode in
        # Python 2

    QDataStream.readString() -> obj
        # returns a bytes in Python 3 or a str in Python 2 if a
        # QByteArray was written
        # returns a str in Python 3 or a unicode in Python 2 if a
        # QString was written

I should think it would be straightforward to implement... not
particularly nice to document or use though?


-- 
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

Reply via email to