[PyKDE] kdepyuic modifications

Danny Pansters danny at ricin.com
Sat Feb 11 20:15:02 GMT 2006


On Saturday 11 February 2006 13:15, Mikhail Yarmish wrote:
> At the moment kdepyuic doesn't make import of kde widgets. I've modified
> it for myself to do that imports. At the moment it do import just for
> kfile widgets but if somebody needs such upgrade I'll finish it for
> fully support of all modules. So what do you think guys?

I haven't had any need for this (only really used kdecore and kdeui), but the 
idea seems good.

I'd suggest instead of using kfile = [ long, list, that, may, often, change ] 
to get as many of them automatically and suited for the version/environment 
that kdepyuic is actually being run on, for example:

import kfile
mods = []
for item in dir(kfile):
    if not item.startswith("__"):
        mods.append(item)
    if item == "KNotify":
        for thing in dir(kfile.KNotify):
            if not thing.startswith("__"):
                mods.append(item + "." + thing)
mods.sort()

If you'd put this into a larger loop that iterates over all modules you're on 
your way to a general script that's more maintenance-friendly.

Small nitpick: I don't know about about the others but I find it easier to 
read a (unified) diff instead of the whole edited script, to see what the 
changes are ('diff -u oldfile newfile > mydiff').

Dan




More information about the PyQt mailing list