pcdshub / typhos

Automatic-yet-customizable Graphical User Interface Generation for Ophyd Devices
http://pcdshub.github.io/typhos
Other
16 stars 24 forks source link

ENH: dynamic font resizing functionality #570

Closed klauer closed 10 months ago

klauer commented 10 months ago

Description

Motivation and Context

New embedded positioner screens in #563 - @ZLLentz was aiming to have positioner readback values display in large form uniformly on all displays.

How Has This Been Tested?

A bit interactively and with the included unit test. It'd be a good idea to do more interactive testing, I think. I also updated our upstream test repository in the meantime with the same tweaks, so it's a lot easier to test there:

Where Has This Been Documented?

This PR.

Screenshots (if appropriate):

The readback widget has this applied - and the font fills it well:

image
klauer commented 10 months ago

Is this worth pursuing @ZLLentz or should we aim for a different approach? Relevant commit for a convenient single-click: 476a146

ZLLentz commented 10 months ago

I think this is worth pursuing, not just for the readback but for the other visible text fields in the positioner widget (both the compact version and the non-compact version)

My only critique is the lack of margins which plays poorly with the blue borders (but probably looks exactly correct for non-blue-border elements)

klauer commented 10 months ago

My only critique is the lack of margins which plays poorly with the blue borders (but probably looks exactly correct for non-blue-border elements)

Added a padding setting for that purpose ("pad_percent", proportional to widget size) in the patching method.

I'll try to extract this from the positioner PR now - apologies for the bumpy force pushes ahead

klauer commented 10 months ago

Do we think there's value in a ctrl + + / ctrl + - type of feature? Assuming it could be implemented without as bad of a performance penalty (maybe we don't have to hook paintEvent, but rather just scale font sizes up and down), that might provide users better control over sizes.

I think that's a good idea, though rather hard to implement properly - one widget may resize as you had hoped and another may be clipped and unreadable.

I think context-sensitive menus in PyDM, allowing fine-grained font size adjustment on a per-widget basis, could be an option. Context menus are rather underutilized there in my opinion. Imagine an "Advanced" section that allows you to increase the (fixed) size of a given widget and/or increase the font size to match its size. I think of PyDM as an expert-facing app of sorts and giving more knobs to the user (so long as they're unobtrusive) could only be a positive thing.