[PyKDE] PyKDE and libkdegames

Jim Bublitz jbublitz at nwinternet.com
Thu Jun 13 18:54:00 BST 2002

On 13-Jun-02 Michael Lauer wrote:
> Am Mon, 2002-06-10 um 18.53 schrieb Jim Bublitz:
>> I have some semi-automated tools to do it,
>> but they only generate about 80% - 90% clean code and require a
>> lot of manual touch-up. 
> Sounds very interesting - could you publish these tools, please?

The short answer has always been "I'd rather not" - mostly out of
embarassment (it's a terrible hack). I'd considered at one time
setting this up as a separate project but it really requires other

The negatives of this "software" are:

- it requires PyKDE to run (it's in Python), and therefore Linux
- while it naturally reads and writes files, internally the
lexer/parser take their input and write their output to KEdit
widgets (makes it somewhat IDE-like, can edit files on the fly and
even search/search and replace)
- the parser is handwritten and very convoluted
- even worse is the code that merges a newly parsed h file with a
previous version of the same sip file (does versioning)
- it's buggy (doesn't handle enums in namespaces correctly, doesn't
version enums correctly, sometimes doesn't version anything
correctly, sometimes fails to match identical methods across
- doesn't create sip-in files correctly (might get close though)
- requires manual input (mostly point and click though)

As I haven't run it in a month or so, there are probably more
problems I'm forgetting, however it takes a lot less time to fix
the output from this program than to generate sip files manually.

That said, it does most of what's needed to create a basic sip
file. Most importantly, it strips variable names  and adjusts names
for objects in namespaces correctly which is extremely time
consuming for things like kparts and kjs, and it does versioning of
sip files, given an existing sip file and new h file. It isn't
(AFAIK) Qt or KDE specific as far as actually generating sip files.

What it needs:
- it would probably work better with an actual tokenizer and parser
(there are a number available in Python). It only needs a grammar
for h files (and sip files, which is more or less a subset), not all
of C++. Unfortunately I'm not knowledgeable in this area at all.
- it would be desireable to have it generate everything, including
configure and make files (some of that gets done, but not enough)
- bug fixes, of course
- documentation
- it could be extended to generate some basic %MemberCode from user
- it could be adapted to Windows (KEdit->QMultiLineEdit). I
probably used a lot of KDE widgets (KTabCtl, KLED, KListBox,
KDialog, etc), but that wouldn't be too hard to change. The logic
and GUI are mostly separate. I don't have a Windows based computer

In general, this is your basic "I needed something simple so I
threw it together in a couple of days and then kept adding more
features" hack. Originally I just wanted to strip variable names

After all that, if anyone still wants to play with it, let me know
and I'll write up some simple instructions and mail it off to you.
If after looking at it, some one wants to set up a project and go
with it, I'm all in favor of it. The entire thing (py/pyc and some
unnecessary files) is about 350K untarred, so a basic tarball
should be easily mailable. It'll take me a few days to write some
usage instructions and do a tarball. The license will be GPL unless
someone convinces me otherwise.

At the moment I simply don't have the time to work on this or
co-ordinate a project, but I'll be happy to answer any questions.

If anyone is interested, let me know.


More information about the PyQt mailing list