Re: Class hierarchy for thumbnailctrl
Andrea Gavana <[email protected]>
| Newsgroups | gmane.comp.python.wxpython |
|---|---|
| Message-ID | <CAEf70by4cb3LXNcnabnDpfimf4-XhpqbfdNnE0pQPF_71tobPQ@mail.gmail.com> |
Hi, On Sun, 6 Sep 2020 at 18.01, 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: > > > > > > I was looking at the example code for the thumbnailctrl class and > > > reading at the documentation so I could understand how to use it. > > > The class documentation is at > > > > https://wxpython.org/Phoenix/docs/html/wx.lib.agw.thumbnailctrl.ThumbnailCtrl.html#wx.lib.agw.thumbnailctrl.ThumbnailCtrl > > > or > https://wxpython.org/Phoenix/docs/html/wx.lib.agw.thumbnailctrl.html > > > > > > The two descriptions of the ThumbnailCtrl widget are different, > > > which is > > > confusing. More confusing is that many of the methods used in the > > > example were not listed in the class documentation. I found these > > > methods defined in the ScrolledThumbnailCtrl, but neither > ThumbnailCtrl > > > or ScrolledThumbnail are in same inheritance tree. ThumbnailCtrl > > > inherits from Panel, while ScrolledThumbnailCtrl inherits from > > > ScrolledWindow. > > > > > > It was not clear when or how ScrolledThumbnailCtrl was supposed to be > > > used. (It now appears that it should not be used.) > > > > > > When I looked at the code for ThumbnailCtrl, I saw it contains an > > > instance of ScrolledThumbnailCtrl and that many of the latter's > methods > > > are copied into the method list for ThumbnailCtrl. > > > > > > 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. > > > > OK, I'll think about this. > > > > There's a lot of Python (and wxPython) that I don't quite understand. I > > wondered if there was some reason why this pseudo-multiple inheritance > > trickery was being done. Maybe to selectively inherit some > > ScrolledThumbnailCtrl methods, but not others? No, I don’t think it was something so subtle. It was a long time ago, I kind-of translated it from a C++ widget and maybe I just misunderstood what the original code was doing. In any case, wxPython is a bit more relaxed when it comes to subclassing and inheriting, and it doesn’t have all the constraints wxWidgets has imposed onto itself. So please go ahead and help Phoenix get better with a PR. I’m sure ThumbnailCtrl will look much more consistent code-wise. 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/a64d3097-fca7-f5e2-9b97-efd18ab5ebc9%40eagercon.com > . > > -- 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/CAEf70by4cb3LXNcnabnDpfimf4-XhpqbfdNnE0pQPF_71tobPQ%40mail.gmail.com.