Changeset 1391


Ignore:
Timestamp:
Jul 4, 2013 6:15:05 PM (12 years ago)
Author:
jemian
Message:

update the widget when the alarm state changes

Location:
moxy/trunk/src/moxy/qtlib
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified moxy/trunk/src/moxy/qtlib/bcdaqwidgets.py

    r1390 r1391  
    9393        self.labelSignal = BcdaQSignalDef()
    9494        self.clut = dict(CLUT)
     95       
     96        self.useAlarmState = False
     97        self.severity_color_list = ['green', 'orange', 'red']
    9598
    9699        # for use with describing the styleSheet
     
    162165            # caller wants to be notified of this camonitor event
    163166            self.ca_callback(pvname=pvname, char_value=char_value, **kw)
    164         # TODO: could update the bgColor on alarm state
    165         # PyEpics has {upper,lower}_{alarm,warning,ctrl,disp}_limit
    166         # these values are None, unless given an explicit value by the PV
    167167
    168168    def SetText(self, *args, **kw):
     
    170170        # pull the new text from the cache (set by onPVChange() method)
    171171        self.setText(self.text_cache)
     172       
     173        # if desired, color the text based on the alarm severity
     174        if self.useAlarmState and self.pv is not None:
     175            self.pv.get_ctrlvars()
     176            if self.pv.severity is not None:
     177                color = self.severity_color_list[self.pv.severity]
     178                self.UpdateStyleSheet({'color': color})
    172179   
    173180    def UpdateStyleSheet(self, changes_dict):
Note: See TracChangeset for help on using the changeset viewer.