Skip to content

Commit

Permalink
Merge pull request #91 from klauer/enh_use_alarmcircle
Browse files Browse the repository at this point in the history
ENH: use AlarmCircle, if available
  • Loading branch information
ZLLentz authored Jul 8, 2021
2 parents ce8bc8c + 6b06dbf commit 2382705
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ env:
jobs:
allow_failures:
# ** pyqtads is not available on PyPI, so this cannot succeed:
- name: "Python 3.6 - PIP"
- name: "Python 3.8 - PIP"
- name: "Python 3.9"

import:
- pcdshub/pcds-ci-helpers:travis/shared_configs/setup-env-ui.yml
Expand Down
4 changes: 4 additions & 0 deletions lucid/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,3 +236,7 @@ def main():
args = parse_arguments()
kwargs = vars(args)
launch(**kwargs)


if __name__ == "__main__":
main()
42 changes: 29 additions & 13 deletions lucid/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@
from typhos import TyphosDeviceDisplay, TyphosSuite
from typhos.utils import no_device_lazy_load

try:
from typhos.alarm import TyphosAlarmCircle
except ImportError:
# Compatibility with older versions of typhos
TyphosAlarmCircle = None


logger = logging.getLogger(__name__)

HAPPI_GENERAL_SEARCH_KEYS = ('name', 'prefix', 'stand')
Expand Down Expand Up @@ -74,19 +81,28 @@ def addWidget(self, widget):
grid_position[1])


def indicator_for_device(device):
"""Create a QWidget to indicate the alarm state of a QWidget"""
# This is a placeholder. There will be a system for determining the mapping
# of Device to icon put in place
circle = PyDMDrawingCircle()
circle.setStyleSheet('PyDMDrawingCircle '
'{border: none; '
' background: transparent;'
' qproperty-penColor: black;'
' qproperty-penWidth: 2;'
' qproperty-penStyle: SolidLine;'
' qproperty-brush: rgba(82,101,244,255);} ')
return circle
if TyphosAlarmCircle is not None:
def indicator_for_device(device):
"""Create a QWidget to indicate the alarm state of a QWidget"""
circle = TyphosAlarmCircle()
circle.add_device(device)
return circle
else:
def indicator_for_device(device):
"""Create a QWidget to indicate the alarm state of a QWidget"""
# This is a placeholder if a new version of typhos with alarm support
# is unavailable.
circle = PyDMDrawingCircle()
circle.setStyleSheet(
"PyDMDrawingCircle "
"{border: none; "
" background: transparent;"
" qproperty-penColor: black;"
" qproperty-penWidth: 2;"
" qproperty-penStyle: SolidLine;"
" qproperty-brush: rgba(82,101,244,255);} "
)
return circle


def display_for_device(device, display_type=None):
Expand Down

0 comments on commit 2382705

Please sign in to comment.