[wxPython-users] help with ThumbnailCtrl
Brad Allen
brad at allendev.com
Wed Apr 4 16:58:02 PDT 2007
At 7:15 AM -0800 3/21/07, Phil Mayes wrote:
>
>Attached is a thumbnail browser that caches its images in a single
>file, thus avoiding littering the tree with thumbs.db. Downside is
>that it slows if the maximum is too big. It uses pickle, so no DB
>installation is needed.
Phil, thanks for providing that example. I was able to use the same
idea and get a big performance gain, though I discovered something
that you might want to try. In pickle.dumps, I found that using
protocol=2 as one of the parameters made reading the pickled data
dramatically faster. (you have to open the file for writing in binary
mode in order to use protocol=2, as in file(filepath, 'wb').
My subclass of ThumbnailCtrl is now reading the pre-cached thumbnail
files into a dict in RAM and checks it before reading from the
filesystem. That saves it from having to decompress the TIFF and
create the thumbnail, at the expense of taking up more disk space (we
will delete the fat thumbnail file during the archiving process).
I don't know if this approach is useful to anyone else, since it is
mainly adapted to the specific business need we have in this project.
The caches are not created in the wx application or in ThumbnailCtrl,
but are generated as incoming faxes are processed. However, if anyone
is interested let me know...
More information about the wxpython-users
mailing list