[wxPython-dev] img2py script

Robin Dunn robin at alldunn.com
Thu Dec 13 14:25:47 PST 2007


Anthony Tuininga wrote:
> On Dec 10, 2007 11:53 AM, Robin Dunn <robin at alldunn.com> wrote:
>> Anthony Tuininga wrote:
>>> Hi, I believe you've been a little busy lately with the latest release
>>> of wxPython but I was wondering if you'd had a chance to look at this
>>> at all?
>> A little bit so far, hopefully I'll get to it in more depth this week.
> 
> Sure. I'm in no particular rush so long as it does get done eventually. :-)
> 
>>> I'm still waiting before modifying the demo. I've noticed a
>>> few other places that could use the same treatment (like Editra and
>>> XRCed) which I can also change if that is desirable. Let me know.
>> Yep, the less work for me the better.  ;-)
> 
> Then I'll do that after I've heard from you about the base code.

Just noticed a problem...  If the image name is not a valid Python 
identifier then img2py can generate bad code.  For example, in 
throbImages.py we end up with this:


001 = PyEmbeddedImage(
     ...
     )
index.append('001')
catalog['001'] = 001
get001Data = 001.GetData
get001Image = 001.GetImage
get001Bitmap = 001.GetBitmap

I think we should still use the given name for the index and catalog, 
but there needs to be some sort of name fixup for the instance variable 
name if it would cause a problem like this.  Maybe prepending a "_" if 
the name starts with a digit, and also something needs to be done if 
there are non-ascii characters or spaces in the name.


-- 
Robin Dunn
Software Craftsman
http://wxPython.org  Java give you jitters?  Relax with wxPython!




More information about the wxpython-dev mailing list