Category Archives: programming

Tiny script/software idea: A better use for Caps Lock

How many times have you written something in the wrong case? Not just IN CAPS because you happened to touch the much-maligned Caps Lock button, but sometimes you just slip on the Shift button – and sometimes you need to deal with stuff other people have written.

How about this:

When no text is selected, the Caps Lock button works normally. Or it’s set to do nothing, whatever. Noone uses the damn thing anymore anyway.

BUT, when text is selected, each press of the button cycles the selected text in some user-defined fashion. The simplest config would be just CAPS->nocaps (and then back to CAPS). Slightly more sofisticated: CAPS->Sentence->nocaps… Or whatever.

So, for instance, if I selected the following text:

OMG FFS LAME A$$ NOOOOOOOBS

And pressed “Caps Lock”, then it would become:

omg ffs lame a$$ noooooobs

“Sentence case” sould of course be able to simply use periods, question marks etc to see where one sentence ended and another began.

All I need is to find a way to get a Python program to run in the background, take over Caps’ functionality, and manipulate selected text. Heh.

Geek-o-Rama; The search for a wxWidgets IDE

These past few days, I’ve been searching for a competent IDE for creating WxWidgets interfaces, primarily for the Python programming language. The reason for this is that I’m working on a small project to get my creative programming-juices flowing again – Tempest’s on its way, but I needed some kind of “learning” project in order to get my Python programming skills up to “moderately skilled” level before I tackle the continuous challenge that is Tempest. This new project of mine is a managing software for the PSP – most, if not all, of the managers out there are too limited or just plain too buggy for my tastes. The project is going well – I wrote a couple of functions that decode the PSP’s various files to get info like savegame details or PNG files, and now I mostly need – the interface.

Anyways, here are my results (windows software only):

FarPy GUIE

Pretty neat and very user-friendly, outputs Python code – but in striving for usability it leaves out all kinds of advanced functionality, like Spacers – and Spacers are absolutely necessary if you need your inteface to have a scalable window.

Boa Constructor

From what I’ve been told, the best and the greatest. I hate multi window layouts in software, and the inteface of Boa Constructor is very, very advanced – and incredibly klunky. Here’s an interface that does it all when it comes to Python programming, but the interface makes everything extremely painful. I’m sure the software is mightily powerful, but it’s just not for me. Next!

Visual Wx

One of the better ones. Has a bad habit of naming controls and refusing to let me rename them to stuff I can actually remember, and the visual display of what I’m working on sometimes doesn’t update correctly. Has rudimentary support for custom components, but nothing fancy. Some weird graphical bugs, rather ugly buttons and complete lack of help files for the actual interface lowers the score. Supports XRC input/output, which is always nice. Interrestingly, importing some XRC’s from wxFormBuilder actually makes the prog crash and some stuff seems to not import correctly… Can generate code for Python, C++, Lua, Perl and Ruby (=impressive) but the same project cannot, as far as I can tell, export to multiple languages. If you created a Python project, then it is and always will be a Python project.

WxDesigner

Non-free editor, and it kinda shows. Pretty sleek interface, does its job and does it well. The main problem here is its lack of custom components – I need a special version of BitmapButtons, and it’s not supported. Why don’t more of these have a module-based structure? Anyways, WxDesigner supports C++, Python and Perl, and as far as I can tell, the same project can be used to export multiple kinds of code…

wxFormBuilder

Excellent in terms of interface and usability. Easy to use, and relatively complete in terms of functionality. There are no help files or support for custom controls, but there’s a moddable structure and though it can’t export directly to Python, it does generate XRC files. One very suprising and excellent interface feature is that every control and property are explained in a small box – no more checking the online manual to find out what WX_WHATEVER does…

Anyways, having done this research and tested every wxWidgets IDE from here to eternity, I decided, in the end, to use the XRC  intermediary format for my UI needs, which meant choosing wxFormBuilder. It had the best interface, creating stuff really is a breeze compared to, say, WxDesigner. And it’s free. The XRC format provides another clear advantage: I can work on the core functions and the GUI stuff separately, and as long as certain core stuff remains the same – the names of certain forms and events – I can work freely on one without bothering with the other. This also makes it possible for possible future users to create their own user interfaces if they think mine suck, and it also makes it more sensible to create “placeholder” purely functional interfaces to test the core functions, and only later caring about aesthetics.

I’ve also done some new research when it comes to crossplatform programming languages and their respective executable/runtime sizes. Java’s too big, FreePascal too much of a hassle (and it produces 11-13 mb EXE’s)… Well you know, the usual list. FreePascal was the only real newcomer, and it fell seriously short despite being based on one of the first programming languages I ever learned (Turbo Pascal 6). C++ is really the only contender to Python, and I simply find Python to be more intuitive, if slightly slower. No matter, processing speed really isn’t an issue in most of my projects. Perhaps I’ll learn C++ some day – after all, wxWidgets exist for C++ as well, which means my XRC files will work even if I change programming language (how cool is that?).