pyface icon indicating copy to clipboard operation
pyface copied to clipboard

Deprecate size arguments from ImageResource classes?

Open corranwebster opened this issue 3 years ago • 0 comments

The size argument to create_bitmap, create_image, etc. is only used in a couple of places (eg. Qt toolbar action items) and otherwise is ignored. Additionally, it is currently broken as the ImageResource._ref attribute only holds one size of the image.

The places where size is likely to be important are:

  • when used as an icon and a consistent size is expected
  • when a larger image needs to be shrunk to fit in the screen

In the first case, perhaps a proper icon class with multiple images for different contexts and sizes would make sense (or using SVG!); and there may be a case for some sort of icon theming support as per Qt, so it may be OK for create_icon to provide a size argument.

In the second case, the scaling is better done by the widget where the image is being displayed. There seems little advantage in having toolkit independent code for doing scaling.

This would nominally be a backward incompatible change. It would require:

  • [ ] removing the size argument from the few places it is used
  • [ ] adding a deprecation warning if it is supplied by third-party code
  • [ ] removal in the next major release

corranwebster avatar Mar 25 '21 17:03 corranwebster