Re: Class hierarchy for thumbnailctrl
Andrea Gavana <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <CAEf70byE9pyefpDww5mbBVwHbfD-SiUe6zgOnbtBWvrJAD+kZg@mail.gmail.com> |
Hi, On Tue, 8 Sep 2020 at 18.45, Michael Eager <[email protected]> wrote: > On 9/5/20 10:31 PM, Andrea Gavana wrote: > > > Hi, > > > > > > On Sat, 5 Sep 2020 at 23.24, Michael Eager <[email protected] > > > <mailto:[email protected]>> wrote: > > > > > > Can anyone explain why this is being done? It would seem cleaner > (and > > > definitely more understandable) to have ThumbnailCtrl inherit from > > > ScrolledThumbnail and Panel. > > > > > > It’s been a long time since I’ve looked at the ThumbnailCtrl code, but I > > > don’t think there is any issue in changing the implementation so that > > > ThumbnailCtrl inherits from wx.Panel and ScrolledThumbnail. I agree it > > > would be much neater that way... > > > > > > If you can put together a pull request and see if things work correctly > > > I’m pretty sure Robin will consider it for merging. > > > > > > Andrea. > > > > Hi Andrea -- > > > > I've been looking at thumbnailctrl.py in more detail. > > > > There are some problems with the control. Setting the Zoom factor > > doesn't do anything; the _zoomfactor value is never used. Zooming with > > the + or - key doesn't appear to have any affect. > It should, or at least it did in wxPython Classic. See the methods ZoomIn and ZoomOut - they don’t rely directly on the _zoomfactor attribute, they rather call GetZoomFactor. Have you tried setting the focus on the ThumbnailCtrl via mouse click and then use the mouse wheel (with the Ctrl Key pressed) using the + or - keys. > > > I have the impression that thumbnailctrl.py is an app trying to > > masquerade as a control. It does more than just display thumbnails in a > > window: it reads a directory, sorts the files by name, displays a > > combobox with the path, deletes files, maybe more. This makes it much > > less flexible as a control, for example, if I want to display thumbnails > > in a different order, or supply images to be displayed, rather a > > directory. Some of these features, like displaying a combobox with the > > path, could easily be done in an app which used a simpler thumbnail > > display control. I’ve already heard this remark/critique about ThumbnailCtrl, and I believe it’s a valid point. That said, I am not that much involved in the development of wxPython anymore, so until someone steps up and modify the control to make it more generic/less app-style I guess it will stay as it is. > > > > There are comments about the control not knowing how to display certain > > file types, like mpegs. I would also like to be able to display > > thumbnails for files like PDFs or text files. It seems to me that > > rather than include in the control the knowledge of how to do this for > > many different files, that images should be provided by the caller, > > perhaps through a callback routine, with a default for the common image > > types. > That’s a very good idea and I don’t think it would be so complicated to add. Maybe start by looking at how the PILImageHandler is used as a handler to create bitmaps - and then modify the file filter to use other extension types. > > > There a lot of good code in the control, especially the layout and > > resizing. I was trying to figure out how to do the layout using grid > > sizers, which seemed convoluted. > > > > What would you suggest? > I suggest you not to go the sizer route: if you have many thumbnails, resizing and zooming is going to be a pain flicker-wise. If you can re-use the layout logic and draw the thumbnails yourself that would be the best approach altogether. Andrea. > > > -- > > Michael Eager > > -- You received this message because you are subscribed to the Google Groups "wxPython-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/CAEf70byE9pyefpDww5mbBVwHbfD-SiUe6zgOnbtBWvrJAD%2BkZg%40mail.gmail.com.