Python Programming, news on the Voidspace Python Projects and all things techie.

#18

Computing Articles

I've edited the articles page to include links to the other computing related articles on Voidspace.

On the subject of which, I've just completed a page on the new Plugin System for Firedrop. Hopefully this will be the first of a series of docs for firedrop.

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2005-04-01 18:09:29 | |

Categories: , ,


#17

Playing with a Panda

Now Python is good... we all know that, but there are some things where it's not necessarily the best option. Obviously if you were writing a commercial quality 3D game or virtual reality environment then you wouldn't use python.

A while ago I saw another (or is that yet another... ?) C++ engine that promised commercial quality 3D control and effects under the auspices of Python. This one looked like it might live up to it's claims because :

  • it was being created by Disney
  • they were actually using it to produce a commercial product
  • it was being written specially for Python, rather than being a Python binding to a separate library

For many years I've had a hankering to choreograph morphing objects as they dance to the beat of mathematical formula. No serious intent - I just think it would be quite a trippy thing to do. I eagerly downloaded Panda3D and the example game 'airblade', only to find that the whole thing threw up a host of bizarre warnings and errors and died unceremoniously. Not only that but there were no configuration instructions. When I gave up (after not a lot of effort) and uninstalled it, it left several environment variables hanging around pointing to now non-existent directories. I wasn't over impressed.

Anyway - several months later (i.e. today) I accidentally stumbled across the website again - http://www.panda3d.org I think. They've got a 1.0.0 release, lots of documentation and even apologise for the previous version that didn't clean up after itself. I decided to give it another try. I installed Panda3d (which has Python 2.2 built into it rather than using your own install) and unzipped airblade. Rather than do anything rash like read the instructions I just fired up airblade to see if it would work... well I still get a load of warnings (I don't think the audio worked at all) but airblade runs... and it's really a visual treat. Very impressive.

I'm still not sure if it will handle the shading and ray trace like effects that I'm after. It's optimised for more game oriented type code. More importantly I'm not sure what format it expects the 3D objects to be in - I need to check if they can be generated/edited with open source tools. Despite this it's a fantastic looking system. It's always nice to see Python making headway in situations you wouldn't necessarily expect. If it's a while since you've looked at Panda3D I can recommend checking it out again.

Update: although they've written extensive docs, they don't come with the distribution. This is a pet hate of mine. As I don't have internet here I won't be able to check it out until tomorrow.

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2005-03-31 18:59:44 | |

Categories:


#16

Published at Last

Well they've published my book.... not quite :-) But at least my free copy of the Python Cookbook 2 has just arrived. It's got three recipes of mine in it.I didn't have much time to look at it yesterday but it looks like a very good book.

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2005-03-30 09:52:26 | |

Categories:


#15

Playing With Firedrop

A lot of my Python effort in the last couple of days has been with Firedrop. FireSpell the SpellChecker is now working great. I've even dug into the wxPython demo and used a rich TextBox to get the current word highlighted. It uses wx.TextAttr and looks very nice. That's the beauty of using wax [1]. Wax itself is even easier than Tkinter, but because it's built on top of wxPython it doesn't have the same limitations - in fact the sky's the limit.

Wax is limited by its lack of documentation - something that Hans is trying to address. Since working with Hans on the plugin system I'm hoping to get round to addressing the same problem with Firedrop. I've written a few useful plugins now, at least two of which ought to be included in future releases of Firedrop. I've also nearly finished documenting the plugin system. I'd like to extend this to better documentation on the templates too.

Firedrop has one of the nicest templating systems I've seen. I've looked at things like Myghty and Cheetah - both of which have their qualities - but the Firedrop system is just straightforward :-)

There are one or two other bonuses in Firedrop. I've added Python source colouring to the menu (using colorize.py from MoinMoin - which Hans gave me). It works nicely, and with the addition of a 'reST Raw' option, the output HTML can be integrated very nicely into a reST weblog entry. Adding these new menu options was as complex as adding the following code to textmanipulator.py, and adding the menu options in mainframe.py :

def colorize(self, text):
        """
        colorize python source code.
        """

        if not col:
            return text
        p = col.Parser(text)
        p.format(None, None)
        src = p.getvalue()
        src = src.replace('\n', '<br />\n')     # XXXX will this mess up '\r\n' ?
        src = src.replace('  ', '&nbsp;&nbsp;')
        return src

    def rest_raw(self, text):
        """
        Embed a chunk as raw HTML (and indent it)
        """

        lines = [('    ' + line.rstrip()) for line in text.split('\n')]
        lines.insert(0, '\n.. raw:: html\n')
        return '\n'.join(lines) + '\n'

I'm hoping these will be included in the standard Firedrop distribution as well. colorize.py needed a minor adjustment - it used cStringIO which wasn't unicode compatible. Once I changed that to plain old StringIO, everything was hunky dory.

The idea of all this work is that it makes the blogging tool nicer and more effective. It's certainly doing that - I'm really enjoying using Firedrop - but as always I wonder if this coding hasn't become an end in itself, rather than a means to an end. I feel like a carpenter who spends all his time working on his tools. He's got great tools - but never actually makes anything. Having said that, I'm very happy with the recent changes to Voidspace and am looking forward to seeing them continue. If you want to know what I mean, check out the Sitemap.

[1]The GUI system by Hans Nowak, the author of Firedrop.

Like this post? Digg it or Del.icio.us it.

Posted by Fuzzyman on 2005-03-27 23:41:16 | |

Categories: , ,


Hosted by Webfaction

Counter...