[PyKDE] Call for ideas - more operators for Qt Widgets

Hans-Peter Jansen hpj at urpla.net
Thu Aug 14 11:09:00 BST 2003


Hi Torsten,

On Wednesday 13 August 2003 16:31, Torsten Marek wrote:
> Hello pythonistas,
>
> in agreement with Phil, I want to ask YOU what operators you want for
> Qt widgets in PyQt.
> By now, all reasonable operators for QPoint, QRect, QString, QSize,
> QRegion and QWMMatrix have been implemented and are in the current
> snapshots or still under testing, so please do not recommend any of
> those classes. This refers to most of the equality testing operators
> available in Qt, too

These are really good news. Especially on geometry() handling, I missed 
the __getitem__ operator since started hacking with PyQt in sections 
like:

    def saveGeometry(self):
        r = self.geometry()
        if self.cfg.saveLayout:
            self.cfg.mainScreenSize = [r.width(), r.height()]
        r = self.frameGeometry()
        if self.cfg.saveLocation:
            self.cfg.mainScreenLocation = [r.x(), r.y()]

    def RestoreGeometry(self):
        wh = self.cfg.mainScreenSize
        if wh:
            self.resize(wh[0], wh[1])
        xy = self.cfg.mainScreenLocation
        if xy:
            self.move(xy[0], xy[1])

Without __getitem__ support, those are neither pythonic, nor intuitive.
And pythons familiar density is missing here, too. In fact, that's one
of the confusing issues for wxPython converts (disregarding the way 
Robin Dunn has implemented this with a significantly patched but pretty 
outdated swig version, causing major headaches for any packet 
builders...).

> The question is: In which classes do operators make sense, improve
> the intuitiveness/handling and keep the "spirit" of the original Qt
> roots? 



More information about the PyQt mailing list