[wxPython-dev] img2py script

Anthony Tuininga anthony.tuininga at gmail.com
Mon Nov 26 11:13:39 PST 2007


> > 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.

I would agree that images is too generic but I couldn't think of
anything reasonably short that would do. I was thinking that perhaps
additional items would be added to the module as time passed but in
the meantime people might be confused.... I'll use your suggestion
unless I hear that you've changed your mind. :-)

> > 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.

Ok. I'll ignore the demo's images.py and throbImages.py since both of
those are generated by encode_bitmaps.py. That eliminates the majority
of the changes that are needed.

> > 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.

Sure. I'll look around for something suitable to use as a template. If
you have something specific in mind, please let me know.

> 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.

Sure. I assume that you'll indicate somewhere that those command line
arguments are deprecated and the values are now ignored. I'll modify
the description of the command line to indicate as much anyway.


> Let's do a 4 space indentation of the data strings instead of 8.

Ok. I did 8 as it is a continuation of the previous line but 4 does
shorten the number of lines further.

> 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

Sure. No problem.

I'll make these changes and then submit them as a patch. I'll create a
second patch for wx.lib and a third patch for the demo, ignoring
images.py and throbImages.py as discussed above. Once the first patch
is accepted then I can finish off the other two -- unless you want
them all at once? The reason I am thinking of separating them and then
waiting is that any changes you decide to make to the first patch may
affect the other two. I'll do one or two changes just to make sure the
first patch is indeed working, of course. :-)

> --
> Robin Dunn
> Software Craftsman
> http://wxPython.org  Java give you jitters?  Relax with wxPython!
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: wxPython-dev-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-dev-help at lists.wxwidgets.org
>
>




More information about the wxpython-dev mailing list