pcdshub / lightpath

LCLS Lightpath Module
https://pcdshub.github.io/lightpath
Other
4 stars 9 forks source link

ENH: Beamline Symbols #85

Closed teddyrendahl closed 5 years ago

teddyrendahl commented 5 years ago

Description

Having all the devices be represented as squares is not ideal. Operators want to quickly scan the beamline and having to read long aliases or PV prefixes is mentally exhausting. Due to issues with PyDMDrawing I've opted to use icons from the QFontAwesome library. This package is available on conda-forge, adds no additional dependencies to my development Conda environment and comes pre-packaged with the free versions of Elusive Icons and FontAwesome icon sets.

The tricky part is actually mapping which devices we want to show up with which symbols. We can't do a direct class lookup because special subclasses and factories will be difficult (e.g I don't want to but every Attenuatorclass in the dictionary). Also, importing a ton of devices just to make a dictionary is not worth the maintenance cost. Instead, I would like to attach an _icon class variable to all of our pcdsdevices classes. These will be just be strings that have the pattern "{source}.{icon_name}". This has the benefit of:

  1. No giant imports of pcdsdevices
  2. Other GUI applications will be able to easily find the symbols
  3. Symbols will persist through inheritance unless otherwise explicitly overwritten.

Motivation and Context

Closes #77

How Has This Been Tested?

Added a test for grabbing icons. Demo version has all unique icons now as well.

Where Has This Been Documented

Docstrings for functions

Screenshots (if appropriate):

screen shot 2018-09-11 at 9 21 50 am
codecov-io commented 5 years ago

Codecov Report

Merging #85 into master will increase coverage by 0.53%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #85      +/-   ##
==========================================
+ Coverage    89.3%   89.84%   +0.53%     
==========================================
  Files           7        7              
  Lines         505      512       +7     
==========================================
+ Hits          451      460       +9     
+ Misses         54       52       -2
Impacted Files Coverage Δ
lightpath/ui/widgets.py 92.63% <100%> (+2.85%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update c8f173c...1b3b90d. Read the comment docs.

teddyrendahl commented 5 years ago

@ZLLentz I agree the extensibility of QtAwesome or lack thereof maybe in an issue. I imagine we could make a standard wrapper function that looks for a special prefix and loads the QIcon for PCDS specific stuff.

silkenelson commented 5 years ago

I would like a non-box for the reflaser. There is the "certificate" icon (sort of sun-like), the asterisk (it's vaguely close to a laser icon, except for the one long "leg" that the laser symbol has), an eye (as in: here you get beam you can actually look at).