ActiveState Powered by ActiveState

ActiveState Community


Komodo Header extension

Posted by iodboi on 2007-04-20 08:17
OS: All / Any

Hi all,
Here's my entry to the contest. Just a little macro that pops a banner at the top of your code in Komodo. More details can be found http://www.iodboi.co.uk/KomodoHeader.html. A toolbox package is attached.

KomodoHeader:
This is a little macro for Activestate’s komodo IDE. It inserts a configurable banner into a code file if one is not already present, and updates the banner if one is. It does things like automatically insert and update filename, modification times, user who made the modifications, music that is playing (for ITunes on OS X anyhow) and will probably do more in future.

It was written to replace similar macros I had for emacs and the eric3 IDE as I find this functionality very useful - I put the code up here as some other folk may find it useful also.

It is written in python, works for both komodo 3.x and 4.x beta’s but at present it has only been tested on a Mac (if you use it on another platform and it doesn’t suck let me know and I’ll add to the list). It’s only really been tested for python programs, other language support will appear soon.

Usage:
Double click the macro in the toolbox (or press cmd-shift-h), if no header is present it will insert one at the top of the file, if one is it will update it.
Configuration:
If you want to change the static parts of the header right click the macro and goto properties. You will then see the python code which you can edit to suit your needs. If you want to alter the look/layout then you may have to hack the code a bit more.

AttachmentSize
KomodoHeader-2.kpz7.91 KB

Dereckson | Thu, 2007-04-26 03:53

Hi :)

Your extension is cool, and useful to everyone, regardless the language you code or the functionalities you need.

A little bug when I've tested it on Komodo 4.0.3, Windows Server 2003, I've got this error when I double click on KomodoHeader0.2 :

Traceback (most recent call last):
  File "C:\Program Files\ActiveState Komodo IDE 4.0\lib\mozilla\components\koProject.py", line 2599, in evalPythonMacro
    return eval('_code()', macroGlobals, macroGlobals)
  File "", line 0, in ?
  File "", line 42, in _code
AttributeError: 'module' object has no attribute 'uname'

os.uname() is a UNIX method, not implemanted on Windows.

Another idea to detect OS ?

Dereckson | Thu, 2007-04-26 04:03

Er ... another thing, 2/3 of my files and projects are coded in ISO-8859-1, not in UTF-8.

So, do you know how tell to your macro to write Sébastien and not Sébastien ?

Sorry to have an accent in my first name.

iodboi | Thu, 2007-04-26 15:30

Thanks for the feedback :) I will fix the issues you highlighted and put out a new version. I'm not sure how the 'rules' of the contest deal with this (other than giving me minus marks for sloppy coding!!). So I will post in this thread when the new version is available from my website.

Thanks again!

Dereckson | Fri, 2007-04-27 05:22

Hey, don't worry, you're well started for the 2nd place it seems :D

--
Sébastien Santoro
www.dereckson.be

iodboi | Fri, 2007-04-27 07:35

OK the os.uname bug has been fixed - replaced with sys.platform (which is what it should have been from the start....). As for the codepage encoding question - I'm not certain its a komodo header problem - I input your name (with the accent) into komdo header's 'author' variable and it was entered into the source code correctly. I would check the encoding you are using in komodo's preferences (Komodo->Preferences->Internationalization->Language specific default encoding.). Make sure you set it to a charset that can deal with the chracters you need (UTF-8 or ISO-8859-1). Shout if there are still issues.

A new version and changelog have been uploaded to http://www.iodboi.co.uk/KomodoHeader.html .

I doubt this new version can be used in the contest so if you are voting, I'd say vote on the 0.2 release not the 0.3 (though 0.2 doesn't work on Windows !!!)

Direct link: http://www.iodboi.co.uk/KomodoHeader_files/komodo_header_0.3.kpz

-->