[PyKDE] kdepyuic modifications
Jim Bublitz
jbublitz at nwinternet.com
Sun Feb 12 07:51:09 GMT 2006
On Saturday 11 February 2006 22:53, Mikhail Yarmish wrote:
> Danny Pansters wrote:
> >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()
> Thx! That seems much more nice. I didn't know that such way is possible
> because I'm quite new to all this =)
KNotify is a namespace, so the "if item == KNotify" block isn't needed - the
first "if" will pick it up correctly (in the original you only needed to
include KNotify on the list, not any of KNotify.*)
Also (being really picky), in the original checkModule function you have:
moduleImport = ""
<other code>
if moduleImport != "":
return moduleImport
else:
return ""
The "if" isn't needed - you can just return moduleImport and have the same
result.
> >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
>
> Do you mean that process of your coding is like:
> - create an ui in designer;
> - make py file from it and put some changes there;
> - make diff between clean and with changes py files;
> - make some changes in ui file;
> - create new py file and patch it with your diffs.
> ...
>
> Have I understood right? That works without problems?
I think he means that rather than (or in addition to) including the entire
rewritten kdepyuic program, include a diff of the original any your modified
version. I don't do much with kdepyuic (and Hans-Peter Jansen did the last
rewrite), so I didn't see immediately what you were adding/changing. Looks
like a good idea to me.
In other words, do
diff -u kdepyuic.old kdepyuic > kdepyuic.diff
where .old is the current version and the second file is your new version.
If you want to do some rewriting and then submit the patch (or the complete
version), I'll be happy to include it in PyKDE. You'll need to be certain it
works correctly though, as I don't use kdepyuic or Qt Designer much and have
a poor history producing a correct version of kdepyuic myself.
Jim
More information about the PyQt
mailing list