-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathas_pollareadetector__define.pro
104 lines (73 loc) · 3.22 KB
/
as_pollareadetector__define.pro
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
PRO AS_PollAreaDetector_event,event
@as_scatterheader.macro
Widget_Control, event.id, GET_UVALUE = AS_PollAreaDetector
AS_PollAReaDetector->Event,event
END
PRO AS_PollAreaDetector::Event,event
@as_scatterheader.macro
IF self.areaDetectorObj.areaDetectorImageObj->NewArray() THEN BEGIN
fullFileName = self.areaDetectorObj.areaDetectorObj->GetProperty('FullFileName_RBV')
filePath = self.areaDetectorObj.areaDetectorObj->GetProperty('FilePath_RBV')
fileName = String(fullfileName[Where(fullfileName NE filePath)])
self.notify, fileName
wCount = Widget_Info(self.wBase, FIND_BY_UNAME = 'Count')
Widget_Control, wCount, GET_VALUE = count
count = StrCompress(String(1 + Fix(Count)))
Widget_Control, wCount, SET_VALUE = count
ENDIF
IF self.poll EQ 1 THEN Widget_Control, event.id, TIMER=self.interval
END
PRO AS_PollAreaDetector::StartPoll, INTERVAL = interval
@as_scatterheader.macro
Widget_Control, self.wBase, /MAP
IF Keyword_Set(interval) THEN self.interval = interval ELSE self.interval = 0.1
Widget_Control, self.wBase, TIMER=self.interval
self.poll = 1
END
PRO AS_PollAreaDetector::StopPoll
@as_scatterheader.macro
Widget_Control, self.wBase, MAP = 0
self.poll = 0
END
PRO AS_PollAreaDetector::notify, event
@as_scatterheader.macro
FOREACH notify, self.notifyObject DO BEGIN
IF Obj_Valid(notify) THEN notify.notify, event
wait, 0.2
ENDFOREACH
END
FUNCTION AS_PollAreaDetector::INIT, areaDetectorObj, NOTIFYOBJECT = notifyObject, GROUP_LEADER=groupLeader
@as_scatterheader.macro
CASE !D.NAME OF
'WIN': COUNTFONT = "BOLD*24"
'x' : COUNTFONT = "lucidasans-bold-24"
ELSE : COUNTFONT = ""
ENDCASE
IF Obj_Valid(areaDetectorObj.areaDetectorImageObj) THEN BEGIN
IF Obj_Class(areaDetectorObj.areaDetectorImageObj) NE 'EPICS_ND_STD_ARRAYS' THEN RETURN, -1
ENDIF ELSE RETURN, -1
IF Obj_Valid(areaDetectorObj.areaDetectorObj) THEN BEGIN
IF Obj_Class(areaDetectorObj.areaDetectorObj) NE 'EPICS_AD_FILE' THEN RETURN, -1
ENDIF ELSE RETURN, -1
self.areaDetectorObj = areaDetectorObj
IF Keyword_Set(notifyObject) THEN $
IF TypeName(notifyObject[0]) EQ 'NOTIFY' $
THEN self.notifyObject = List(notifyObject,/EXTRACT)
IF Keyword_Set(GROUP_LEADER) THEN self.wBase = Widget_Base(GROUP_LEADER=groupLeader, /FLOATING, /COLUMN,TLB_FRAME_ATTR=11) $
ELSE self.wBase = Widget_Base(/COLUMN,TLB_FRAME_ATTR=11)
wCountLabelLabel = Widget_Label(self.wBase, VALUE = 'No. of areaDetector Frames',FONT = COUNTFONT)
wCountLabel = Widget_Label(self.wBase, VALUE = ' 0', UNAME = 'Count',FONT = COUNTFONT)
Widget_Control, self.wBase, /REALIZE
Widget_Control, self.wBase, MAP = 0
Widget_Control, self.wBase, SET_UVALUE = self
XManager, 'AS_PollAreaDetector', self.wBase, /NO_BLOCK
RETURN, 1
END
PRO AS_PollAreaDetector__define
void = {AS_PollAreaDetector, $
wBase : 0L, $
poll : 0, $
areaDetectorObj : {areaObjs, areaDetectorObj : Obj_New(), areaDetectorImageObj : Obj_New()}, $
interval : 0.0, $
notifyObject : List()}
END