[wxPython-dev] img2py script
Robin Dunn
robin at alldunn.com
Mon Nov 26 10:46:53 PST 2007
Anthony Tuininga wrote:
> On Nov 20, 2007 1:01 PM, Patrick K. O'Brien <pobrien at orbtech.com> wrote:
>> On Nov 20, 2007, at 1:35 PM, Anthony Tuininga wrote:
>>
>>> Unless I hear otherwise I'll assume that patches against the 2.8
>>> branch work for you. I'll send one further e-mail with a link to the
>>> tracker when I've got something I think is worth looking at. Thanks.
>> This will be a nice improvement to this script. Thanks for taking
>> this on, Anthony. :-)
>
> You're welcome. Now I understand why you wanted to thank me in advance... :-)
>
> I created the basic module for the embedded images (see attached),
> modified img2py.py from the tools subdirectory, modified all of the
> wx.lib modules that used the old technique and started on the demo.
> I've got a few dozen files changed already, some of them large. I was
> planning to simply dump everything on one patch but perhaps this needs
> to be split further? I'd like some direction here before I spend a
> great deal more time on it.
>
> First of all, I've named the module
>
> wx.lib.images
>
> and the name of the class is PyEmbeddedImage as suggested by Robin.
> I've tested this on a number of things and it appears to function
> fine.
I think the module name is too generic. It sounds like it contains
images, not a class that can be used to embed images. So let's call it
wx.lib.embeddedimage, unless you can think of a way to shorten that
which still makes sense.
>
> This module and wx.tools.img2py (see attached diff) can be checked in
> independently of all of other changes. Since some of the other changes
> are rather large it may prove simpler to simply give me (temporary)
> SVN write access or for me to send them directly to someone else
> rather than use the tracker. Some of the diffs are quite large (the
> images.py in the demo is over 1 MB).
There's no need to make a diff for the demo's images.py, since it is
entirely generated. Just make sure that the encode_bitmaps.py script
still works, or patch it so that it works with the new tool. If you
still end up with something that is too big then you can send the
patches directly to me.
>
> I'd also appreciate any feedback on the two attached files as they are
> the basis for all of the other changes in wx.lib and the demo. Thanks.
>
I'd like to see at least a module and a class docstring for the library
module.
It would be nice if -u was still an accepted command-line arg (but
ignored) so people's existing scripts won't be broken. You can also
remove -i from the usage string since the class always provides the
GetIcon method, but if -i is given it could just be ignored like -u.
Let's do a 4 space indentation of the data strings instead of 8.
Instead of putting the image objects directly in the catalog, make the
object first, and then add that to the catalog, so it can be accessible
both ways. For example:
Mondrian = PyEmbeddedImage(
"iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAA"
"AHFJREFUWIXt1jsKgDAQRdF7xY25cpcWC60kioI6Fm/ahHBCMh+BRmGMnAgEWnvPpzK8"
"dvrFCCCAcoD8og4c5Lr6WB3Q3l1TBwLYPuF3YS1gn1HphgEEEABcKERrGy0E3B0HFJg7"
"C1N/f/kTBBBA+Vi+AMkgFEvBPD17AAAAAElFTkSuQmCC")
index.append('Mondrian')
catalog['Mondrian'] = Mondrian
--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!
More information about the wxpython-dev
mailing list