enthought / enthought/pyface

Deprecate size arguments from ImageResource classes?

Open
#913 0 comments 0 reactions 0 assignees View on GitHub
difficulty: intermediate type: cleanup
Dominant language
Python
Stars
115
Forks
54
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.