1 | function varargout = tango_staticdb_config(varargin) |
---|
2 | % TANGO_STATICDB_EDITOR M-file for tango_staticdb_config.fig |
---|
3 | % TANGO_STATICDB_EDITOR, by itself, creates a new TANGO_STATICDB_EDITOR or raises the existing |
---|
4 | % singleton*. |
---|
5 | % |
---|
6 | % H = TANGO_STATICDB_EDITOR returns the handle to a new TANGO_STATICDB_EDITOR or the handle to |
---|
7 | % the existing singleton*. |
---|
8 | % |
---|
9 | % TANGO_STATICDB_EDITOR('CALLBACK',hObject,eventData,handles,...) calls the local |
---|
10 | % function named CALLBACK in TANGO_STATICDB_EDITOR.M with the given input arguments. |
---|
11 | % |
---|
12 | % TANGO_STATICDB_EDITOR('Property','Value',...) creates a new TANGO_STATICDB_EDITOR or raises the |
---|
13 | % existing singleton*. Starting from the left, property value pairs are |
---|
14 | % applied to the GUI before tango_staticdb_config_OpeningFunction gets called. An |
---|
15 | % unrecognized property name or invalid value makes property application |
---|
16 | % stop. All inputs are passed to tango_staticdb_config_OpeningFcn via varargin. |
---|
17 | % |
---|
18 | % *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one |
---|
19 | % instance to run (singleton)". |
---|
20 | % |
---|
21 | % See also: GUIDE, GUIDATA, GUIHANDLES |
---|
22 | |
---|
23 | % Copyright 2002-2003 The MathWorks, Inc. |
---|
24 | |
---|
25 | % Edit the above text to modify the response to help tango_staticdb_config |
---|
26 | |
---|
27 | % Last Modified by GUIDE v2.5 24-Mar-2006 11:54:22 |
---|
28 | |
---|
29 | % Laurent S. Nadolski, SOLEIL |
---|
30 | |
---|
31 | % Begin initialization code - DO NOT EDIT |
---|
32 | gui_Singleton = 1; |
---|
33 | gui_State = struct('gui_Name', mfilename, ... |
---|
34 | 'gui_Singleton', gui_Singleton, ... |
---|
35 | 'gui_OpeningFcn', @tango_staticdb_config_OpeningFcn, ... |
---|
36 | 'gui_OutputFcn', @tango_staticdb_config_OutputFcn, ... |
---|
37 | 'gui_LayoutFcn', [] , ... |
---|
38 | 'gui_Callback', []); |
---|
39 | if nargin && ischar(varargin{1}) |
---|
40 | gui_State.gui_Callback = str2func(varargin{1}); |
---|
41 | end |
---|
42 | |
---|
43 | if nargout |
---|
44 | [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:}); |
---|
45 | else |
---|
46 | gui_mainfcn(gui_State, varargin{:}); |
---|
47 | end |
---|
48 | % End initialization code - DO NOT EDIT |
---|
49 | |
---|
50 | |
---|
51 | % --- Executes just before tango_staticdb_config is made visible. |
---|
52 | function tango_staticdb_config_OpeningFcn(hObject, eventdata, handles, varargin) |
---|
53 | % This function has no output args, see OutputFcn. |
---|
54 | % hObject handle to figure |
---|
55 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
56 | % handles structure with handles and user data (see GUIDATA) |
---|
57 | % varargin command line arguments to tango_staticdb_config (see VARARGIN) |
---|
58 | |
---|
59 | % Choose default command line output for tango_staticdb_config |
---|
60 | handles.output = hObject; |
---|
61 | |
---|
62 | % Update handles structure |
---|
63 | guidata(hObject, handles); |
---|
64 | |
---|
65 | % UIWAIT makes tango_staticdb_config wait for user response (see UIRESUME) |
---|
66 | % uiwait(handles.figure1); |
---|
67 | |
---|
68 | disp('TANGO Static DataBase Configurator'); |
---|
69 | |
---|
70 | set(handles.figure1,'HandleVisibility','Callback'); |
---|
71 | set(handles.listbox_log, 'String',{[datestr(now) ': application started'], ' '}); |
---|
72 | |
---|
73 | % uimenu_anneau_Callback(handles.uimenu_LT1, eventdata, handles); |
---|
74 | %uimenu_LT1_Callback(handles.uimenu_LT1, eventdata, handles); |
---|
75 | % Update handles structure |
---|
76 | guidata(hObject, handles); |
---|
77 | |
---|
78 | % --- Outputs from this function are returned to the command line. |
---|
79 | function varargout = tango_staticdb_config_OutputFcn(hObject, eventdata, handles) |
---|
80 | % varargout cell array for returning output args (see VARARGOUT); |
---|
81 | % hObject handle to figure |
---|
82 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
83 | % handles structure with handles and user data (see GUIDATA) |
---|
84 | |
---|
85 | % Get default command line output from handles structure |
---|
86 | varargout{1} = handles.output; |
---|
87 | |
---|
88 | |
---|
89 | % --- Executes on selection change in popupmenu_group. |
---|
90 | function popupmenu_group_Callback(hObject, eventdata, handles) |
---|
91 | % hObject handle to popupmenu_group (see GCBO) |
---|
92 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
93 | % handles structure with handles and user data (see GUIDATA) |
---|
94 | |
---|
95 | % Hints: contents = get(hObject,'String') returns popupmenu_group contents as cell array |
---|
96 | % contents{get(hObject,'Value')} returns selected item from popupmenu_group |
---|
97 | |
---|
98 | contents = get(hObject,'String'); |
---|
99 | num = get(hObject,'Value'); |
---|
100 | family = contents{num}; |
---|
101 | |
---|
102 | AO = getfamilydata(family); |
---|
103 | setappdata(handles.figure1,'AO',AO); |
---|
104 | setappdata(handles.figure1, 'Family', family); |
---|
105 | |
---|
106 | %% Status one devices |
---|
107 | valid = find(AO.Status); |
---|
108 | %% Builds up attribut list for selected family |
---|
109 | if ~iscell(AO.DeviceName) |
---|
110 | AO.DeviceName = {AO.DeviceName}; |
---|
111 | end |
---|
112 | |
---|
113 | attributeList = tango_get_attribute_list(AO.DeviceName{valid(1)}); |
---|
114 | |
---|
115 | if isnumeric(attributeList) && attributeList == -1 |
---|
116 | error('Cannot communicate with device %s',AO.DeviceName{valid(1)}) |
---|
117 | end |
---|
118 | |
---|
119 | num = get(handles.popupmenu_attribute,'Value'); |
---|
120 | if num > length(attributeList) |
---|
121 | num = 1; |
---|
122 | set(handles.popupmenu_attribute,'Value',num); |
---|
123 | end |
---|
124 | set(handles.popupmenu_attribute,'String',attributeList); |
---|
125 | |
---|
126 | %setback selected elements and property to first one |
---|
127 | set(handles.listbox_property,'Value',1); |
---|
128 | set(handles.listbox_group,'Value',1); |
---|
129 | set(handles.listbox_dev_property,'Value',1); |
---|
130 | |
---|
131 | popupmenu_attribute_Callback(handles.popupmenu_attribute, eventdata, handles); |
---|
132 | |
---|
133 | %% Build up command list |
---|
134 | % popupmenu_group_Callback(handles.popupmenu_attribute, eventdata, handles); |
---|
135 | |
---|
136 | commandList = tango_command_list_query(AO.DeviceName{valid(1)}); |
---|
137 | |
---|
138 | num = get(handles.popupmenu_command,'Value'); |
---|
139 | if num > length(attributeList) |
---|
140 | num = 1; |
---|
141 | set(handles.popupmenu_command,'Value',num); |
---|
142 | end |
---|
143 | |
---|
144 | % trick for getting a field array from a cell array |
---|
145 | commandOutputType = eval(['{commandList.', 'out_type}']); |
---|
146 | commandInputType = eval(['{commandList.', 'in_type}']); |
---|
147 | setappdata(handles.figure1,'cmd_output_type',commandOutputType); |
---|
148 | setappdata(handles.figure1,'cmd_input_type',commandInputType); |
---|
149 | commandList = eval(['{commandList.', 'cmd_name}']); |
---|
150 | |
---|
151 | set(handles.popupmenu_command,'String',commandList); |
---|
152 | |
---|
153 | %% Build up a NaN attribute value pannel |
---|
154 | set(handles.listbox_attribute,'String', repmat('NaN',size(AO.DeviceName))); |
---|
155 | set(handles.listbox_dev_property,'String', repmat('NaN',size(AO.DeviceName))); |
---|
156 | |
---|
157 | %% Build up device property device list |
---|
158 | devPropList = tango_command_list_query(AO.DeviceName{valid(1)}); |
---|
159 | |
---|
160 | % Update handles structure |
---|
161 | guidata(hObject, handles); |
---|
162 | |
---|
163 | % --- Executes during object creation, after setting all properties. |
---|
164 | function popupmenu_group_CreateFcn(hObject, eventdata, handles) |
---|
165 | % hObject handle to popupmenu_group (see GCBO) |
---|
166 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
167 | % handles empty - handles not created until after all CreateFcns called |
---|
168 | |
---|
169 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
170 | % See ISPC and COMPUTER. |
---|
171 | if ispc |
---|
172 | set(hObject,'BackgroundColor','white'); |
---|
173 | else |
---|
174 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
175 | end |
---|
176 | |
---|
177 | |
---|
178 | % --- Executes on selection change in popupmenu_attribute. |
---|
179 | function popupmenu_attribute_Callback(hObject, eventdata, handles) |
---|
180 | % hObject handle to popupmenu_attribute (see GCBO) |
---|
181 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
182 | % handles structure with handles and user data (see GUIDATA) |
---|
183 | |
---|
184 | % Hints: contents = get(hObject,'String') returns popupmenu_attribute contents as cell array |
---|
185 | % contents{get(hObject,'Value')} returns selected item from popupmenu_attribute |
---|
186 | |
---|
187 | contents = get(hObject,'String'); |
---|
188 | num = get(hObject,'Value'); |
---|
189 | attribute = contents{num}; |
---|
190 | |
---|
191 | family = getappdata(handles.figure1,'Family'); |
---|
192 | AO = getappdata(handles.figure1,'AO'); |
---|
193 | |
---|
194 | %% Selects valid devices |
---|
195 | valid = find(AO.Status); |
---|
196 | %% Builds up property list for selected family |
---|
197 | |
---|
198 | if ~iscell(AO.DeviceName) |
---|
199 | AO.DeviceName = cellstr(AO.DeviceName); |
---|
200 | end |
---|
201 | |
---|
202 | propertyList = fieldnames(tango_attribute_query(AO.DeviceName{valid(1)}, attribute)); |
---|
203 | |
---|
204 | num = get(hObject,'Value'); |
---|
205 | if num > length(propertyList) |
---|
206 | num = 1; |
---|
207 | set(handles.popupmenu_property,'Value',num); |
---|
208 | end |
---|
209 | set(handles.popupmenu_property,'String',propertyList); |
---|
210 | |
---|
211 | % Reset to first item in selection list |
---|
212 | set(handles.listbox_property,'Value',1); |
---|
213 | set(handles.listbox_group,'Value',1); |
---|
214 | set(handles.listbox_attribute,'Value',1); |
---|
215 | |
---|
216 | popupmenu_property_Callback(handles.popupmenu_property, eventdata, handles); |
---|
217 | |
---|
218 | %set(handles.radiobutton_property,'Value',1); |
---|
219 | |
---|
220 | % Update handles structure |
---|
221 | guidata(hObject, handles); |
---|
222 | |
---|
223 | % --- Executes during object creation, after setting all properties. |
---|
224 | function popupmenu_attribute_CreateFcn(hObject, eventdata, handles) |
---|
225 | % hObject handle to popupmenu_attribute (see GCBO) |
---|
226 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
227 | % handles empty - handles not created until after all CreateFcns called |
---|
228 | |
---|
229 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
230 | % See ISPC and COMPUTER. |
---|
231 | if ispc |
---|
232 | set(hObject,'BackgroundColor','white'); |
---|
233 | else |
---|
234 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
235 | end |
---|
236 | |
---|
237 | |
---|
238 | % --- Executes on selection change in popupmenu_property. |
---|
239 | function popupmenu_property_Callback(hObject, eventdata, handles) |
---|
240 | % hObject handle to popupmenu_property (see GCBO) |
---|
241 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
242 | % handles structure with handles and user data (see GUIDATA) |
---|
243 | |
---|
244 | % Hints: contents = get(hObject,'String') returns popupmenu_property contents as cell array |
---|
245 | % contents{get(hObject,'Value')} returns selected item from popupmenu_property |
---|
246 | |
---|
247 | contents = get(hObject,'String'); |
---|
248 | num = get(hObject,'Value'); |
---|
249 | property = contents{num}; |
---|
250 | |
---|
251 | attribute = get(handles.popupmenu_attribute,'String'); |
---|
252 | iattribute = get(handles.popupmenu_attribute,'Value'); |
---|
253 | AO = getappdata(handles.figure1,'AO'); |
---|
254 | |
---|
255 | |
---|
256 | % Status one devices |
---|
257 | valid = find(AO.Status); |
---|
258 | |
---|
259 | % Update Group list |
---|
260 | |
---|
261 | if ~iscell(AO.DeviceName) |
---|
262 | AO.DeviceName = {AO.DeviceName}; |
---|
263 | end |
---|
264 | |
---|
265 | set(handles.listbox_group,'String',AO.DeviceName(valid)); |
---|
266 | |
---|
267 | % Contruct DeviceName/AttributName list |
---|
268 | fullTangoNames = strcat(AO.DeviceName(valid), '/', attribute{iattribute}); |
---|
269 | |
---|
270 | % Builds up property list |
---|
271 | list = tango_get_attribute_property(fullTangoNames, property); |
---|
272 | set(handles.listbox_property,'String',list); |
---|
273 | % Reset to first item in selection list |
---|
274 | set(handles.listbox_property,'Value',1); |
---|
275 | set(handles.listbox_group,'Value',1); |
---|
276 | set(handles.listbox_attribute,'Value',1); |
---|
277 | set(handles.checkbox_all,'Value',0); |
---|
278 | |
---|
279 | writelog(['Values for property ''' char(property) ''' refreshed'],handles); |
---|
280 | |
---|
281 | %popupmenu_command_Callback(handles.popupmenu_property, eventdata, handles); |
---|
282 | |
---|
283 | % Update handles structure |
---|
284 | guidata(hObject, handles); |
---|
285 | |
---|
286 | % --- Executes during object creation, after setting all properties. |
---|
287 | function popupmenu_property_CreateFcn(hObject, eventdata, handles) |
---|
288 | % hObject handle to popupmenu_property (see GCBO) |
---|
289 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
290 | % handles empty - handles not created until after all CreateFcns called |
---|
291 | |
---|
292 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
293 | % See ISPC and COMPUTER. |
---|
294 | if ispc |
---|
295 | set(hObject,'BackgroundColor','white'); |
---|
296 | else |
---|
297 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
298 | end |
---|
299 | |
---|
300 | % --- Executes on selection change in listbox_group. |
---|
301 | function listbox_group_Callback(hObject, eventdata, handles) |
---|
302 | % hObject handle to listbox_group (see GCBO) |
---|
303 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
304 | % handles structure with handles and user data (see GUIDATA) |
---|
305 | |
---|
306 | % Hints: contents = get(hObject,'String') returns listbox_group contents as cell array |
---|
307 | % contents{get(hObject,'Value')} returns selected item from listbox_group |
---|
308 | |
---|
309 | idx = get(hObject,'Value'); |
---|
310 | |
---|
311 | set(handles.listbox_attribute,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
312 | set(handles.listbox_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
313 | set(handles.listbox_dev_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
314 | set(handles.checkbox_all,'Value',0); |
---|
315 | |
---|
316 | % --- Executes during object creation, after setting all properties. |
---|
317 | function listbox_group_CreateFcn(hObject, eventdata, handles) |
---|
318 | % hObject handle to listbox_group (see GCBO) |
---|
319 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
320 | % handles empty - handles not created until after all CreateFcns called |
---|
321 | |
---|
322 | % Hint: listbox controls usually have a white background on Windows. |
---|
323 | % See ISPC and COMPUTER. |
---|
324 | if ispc |
---|
325 | set(hObject,'BackgroundColor','white'); |
---|
326 | else |
---|
327 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
328 | end |
---|
329 | |
---|
330 | |
---|
331 | % --- Executes on selection change in listbox_property. |
---|
332 | function listbox_property_Callback(hObject, eventdata, handles) |
---|
333 | % hObject handle to listbox_property (see GCBO) |
---|
334 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
335 | % handles structure with handles and user data (see GUIDATA) |
---|
336 | |
---|
337 | % Hints: contents = get(hObject,'String') returns listbox_property contents as cell array |
---|
338 | % contents{get(hObject,'Value')} returns selected item from listbox_property |
---|
339 | |
---|
340 | contents = get(hObject,'String'); |
---|
341 | idx = get(hObject,'Value'); |
---|
342 | |
---|
343 | set(handles.listbox_group,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
344 | set(handles.listbox_attribute,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
345 | set(handles.listbox_dev_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
346 | set(handles.checkbox_all,'Value',0); |
---|
347 | |
---|
348 | set(handles.edit_value,'String',contents{idx(1)}); |
---|
349 | |
---|
350 | %select radiobutton |
---|
351 | set(handles.radiobutton_property,'Value',1); |
---|
352 | |
---|
353 | % --- Executes during object creation, after setting all properties. |
---|
354 | function listbox_property_CreateFcn(hObject, eventdata, handles) |
---|
355 | % hObject handle to listbox_property (see GCBO) |
---|
356 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
357 | % handles empty - handles not created until after all CreateFcns called |
---|
358 | |
---|
359 | % Hint: listbox controls usually have a white background on Windows. |
---|
360 | % See ISPC and COMPUTER. |
---|
361 | if ispc |
---|
362 | set(hObject,'BackgroundColor','white'); |
---|
363 | else |
---|
364 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
365 | end |
---|
366 | |
---|
367 | |
---|
368 | % --- Executes on button press in checkbox_all. |
---|
369 | function checkbox_all_Callback(hObject, eventdata, handles) |
---|
370 | % hObject handle to checkbox_all (see GCBO) |
---|
371 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
372 | % handles structure with handles and user data (see GUIDATA) |
---|
373 | |
---|
374 | % Hint: get(hObject,'Value') returns toggle state of checkbox_all |
---|
375 | val = get(handles.listbox_group,'String'); |
---|
376 | |
---|
377 | if get(hObject,'Value') == 1 |
---|
378 | set(handles.listbox_group,'Value',1:length(val)); |
---|
379 | set(handles.listbox_attribute,'Value',1:length(val)); |
---|
380 | set(handles.listbox_property,'Value',1:length(val)); |
---|
381 | set(handles.listbox_dev_property,'Value',1:length(val)); |
---|
382 | set(handles.listbox_group,'listboxtop',1); |
---|
383 | set(handles.listbox_attribute,'listboxtop',1); |
---|
384 | set(handles.listbox_property,'listboxtop',1); |
---|
385 | set(handles.listbox_dev_property,'listboxtop',1); |
---|
386 | end |
---|
387 | |
---|
388 | function edit_value_Callback(hObject, eventdata, handles) |
---|
389 | % hObject handle to edit_value (see GCBO) |
---|
390 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
391 | % handles structure with handles and user data (see GUIDATA) |
---|
392 | |
---|
393 | % Hints: get(hObject,'String') returns contents of edit_value as text |
---|
394 | % str2double(get(hObject,'String')) returns contents of edit_value as a double |
---|
395 | |
---|
396 | % First of all, ask for confirmation |
---|
397 | answer = questdlg('Do you want to apply change ?','Confirmation dialog box'); |
---|
398 | |
---|
399 | switch answer |
---|
400 | case 'Yes' |
---|
401 | |
---|
402 | % Get the new value |
---|
403 | % Need to force char array |
---|
404 | value = char(get(hObject,'String')); |
---|
405 | |
---|
406 | attribute = get(handles.popupmenu_attribute,'String'); |
---|
407 | iattribute = get(handles.popupmenu_attribute,'Value'); |
---|
408 | property = get(handles.popupmenu_property,'String'); |
---|
409 | iproperty = get(handles.popupmenu_property,'Value'); |
---|
410 | iSelected = get(handles.listbox_group,'Value'); |
---|
411 | Family = getappdata(handles.figure1, 'Family'); |
---|
412 | DeviceName = family2tangodev(Family); |
---|
413 | |
---|
414 | switch get(handles.radiobutton_property,'Value') |
---|
415 | |
---|
416 | case 1 % property change |
---|
417 | |
---|
418 | %% Get selected element |
---|
419 | writelog(['Please wait: writting property ' property{iproperty} '...'], handles); |
---|
420 | |
---|
421 | tango_set_attribute_property(strcat(DeviceName(iSelected), ... |
---|
422 | '/',attribute{iattribute}),property{iproperty}, value) |
---|
423 | |
---|
424 | writelog('Properties written', handles); |
---|
425 | |
---|
426 | % refresh display |
---|
427 | popupmenu_property_Callback(handles.popupmenu_property,eventdata, handles); |
---|
428 | |
---|
429 | case 0 %attribute change |
---|
430 | |
---|
431 | writelog(['Please wait: writting attributes ', attribute{iattribute}, ' ...'], handles); |
---|
432 | |
---|
433 | value = repmat(value,size(DeviceName(iSelected),1),1); |
---|
434 | writeattribute(strcat(DeviceName(iSelected), ... |
---|
435 | '/',attribute{iattribute}), value, 'QueryDB'); |
---|
436 | |
---|
437 | writelog('Attributes written', handles); |
---|
438 | |
---|
439 | % refresh display |
---|
440 | pushbutton_refresh_Callback(handles.pushbutton_refresh,eventdata, handles); |
---|
441 | end |
---|
442 | case {'No','Cancel'} |
---|
443 | return; |
---|
444 | otherwise |
---|
445 | warning('Wrong answer') |
---|
446 | end |
---|
447 | |
---|
448 | |
---|
449 | |
---|
450 | |
---|
451 | % --- Executes during object creation, after setting all properties. |
---|
452 | function edit_value_CreateFcn(hObject, eventdata, handles) |
---|
453 | % hObject handle to edit_value (see GCBO) |
---|
454 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
455 | % handles empty - handles not created until after all CreateFcns called |
---|
456 | |
---|
457 | % Hint: edit controls usually have a white background on Windows. |
---|
458 | % See ISPC and COMPUTER. |
---|
459 | if ispc |
---|
460 | set(hObject,'BackgroundColor','white'); |
---|
461 | else |
---|
462 | set(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor')); |
---|
463 | end |
---|
464 | |
---|
465 | |
---|
466 | % -------------------------------------------------------------------- |
---|
467 | function uimenu_linac_Callback(hObject, eventdata, handles) |
---|
468 | % hObject handle to uimenu_linac (see GCBO) |
---|
469 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
470 | % handles structure with handles and user data (see GUIDATA) |
---|
471 | |
---|
472 | init_uimenu(hObject, eventdata, handles); |
---|
473 | |
---|
474 | % ------------------------------------------------------------------------- |
---|
475 | function uimenu_LT1_Callback(hObject, eventdata, handles) |
---|
476 | % hObject handle to uimenu_LT1 (see GCBO) |
---|
477 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
478 | % handles structure with handles and user data (see GUIDATA) |
---|
479 | |
---|
480 | AD = getad; |
---|
481 | |
---|
482 | if isempty(AD) |
---|
483 | LT1init; |
---|
484 | elseif ~strcmpi(AD.Machine,'LT1') |
---|
485 | LT1init; |
---|
486 | end |
---|
487 | |
---|
488 | writelog('LT1 loaded',handles); |
---|
489 | handles = init_uimenu(hObject, eventdata, handles); |
---|
490 | % Update handles structure |
---|
491 | guidata(hObject, handles); |
---|
492 | |
---|
493 | % ------------------------------------------------------------------------- |
---|
494 | function handles = init_uimenu(hObject, eventdata, handles) |
---|
495 | |
---|
496 | %% Checked box |
---|
497 | all = findobj(get(hObject,'Parent'),'Type','UImenu'); |
---|
498 | set(all, 'Checked', 'Off'); |
---|
499 | set(hObject, 'Checked', 'On'); |
---|
500 | |
---|
501 | %% Initialize popupmenu w/ first element, first attribute, first property |
---|
502 | listfamily = fieldnames(getfamilydata); |
---|
503 | set(handles.popupmenu_group,'String',listfamily); |
---|
504 | |
---|
505 | popupmenu_group_Callback(handles.popupmenu_group, eventdata, handles); |
---|
506 | |
---|
507 | % -------------------------------------------------------------------- |
---|
508 | function uimenu_booster_Callback(hObject, eventdata, handles) |
---|
509 | % hObject handle to uimenu_booster (see GCBO) |
---|
510 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
511 | % handles structure with handles and user data (see GUIDATA) |
---|
512 | |
---|
513 | AD = getad; |
---|
514 | |
---|
515 | if isempty(AD) |
---|
516 | boosterinit; |
---|
517 | elseif ~strcmpi(AD.Machine,'Booster') |
---|
518 | boosterinit |
---|
519 | end |
---|
520 | |
---|
521 | writelog('Booster loaded',handles); |
---|
522 | init_uimenu(hObject, eventdata, handles); |
---|
523 | |
---|
524 | % -------------------------------------------------------------------- |
---|
525 | function uimenu_LT2_Callback(hObject, eventdata, handles) |
---|
526 | % hObject handle to uimenu_LT2 (see GCBO) |
---|
527 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
528 | % handles structure with handles and user data (see GUIDATA) |
---|
529 | |
---|
530 | AD = getad; |
---|
531 | |
---|
532 | if isempty(AD) |
---|
533 | LT2init |
---|
534 | elseif ~strcmpi(AD.Machine,'LT2') |
---|
535 | LT2init; |
---|
536 | end |
---|
537 | |
---|
538 | writelog('LT2 loaded',handles); |
---|
539 | |
---|
540 | init_uimenu(hObject, eventdata, handles); |
---|
541 | |
---|
542 | % -------------------------------------------------------------------- |
---|
543 | function uimenu_anneau_Callback(hObject, eventdata, handles) |
---|
544 | % hObject handle to uimenu_anneau (see GCBO) |
---|
545 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
546 | % handles structure with handles and user data (see GUIDATA) |
---|
547 | |
---|
548 | machineName = getsubmachinename; |
---|
549 | |
---|
550 | if isempty(machineName) |
---|
551 | soleilinit; |
---|
552 | elseif ~strcmpi(machineName,'StorageRing') |
---|
553 | soleilinit |
---|
554 | end |
---|
555 | |
---|
556 | writelog('Ring loaded',handles); |
---|
557 | |
---|
558 | init_uimenu(hObject, eventdata, handles); |
---|
559 | |
---|
560 | % --- Executes on selection change in listbox_attribute. |
---|
561 | function listbox_attribute_Callback(hObject, eventdata, handles) |
---|
562 | % hObject handle to listbox_attribute (see GCBO) |
---|
563 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
564 | % handles structure with handles and user data (see GUIDATA) |
---|
565 | |
---|
566 | % Hints: contents = get(hObject,'String') returns listbox_attribute contents as cell array |
---|
567 | % contents{get(hObject,'Value')} returns selected item from listbox_attribute |
---|
568 | |
---|
569 | contents = get(hObject,'String'); |
---|
570 | idx = get(hObject,'Value'); |
---|
571 | set(handles.listbox_group,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
572 | set(handles.listbox_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
573 | set(handles.listbox_dev_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
574 | set(handles.checkbox_all,'Value',0); |
---|
575 | |
---|
576 | % Selected only first element |
---|
577 | % If all elements are numeric, return a char array and not a cell! |
---|
578 | if ischar(contents) |
---|
579 | contents = cellstr(contents); |
---|
580 | end |
---|
581 | set(handles.edit_value,'String',contents{idx(1)}); |
---|
582 | |
---|
583 | %select radiobutton |
---|
584 | set(handles.radiobutton_attribute,'Value',1); |
---|
585 | |
---|
586 | % --- Executes during object creation, after setting all properties. |
---|
587 | function listbox_attribute_CreateFcn(hObject, eventdata, handles) |
---|
588 | % hObject handle to listbox_attribute (see GCBO) |
---|
589 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
590 | % handles empty - handles not created until after all CreateFcns called |
---|
591 | |
---|
592 | % Hint: listbox controls usually have a white background on Windows. |
---|
593 | % See ISPC and COMPUTER. |
---|
594 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
595 | set(hObject,'BackgroundColor','white'); |
---|
596 | end |
---|
597 | |
---|
598 | |
---|
599 | % --- Executes on selection change in popupmenu_command. |
---|
600 | function popupmenu_command_Callback(hObject, eventdata, handles) |
---|
601 | % hObject handle to popupmenu_command (see GCBO) |
---|
602 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
603 | % handles structure with handles and user data (see GUIDATA) |
---|
604 | |
---|
605 | % Hints: contents = get(hObject,'String') returns popupmenu_command contents as cell array |
---|
606 | % contents{get(hObject,'Value')} returns selected item from popupmenu_command |
---|
607 | |
---|
608 | contents = get(hObject,'String'); |
---|
609 | num = get(hObject,'Value'); |
---|
610 | command = contents{num}; |
---|
611 | |
---|
612 | setappdata(handles.figure1,'command', command); |
---|
613 | |
---|
614 | % --- Executes during object creation, after setting all properties. |
---|
615 | function popupmenu_command_CreateFcn(hObject, eventdata, handles) |
---|
616 | % hObject handle to popupmenu_command (see GCBO) |
---|
617 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
618 | % handles empty - handles not created until after all CreateFcns called |
---|
619 | |
---|
620 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
621 | % See ISPC and COMPUTER. |
---|
622 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
623 | set(hObject,'BackgroundColor','white'); |
---|
624 | end |
---|
625 | |
---|
626 | |
---|
627 | % --- Executes on button press in pushbutton_apply. |
---|
628 | function pushbutton_apply_Callback(hObject, eventdata, handles) |
---|
629 | % hObject handle to pushbutton_apply (see GCBO) |
---|
630 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
631 | % handles structure with handles and user data (see GUIDATA) |
---|
632 | |
---|
633 | % Apply command |
---|
634 | |
---|
635 | answer = questdlg('Do you want to apply change ?','Confirmation dialog box'); |
---|
636 | |
---|
637 | switch answer |
---|
638 | case 'Yes' |
---|
639 | % get selected device |
---|
640 | iSelected = get(handles.listbox_group,'Value'); |
---|
641 | |
---|
642 | Family = getappdata(handles.figure1, 'Family'); |
---|
643 | DeviceName = family2tangodev(Family); |
---|
644 | |
---|
645 | if isempty(iSelected) |
---|
646 | writelog('Non device names selected or status 0',handles); |
---|
647 | return; |
---|
648 | end |
---|
649 | |
---|
650 | valS = repmat('NaN',size(DeviceName)); |
---|
651 | val = cellstr(valS); |
---|
652 | %get selected command |
---|
653 | icmd = get(handles.popupmenu_command,'Value'); |
---|
654 | cmdlist = get(handles.popupmenu_command,'String'); |
---|
655 | command = cmdlist{icmd}; |
---|
656 | |
---|
657 | writelog(['Applying command: ' command], handles); |
---|
658 | set(handles.listbox_attribute,'String',val); |
---|
659 | |
---|
660 | commandOutputType = getappdata(handles.figure1,'cmd_output_type'); |
---|
661 | commandOutputType = commandOutputType{icmd}; |
---|
662 | commandInputType = getappdata(handles.figure1,'cmd_input_type'); |
---|
663 | commandInputType = commandInputType{icmd}; |
---|
664 | |
---|
665 | switch commandOutputType |
---|
666 | case {'1-by-n char'} |
---|
667 | for k = 1:length(iSelected), |
---|
668 | val0 = tango_command_inout2(DeviceName{iSelected(k)},command); |
---|
669 | val{iSelected(k)} = val0; |
---|
670 | end |
---|
671 | set(handles.listbox_attribute,'String',val); |
---|
672 | otherwise % not output command |
---|
673 | for k=1:length(iSelected), |
---|
674 | tango_command_inout2(DeviceName{iSelected(k)},command); |
---|
675 | end |
---|
676 | end |
---|
677 | writelog('Command applied', handles); |
---|
678 | case {'No','Cancel'} |
---|
679 | return; |
---|
680 | otherwise |
---|
681 | warning('Wrong answer') |
---|
682 | end |
---|
683 | |
---|
684 | |
---|
685 | % --- Executes on button press in pushbutton_refresh. |
---|
686 | function pushbutton_refresh_Callback(hObject, eventdata, handles) |
---|
687 | % hObject handle to pushbutton_refresh (see GCBO) |
---|
688 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
689 | % handles structure with handles and user data (see GUIDATA) |
---|
690 | |
---|
691 | % attributes |
---|
692 | % refresh ALL |
---|
693 | ifamily = get(handles.popupmenu_group,'Value'); |
---|
694 | family = get(handles.popupmenu_group,'String'); |
---|
695 | |
---|
696 | Family = family{ifamily}; |
---|
697 | DeviceName = family2tangodev(Family); |
---|
698 | |
---|
699 | if isempty(Family) |
---|
700 | writelog('No machine loaded!',handles); |
---|
701 | return |
---|
702 | end |
---|
703 | |
---|
704 | iattribute = get(handles.popupmenu_attribute,'Value'); |
---|
705 | attribute = get(handles.popupmenu_attribute,'String'); |
---|
706 | iSelected = get(handles.listbox_group,'Value'); |
---|
707 | |
---|
708 | val = ones(size(DeviceName))*NaN'; |
---|
709 | valS = repmat('NaN',size(DeviceName)); |
---|
710 | %val0 = readattribute(strcat(DeviceName,'/',char(attribute(iattribute)))); |
---|
711 | val0 = readattribute(strcat(DeviceName(iSelected),'/',char(attribute(iattribute)))); |
---|
712 | |
---|
713 | if iscellstr(val0) % See timestamp for MON as an example |
---|
714 | val = cellstr(valS); |
---|
715 | val(iSelected,:) = val0; |
---|
716 | else |
---|
717 | val(iSelected) = val0; |
---|
718 | end |
---|
719 | |
---|
720 | % % update listbox |
---|
721 | set(handles.listbox_attribute,'String',val); |
---|
722 | % % update editbox |
---|
723 | % set(handles.edit_value,'String',val(1)); |
---|
724 | % set(handles.listbox_attribute,'Value',1); |
---|
725 | % set(handles.listbox_group,'Value',1); |
---|
726 | % set(handles.listbox_dev_property,'Value',1); |
---|
727 | % set(handles.listbox_property,'Value',1); |
---|
728 | % % uncheck buttons |
---|
729 | % set(handles.checkbox_all,'Value', 0); |
---|
730 | |
---|
731 | writelog(['Values for attribute ''' char(attribute(iattribute)) ''' refreshed'],handles); |
---|
732 | |
---|
733 | % --- Executes on selection change in listbox_log. |
---|
734 | function listbox_log_Callback(hObject, eventdata, handles) |
---|
735 | % hObject handle to listbox_log (see GCBO) |
---|
736 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
737 | % handles structure with handles and user data (see GUIDATA) |
---|
738 | |
---|
739 | % Hints: contents = get(hObject,'String') returns listbox_log contents as cell array |
---|
740 | % contents{get(hObject,'Value')} returns selected item from listbox_log |
---|
741 | |
---|
742 | |
---|
743 | % --- Executes during object creation, after setting all properties. |
---|
744 | function listbox_log_CreateFcn(hObject, eventdata, handles) |
---|
745 | % hObject handle to listbox_log (see GCBO) |
---|
746 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
747 | % handles empty - handles not created until after all CreateFcns called |
---|
748 | |
---|
749 | % Hint: listbox controls usually have a white background on Windows. |
---|
750 | % See ISPC and COMPUTER. |
---|
751 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
752 | set(hObject,'BackgroundColor','white'); |
---|
753 | end |
---|
754 | |
---|
755 | |
---|
756 | function writelog(strvalue, handles) |
---|
757 | % Add stuff in the logging window |
---|
758 | |
---|
759 | str = get(handles.listbox_log, 'String'); |
---|
760 | str = {str{:} [datestr(now) ': ' strvalue]}; |
---|
761 | % update logging window |
---|
762 | set(handles.listbox_log, 'String',str,'ListBoxTop',length(str)); |
---|
763 | |
---|
764 | |
---|
765 | % --- Executes on selection change in listbox_dev_property. |
---|
766 | function listbox_dev_property_Callback(hObject, eventdata, handles) |
---|
767 | % hObject handle to listbox_dev_property (see GCBO) |
---|
768 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
769 | % handles structure with handles and user data (see GUIDATA) |
---|
770 | |
---|
771 | % Hints: contents = get(hObject,'String') returns listbox_dev_property contents as cell array |
---|
772 | % contents{get(hObject,'Value')} returns selected item from listbox_dev_property |
---|
773 | contents = get(hObject,'String'); |
---|
774 | idx = get(hObject,'Value'); |
---|
775 | |
---|
776 | set(handles.listbox_group,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
777 | set(handles.listbox_attribute,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
778 | set(handles.listbox_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
779 | set(handles.listbox_dev_property,'Value',idx,'ListBoxTop',get(hObject,'ListboxTop')); |
---|
780 | set(handles.checkbox_all,'Value',0); |
---|
781 | |
---|
782 | set(handles.edit_value,'String',contents{idx(1)}); |
---|
783 | |
---|
784 | |
---|
785 | % --- Executes during object creation, after setting all properties. |
---|
786 | function listbox_dev_property_CreateFcn(hObject, eventdata, handles) |
---|
787 | % hObject handle to listbox_dev_property (see GCBO) |
---|
788 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
789 | % handles empty - handles not created until after all CreateFcns called |
---|
790 | |
---|
791 | % Hint: listbox controls usually have a white background on Windows. |
---|
792 | % See ISPC and COMPUTER. |
---|
793 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
794 | set(hObject,'BackgroundColor','white'); |
---|
795 | end |
---|
796 | |
---|
797 | |
---|
798 | % --- Executes on selection change in popupmenu_dev_prop. |
---|
799 | function popupmenu_dev_prop_Callback(hObject, eventdata, handles) |
---|
800 | % hObject handle to popupmenu_dev_prop (see GCBO) |
---|
801 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
802 | % handles structure with handles and user data (see GUIDATA) |
---|
803 | |
---|
804 | % Hints: contents = get(hObject,'String') returns popupmenu_dev_prop contents as cell array |
---|
805 | % contents{get(hObject,'Value')} returns selected item from popupmenu_dev_prop |
---|
806 | contents = get(hObject,'String'); |
---|
807 | num = get(hObject,'Value'); |
---|
808 | devproperty = contents{num}; |
---|
809 | |
---|
810 | setappdata(handles.figure1,'devproperty', devproperty); |
---|
811 | |
---|
812 | |
---|
813 | % --- Executes during object creation, after setting all properties. |
---|
814 | function popupmenu_dev_prop_CreateFcn(hObject, eventdata, handles) |
---|
815 | % hObject handle to popupmenu_dev_prop (see GCBO) |
---|
816 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
817 | % handles empty - handles not created until after all CreateFcns called |
---|
818 | |
---|
819 | % Hint: popupmenu controls usually have a white background on Windows. |
---|
820 | % See ISPC and COMPUTER. |
---|
821 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
822 | set(hObject,'BackgroundColor','white'); |
---|
823 | end |
---|
824 | |
---|
825 | |
---|
826 | |
---|
827 | function edit_dev_propvalue_Callback(hObject, eventdata, handles) |
---|
828 | % hObject handle to edit_dev_propvalue (see GCBO) |
---|
829 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
830 | % handles structure with handles and user data (see GUIDATA) |
---|
831 | |
---|
832 | % Hints: get(hObject,'String') returns contents of edit_dev_propvalue as text |
---|
833 | % str2double(get(hObject,'String')) returns contents of edit_dev_propvalue as a double |
---|
834 | % First of all, ask for confirmation |
---|
835 | answer = questdlg('Do you want to apply change ?','Confirmation dialog box'); |
---|
836 | |
---|
837 | switch answer |
---|
838 | case 'Yes' |
---|
839 | |
---|
840 | % Get the new value |
---|
841 | % Need to force char array |
---|
842 | value = char(get(hObject,'String')); |
---|
843 | |
---|
844 | propertyname = get(handles.edit_dev_propname,'String'); |
---|
845 | propertyvalue = get(handles.edit_dev_propvalue,'String'); |
---|
846 | Family = getappdata(handles.figure1, 'Family'); |
---|
847 | DeviceName = family2tangodev(Family); |
---|
848 | |
---|
849 | iSelected = get(handles.listbox_group,'Value'); |
---|
850 | |
---|
851 | val = tango_get_device_property(DeviceName(iSelected), ... |
---|
852 | propertyname); |
---|
853 | |
---|
854 | %% Get selected element |
---|
855 | if isempty(val) |
---|
856 | writelog(['Cancelled: property ' str2mat(propertyvalue) 'not defined'], handles); |
---|
857 | set(handles.listbox_dev_property,'String', repmat('NaN',size(DeviceName))); |
---|
858 | else |
---|
859 | writelog(['Please wait: writting DEVICE property ' str2mat(propertyvalue) '...'], handles); |
---|
860 | |
---|
861 | tango_set_device_property(DeviceName(iSelected), ... |
---|
862 | propertyname, propertyvalue); |
---|
863 | |
---|
864 | writelog('Device properties written', handles); |
---|
865 | |
---|
866 | % refresh display |
---|
867 | pushbutton_dev_prop_Callback(handles.edit_dev_propvalue,eventdata, handles); |
---|
868 | end |
---|
869 | case {'No','Cancel'} |
---|
870 | return; |
---|
871 | otherwise |
---|
872 | warning('Wrong answer') |
---|
873 | end |
---|
874 | |
---|
875 | |
---|
876 | % --- Executes during object creation, after setting all properties. |
---|
877 | function edit_dev_propvalue_CreateFcn(hObject, eventdata, handles) |
---|
878 | % hObject handle to edit_dev_propvalue (see GCBO) |
---|
879 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
880 | % handles empty - handles not created until after all CreateFcns called |
---|
881 | |
---|
882 | % Hint: edit controls usually have a white background on Windows. |
---|
883 | % See ISPC and COMPUTER. |
---|
884 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
885 | set(hObject,'BackgroundColor','white'); |
---|
886 | end |
---|
887 | |
---|
888 | |
---|
889 | |
---|
890 | function edit_dev_propname_Callback(hObject, eventdata, handles) |
---|
891 | % hObject handle to edit_dev_propname (see GCBO) |
---|
892 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
893 | % handles structure with handles and user data (see GUIDATA) |
---|
894 | |
---|
895 | % Hints: get(hObject,'String') returns contents of edit_dev_propname as text |
---|
896 | % str2double(get(hObject,'String')) returns contents of edit_dev_propname as a double |
---|
897 | |
---|
898 | |
---|
899 | % --- Executes during object creation, after setting all properties. |
---|
900 | function edit_dev_propname_CreateFcn(hObject, eventdata, handles) |
---|
901 | % hObject handle to edit_dev_propname (see GCBO) |
---|
902 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
903 | % handles empty - handles not created until after all CreateFcns called |
---|
904 | |
---|
905 | % Hint: edit controls usually have a white background on Windows. |
---|
906 | % See ISPC and COMPUTER. |
---|
907 | if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor')) |
---|
908 | set(hObject,'BackgroundColor','white'); |
---|
909 | end |
---|
910 | |
---|
911 | |
---|
912 | % --- Executes on button press in pushbutton_dev_prop. |
---|
913 | function pushbutton_dev_prop_Callback(hObject, eventdata, handles) |
---|
914 | % hObject handle to pushbutton_dev_prop (see GCBO) |
---|
915 | % eventdata reserved - to be defined in a future version of MATLAB |
---|
916 | % handles structure with handles and user data (see GUIDATA) |
---|
917 | |
---|
918 | ifamily = get(handles.popupmenu_group,'Value'); |
---|
919 | family = get(handles.popupmenu_group,'String'); |
---|
920 | |
---|
921 | Family = family{ifamily}; |
---|
922 | DeviceName = family2tangodev(Family); |
---|
923 | |
---|
924 | if isempty(Family) |
---|
925 | writelog('No machine loaded!',handles); |
---|
926 | return |
---|
927 | end |
---|
928 | |
---|
929 | val = ones(size(DeviceName))*NaN'; |
---|
930 | valS = repmat('NaN',size(DeviceName)); |
---|
931 | |
---|
932 | property = get(handles.edit_dev_propname,'String'); |
---|
933 | |
---|
934 | val0 = tango_get_device_property(DeviceName,property); |
---|
935 | |
---|
936 | if isempty(val0) |
---|
937 | writelog(['Property ''' property ''' not defined'],handles); |
---|
938 | return; |
---|
939 | end |
---|
940 | |
---|
941 | if iscellstr(val0) |
---|
942 | val = cellstr(val0); |
---|
943 | else |
---|
944 | val = val0; |
---|
945 | end |
---|
946 | |
---|
947 | % unpdate listbox |
---|
948 | set(handles.listbox_dev_property,'String',val); |
---|
949 | % update editbox |
---|
950 | set(handles.edit_value,'String',val(1)); |
---|
951 | set(handles.listbox_attribute,'Value',1); |
---|
952 | set(handles.listbox_group,'Value',1); |
---|
953 | set(handles.listbox_dev_property,'Value',1); |
---|
954 | set(handles.listbox_property,'Value',1); |
---|
955 | % uncheckk buttons |
---|
956 | set(handles.checkbox_all,'Value', 0); |
---|
957 | |
---|
958 | writelog(['Values for property ''' property ''' refreshed'],handles); |
---|
959 | |
---|