Saturday, March 04, 2006

Lightning Compiler and RUR-PLE update

Both Lightning Compiler and RUR-PLE have been updated. Lightning Compiler (L.C.) has been refactored to make it easier to be incorporated inside another program (like RUR-PLE). I have added a sample application that shows how to import L.C., using a different layout for the buttons.

RUR-PLE has changed internally quite a bit. I now use ".po" files for string translations instead of the idiosyncratic approach I was using. Previously I added a python file for each language, containing a series of variable assignements like:
USER_STOP = "You stopped me!"
USER_STOP = "Vous m'avez arrêté!"
and I would invoke the strings through something like translation.USER_STOP.

Now, I use the same method as the gettext approach, i.e. something like
_("You stopped me!")
with the translations stored in .po files. More than 100 strings had to be changed in some 14 different files. Other "minor" changes had to be made as well... all very tedious, but it seems to be working ok. I wrote my own ".po" interpreter instead of compiling the files to ".mo" format and using gettext, as this seems to give me a better control over the encoding. A similar project (Guido van Robot) is using gettext and baffling encoding problems seem to be surfacing from time to time.

Three other significant changes were made to RUR-PLE:
1. a program can be run without being saved first. This was inspired from reading a post by Ted Leung
2. The dialog that appears after a successful run now disappears on its own after two seconds, instead of requiring the user to click a button. This was suggested in a comment left on this blog.
3. The embedded Python editor has been replaced by Lightning Compiler. I had to draw a whole bunch of images to use for the buttons; artwork is not exactly my forte, but it will have to do for now. A consequence of this new embedding has been a more consistent choice of color used in the embedded Python interpreter as well; the same basic coloring is used in the Python editor, the "robot editor" and the interpreter.

Unfortunately, I had to write new strings... which are neither translated in Spanish (help!) nor in French (my own laziness).

I am seriously considering embedding a turtle graphics page within the app; this would be using the same format as the robot world page: an editor on the left, a canvas on the right, and the program is executed by clicking on a button. However, this is a major change and will probably have to wait after version 1.0 has been released (RUR-PLE is at 0.9.7 currently!). I will soon have to learn about using, pyexe and inno installer, as version 1.0 probably should be a one click install affair. I might have to learn how to install it in a multi-user environment, with some common directory for the basic app and separate directories for each user-written programs... Suggestions as to the best way to do that are more than welcome!