Writing specialized text editors in wxPython

So again, a lick and a promise for this blog as I madly try to finish some translation work. This translation job is an interesting one, though, as I mentioned, and as it turns out, amenable to editing in a specialized tool I just wrote today. Of course, having written the tool today means I have to use the tool this evening in a mad dash to finish, which in turn means I have no time to document the code until tomorrow at the very earliest.

Suffice it to say that the exercise was surprisingly easy. The task was simple: I need a tool to edit text files in which (for reasons we'll go into later) I have a number of phrases, one per line. The phrases mostly have all the right words in them, but not in the right order. I thus need a way to quickly select one or more words and drag it into the right place in the phrase. Sure, you say, Word does that. Yeah, except that Word doesn't put the spaces in the right place. God and Bill Gates alone know why, but Word doesn't put the fricking spaces in the right place when I drag words around on a line, and so I took matters into my own hands and rolled my own solution. And by God it works! Still a few little oddities in it, but it works more quickly than Word for this particular application.

Another nice thing it can do is this: when I drag the first word of a phrase out into the middle, it can decapitalize that word, and capitalize the new first word. That saves me a fraction of a second, and multiplied by 2000 phrases that adds up to a lot of time.

And another little thing I just now added: I can hit a key and toggle the case of the word the cursor is on. Again: this may or may not be of general use, but for this particular application it's very convenient. And that's really the idea of special-purpose text editors. An example from the programming world is emacs -- you can write LISP code to make emacs do literally anything at all (including psychoanalysis) from your text editor. The only problem being that it's too damn hard to start. Python's easier, at least for me. So a text editor in which you can embed your own Python snippets might be a generally useful tool indeed!

So. Tomorrow or Sunday, documentation and maybe some more movement on the drop tagger. And in the meantime, go get some sleep! (I know I won't any time soon.)






Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.