Changeset 606 for trunk/src/series.m
- Timestamp:
- Apr 7, 2013, 10:14:45 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/series.m
r605 r606 258 258 function MenuBrowse_Callback(hObject, eventdata, handles) 259 259 %------------------------------------------------------------------------ 260 %get the previous input file in the Input Table 261 oldfile=''; %default 260 262 InputTable=get(handles.InputTable,'Data'); 261 if isempty(InputTable) 262 RootPathCell={}; 263 else 264 RootPathCell=InputTable(:,1); 265 end 266 oldfile=''; %default 267 if isempty(RootPathCell)||isequal(RootPathCell,{''})%loads the previously stored file name and set it as default in the file_input box 268 dir_perso=prefdir; 269 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 270 if exist(profil_perso,'file') 271 h=load (profil_perso); 272 if isfield(h,'filebase')&&ischar(h.filebase) 273 oldfile=h.filebase; 274 end 275 if isfield(h,'RootPath')&&ischar(h.RootPath) 276 oldfile=h.RootPath; 277 end 278 end 279 else 280 SubDirCell=InputTable(:,2); 281 RootFileCell=InputTable(:,3); 282 oldfile=fullfile(RootPathCell{1},SubDirCell{1},RootFileCell{1}); 283 end 284 [FileName, PathName] = uigetfile( ... 285 {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; 286 '*.xml', '.xml files '; ... 287 '*.xls', '.xls files '; ... 288 '*.png','.png image files'; ... 289 '*.tif','.tif image files'; ... 290 '*.avi;*.AVI','.avi movie files'; ... 291 '*.nc','.netcdf files'; ... 292 '*.*', 'All Files (*.*)'}, ... 293 'Pick a file',oldfile); 294 fileinput=[PathName FileName];%complete file name 295 if isempty(fileinput),return;end %abandon if no file is introduced by the browser 296 [path,name,ext]=fileparts(fileinput); 297 if isequal(ext,'.xml') 298 [Param,Heading]=xml2struct(fileinput); 299 if ~strcmp(Heading,'Series') 300 msg_box_uvmat('ERROR','xml file heading is not <Series>') 301 else 302 fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file 303 if isfield(Param,'CheckObject')&& Param.CheckObject 304 set_object(Param.ProjObject) 305 end 306 set(handles.REFRESH,'UserData',1:size(Param.InputTable,1)) 307 REFRESH_Callback([],[], handles) 308 return 309 end 310 elseif isequal(ext,'.xls') 311 msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 312 else 263 if isequal(InputTable(:,1),[{''};{''};{''};{''}])%open the personal file for empty previous input 264 dir_perso=prefdir; 265 profil_perso=fullfile(dir_perso,'uvmat_perso.mat'); 266 if exist(profil_perso,'file') 267 h=load (profil_perso); 268 if isfield(h,'RootPath')&&ischar(h.RootPath) 269 oldfile=h.RootPath; 270 end 271 end 272 else% select the previous file as the first line of the input table 273 oldfile=fullfile(InputTable{1,1},InputTable{1,2},InputTable{1,3}); 274 end 275 hfig=uigetfile_uvmat('file browser',fileparts(fileparts(oldfile))); 276 uiwait(hfig); 277 if ishandle(hfig) % stop if browser closed without selection 278 fileinput=get(hfig,'UserData');% retrieve the input file selection 279 delete(hfig) 313 280 display_file_name(handles,fileinput,0) 314 281 end 282 % 283 % [FileName, PathName] = uigetfile( ... 284 % {'*.xml;*.xls;*.png;*.tif;*.avi;*.AVI;*.nc', ' (*.xml,*.xls, *.png,*.tif, *.avi,*.nc)'; 285 % '*.xml', '.xml files '; ... 286 % '*.xls', '.xls files '; ... 287 % '*.png','.png image files'; ... 288 % '*.tif','.tif image files'; ... 289 % '*.avi;*.AVI','.avi movie files'; ... 290 % '*.nc','.netcdf files'; ... 291 % '*.*', 'All Files (*.*)'}, ... 292 % 'Pick a file',oldfile); 293 % fileinput=[PathName FileName];%complete file name 294 % [path,name,ext]=fileparts(fileinput); 295 % if isequal(ext,'.xml') 296 % [Param,Heading]=xml2struct(fileinput); 297 % if ~strcmp(Heading,'Series') 298 % msg_box_uvmat('ERROR','xml file heading is not <Series>') 299 % else 300 % fill_GUI(Param,handles.series);%fill the GUI with the parameters retrieved from the xml file 301 % if isfield(Param,'CheckObject')&& Param.CheckObject 302 % set_object(Param.ProjObject) 303 % end 304 % set(handles.REFRESH,'UserData',1:size(Param.InputTable,1)) 305 % REFRESH_Callback([],[], handles) 306 % return 307 % end 308 % elseif isequal(ext,'.xls') 309 % msg_box_uvmat('ERROR','input file type not implemented')%A Faire: ouvrir le fichier pour naviguer 310 % else 311 % display_file_name(handles,fileinput,0) 312 % end 315 313 316 314 % -------------------------------------------------------------------- … … 2006 2004 end 2007 2005 set(handles.FieldTransform,'Visible',FieldTransformVisible) 2006 if isfield(ParamOut,'TransformPath') 2007 set(handles.ActionExt,'UserData',ParamOut.TransformPath) 2008 else 2009 set(handles.ActionExt,'UserData',[]) 2010 end 2008 2011 2009 2012 %% Visibility of projection object … … 2227 2230 function CheckObject_Callback(hObject, eventdata, handles) 2228 2231 %------------------------------------------------------------------------ 2232 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle 2229 2233 value=get(handles.CheckObject,'Value'); 2230 2234 if value 2231 % set(handles.CheckObject,'BackgroundColor',[1 1 0])%put unactivated buttons to yellow 2232 hset_object=findobj(allchild(0),'tag','set_object');%find the set_object interface handle 2233 if ishandle(hset_object) 2234 uistack(hset_object,'top')% show the GUI set_object if opened 2235 else 2236 %get the object file 2237 InputTable=get(handles.InputTable,'Data'); 2238 defaultname=InputTable{1,1}; 2239 if isempty(defaultname) 2240 defaultname={''}; 2241 end 2242 [FileName, PathName] = uigetfile( ... 2243 {'*.xml;*.mat', ' (*.xml,*.mat)'; 2244 '*.xml', '.xml files '; ... 2245 '*.mat', '.mat matlab files '}, ... 2246 'Pick an xml object file (or use uvmat to create it)',defaultname); 2247 fileinput=[PathName FileName];%complete file name 2248 sizf=size(fileinput); 2249 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 2250 %read the file 2251 data=xml2struct(fileinput); 2252 if ~isfield(data,'Type') 2253 msgbox_uvmat('ERROR',[fileinput ' is not an object xml file']) 2254 return 2255 end 2256 if ~isfield(data,'ProjMode') 2257 data.ProjMode='none'; 2258 end 2259 hset_object=set_object(data);% call the set_object interface 2260 end 2261 ProjObject=read_GUI(hset_object); 2262 set(handles.ProjObject,'String',ProjObject.Name);%display the object name 2263 SeriesData=get(handles.series,'UserData'); 2264 SeriesData.ProjObject=ProjObject; 2265 set(handles.series,'UserData',SeriesData); 2266 set(handles.DeleteObject,'Visible','on'); 2267 set(handles.ViewObject,'Visible','on'); 2268 set(handles.ProjObject,'Visible','on'); 2235 SeriesData=get(handles.series,'UserData'); 2236 if ~(isfield(SeriesData,'ProjObject')&&~isempty(SeriesData.ProjObject)) 2237 if ishandle(hset_object) 2238 uistack(hset_object,'top')% show the GUI set_object if opened 2239 else 2240 %get the object file 2241 InputTable=get(handles.InputTable,'Data'); 2242 defaultname=InputTable{1,1}; 2243 if isempty(defaultname) 2244 defaultname={''}; 2245 end 2246 [FileName, PathName] = uigetfile( ... 2247 {'*.xml;*.mat', ' (*.xml,*.mat)'; 2248 '*.xml', '.xml files '; ... 2249 '*.mat', '.mat matlab files '}, ... 2250 'Pick an xml object file (or use uvmat to create it)',defaultname); 2251 fileinput=[PathName FileName];%complete file name 2252 sizf=size(fileinput); 2253 if (~ischar(fileinput)||~isequal(sizf(1),1)),return;end 2254 %read the file 2255 data=xml2struct(fileinput); 2256 if ~isfield(data,'Type') 2257 msgbox_uvmat('ERROR',[fileinput ' is not an object xml file']) 2258 return 2259 end 2260 if ~isfield(data,'ProjMode') 2261 data.ProjMode='none'; 2262 end 2263 hset_object=set_object(data);% call the set_object interface 2264 end 2265 ProjObject=read_GUI(hset_object); 2266 set(handles.ProjObject,'String',ProjObject.Name);%display the object name 2267 SeriesData=get(handles.series,'UserData'); 2268 SeriesData.ProjObject=ProjObject; 2269 set(handles.series,'UserData',SeriesData); 2270 end 2271 set(handles.DeleteObject,'Visible','on'); 2272 set(handles.ViewObject,'Visible','on'); 2273 set(handles.ProjObject,'Visible','on'); 2269 2274 else 2270 set(handles.DeleteObject,'Visible','off'); 2271 set(handles.ViewObject,'Visible','off'); 2272 set(handles.ProjObject,'Visible','off'); 2273 % set(handles.CheckObject,'BackgroundColor',[0.7 0.7 0.7])%put activated buttons to green 2275 set(handles.DeleteObject,'Visible','off'); 2276 set(handles.ViewObject,'Visible','off'); 2277 if ~ishandle(hset_object) 2278 set(handles.ViewObject,'Value',0); 2279 end 2280 set(handles.ProjObject,'Visible','off'); 2274 2281 end 2275 2282 %set(handles.series,'UserData',SeriesData) … … 2465 2472 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 2466 2473 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@stop_status); 2467 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI);2474 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','points','FontSize',11,'Callback',@refresh_GUI); 2468 2475 %set(hrefresh,'UserData',StatusData) 2469 2476 BarPosition=[0.05 0.81 0.01 0.05]; … … 2471 2478 drawnow 2472 2479 end 2473 refresh_GUI(h refresh,[])2480 refresh_GUI(hfig) 2474 2481 else 2475 2482 %% delete current display fig if selection is off … … 2526 2533 %------------------------------------------------------------------------ 2527 2534 % launched by refreshing the status figure 2528 function refresh_GUI(hObject, eventdata) 2529 %------------------------------------------------------------------------ 2530 hfig=get(hObject,'parent'); 2535 function refresh_GUI(hfig) 2536 %------------------------------------------------------------------------ 2531 2537 htitlebox=findobj(hfig,'tag','titlebox'); 2532 2538 hlist=findobj(hfig,'tag','list'); … … 2556 2562 ListDisplay=ListDisplay(datnum~=0); 2557 2563 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files 2564 NbOutputFile=[]; 2558 2565 if isempty(datnum) 2559 2566 if testrecent … … 2676 2683 ActionList=get(handles.ActionName,'String'); 2677 2684 ActionName=ActionList{get(handles.ActionName,'Value')}; 2685 TransformPath=''; 2686 if ~isempty(get(handles.ActionExt,'UserData')) 2687 TransformPath=get(handles.ActionExt,'UserData'); 2688 end 2678 2689 if strcmp(ActionExt,'.sh') 2690 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2679 2691 ActionFullName=fullfile(get(handles.ActionPath,'String'),[ActionName '.sh']); 2680 2692 if ~exist(ActionFullName,'file') 2681 2693 answer=msgbox_uvmat('INPUT_Y-N','compiled version has not been created: compile now?'); 2682 2694 if strcmp(answer,'Yes') 2695 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2696 path_uvmat=fileparts(which('series')); 2683 2697 currentdir=pwd; 2684 cd(get(handles.ActionPath,'String')) 2685 compile(ActionName) 2698 cd(get(handles.ActionPath,'String'))% go to the directory of Action 2699 % addpath(get(handles.TransformPath,'String')) 2700 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 2701 % addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 2702 compile(ActionName,TransformPath) 2686 2703 cd(currentdir) 2687 2704 end 2688 end 2689 sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh'])); 2690 m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m'])); 2691 if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum 2692 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2693 drawnow 2694 answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']); 2695 if strcmp(answer,'Yes') 2696 currentdir=pwd; 2697 cd(get(handles.ActionPath,'String')) 2698 compile(ActionName) 2699 cd(currentdir) 2700 end 2701 set(handles.ActionExt,'BackgroundColor',[1 1 1]) 2702 end 2705 2706 else 2707 sh_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.sh'])); 2708 m_file_info=dir(fullfile(get(handles.ActionPath,'String'),[ActionName '.m'])); 2709 if isfield(m_file_info,'datenum') && m_file_info.datenum>sh_file_info.datenum 2710 set(handles.ActionExt,'BackgroundColor',[1 1 0]) 2711 drawnow 2712 answer=msgbox_uvmat('INPUT_Y-N',[ActionName '.sh needs to be updated: recompile now?']); 2713 if strcmp(answer,'Yes') 2714 path_uvmat=fileparts(which('series')); 2715 currentdir=pwd; 2716 cd(get(handles.ActionPath,'String'))% go to the directory of Action 2717 % addpath(get(handles.TransformPath,'String')) 2718 addpath(path_uvmat)% add the path to uvmat to run the fct 'compile' 2719 addpath(fullfile(path_uvmat,'transform_field'))% add the path to uvmat to run the fct 'compile' 2720 compile(ActionName,TransformPath) 2721 cd(currentdir) 2722 end 2723 end 2724 end 2725 set(handles.ActionExt,'BackgroundColor',[1 1 1]) 2703 2726 end 2704 2727 … … 2717 2740 set(handles.DeleteObject,'Visible','off') 2718 2741 set(handles.ViewObject,'Visible','off') 2742 set(handles.DeleteObject,'Value',0) 2719 2743 end 2720 2744
Note: See TracChangeset
for help on using the changeset viewer.