2008-01-05

Clips Wine Demo using wxPython

I finally got enough free time to finish the wxPython Wine Demo I found last week. At first I wanted it to be, more or less, a line by line re-write of the Java version (ClipsJNI) but that turned out to be too difficult in the end.



Instead, I've tried to do as little "over all" damage as possible.

I didn't make the GUI 100% the same because that would have required too much wxPython specific code (and the point is not to show off wxPython anyway). I've also had to make a small change to the Clips code. It turned out that pyClips had trouble converting a MultiField return value containing Fact Addresses, so I added a function that instead returns the Fact Indexes.

Last, but not least, I designed the GUI using a wxPython XRC editor. That way I didn't have to write all that boilerplate GUI code to create, add and configure all of the widgets in the application.

I have kept the code for asserting facts exactly as in the ClipsJNI example even though that's not really the way to do it in Python.

All of the above are things that have been added or more complicated in Python/pyClips but there are other things as well. Things that could have been done easier. For example, there's no point in sorting the Facts in Clips, that can be done automatically in the ListCtrl widget (if you want).

The code is here. At least for now, I'm hoping it can be hosted on SourceForge together with the pyClips project but that's up to Franz so I'll have to wait and see what he says first. If you find any bugs or have any other comments, please let me know.

Enjoy!

Inga kommentarer: