Changeset 508 for trunk/src/datatree_browser.m
- Timestamp:
- Jul 31, 2012, 6:55:39 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/datatree_browser.m
r507 r508 80 80 set(handles.UpdateLink,'String','create_link') 81 81 set(handles.MarkupDir,'Visible','on') 82 82 83 83 else% opening by uvmat/Open 84 84 InputDir=regexprep(InputName,'.xml$',''); … … 94 94 set(handles.MarkupDir,'String','CreateLink') 95 95 end 96 end 97 FillExperiments(handles) 98 set(handles.OK,'Visible','on') 99 drawnow 100 96 end 101 97 end 98 FillExperiments(handles) 99 set(handles.OK,'Visible','on') 100 drawnow 102 101 end 103 102 … … 196 195 MirrorPath=''; 197 196 if strcmp(get(handles.LinkDir,'Visible'),'on') 198 MirrorPath=get(handles.LinkDir,'String');197 MirrorPath=get(handles.LinkDir,'String'); 199 198 end 200 199 ListExperiments=get(handles.ListExperiments,'String'); 201 200 if isequal(get(handles.ListExperiments,'Value'),1) 202 ListExperiments=ListExperiments(2:end); %choose all experiments 201 ListExperiments=ListExperiments(2:end); %choose all experiments if the first line '*' has been selected 203 202 else 204 203 ListExperiments=ListExperiments(get(handles.ListExperiments,'Value')); … … 206 205 ListDevices={}; 207 206 207 %% loop on the list of selected experiments 208 208 for iexp=1:numel(ListExperiments) 209 hdir=dir(fullfile(SourcePath,ListExperiments{iexp})); %list files and dirs 209 210 % update the directory of the sources and update the links in the case of a link dir 211 hdir=dir(fullfile(SourcePath,ListExperiments{iexp})); %list files and folders in the source 210 212 for ilist=1:length(hdir) 211 213 Device=hdir(ilist).name; … … 213 215 if ~isempty(MirrorPath)% we list the links to the data directories of files 214 216 link=fullfile(MirrorPath,ListExperiments{iexp},Device); 215 if ~exist(link) 217 if ~exist(link)% create a link if it does not exist 216 218 source=fullfile(SourcePath,ListExperiments{iexp},Device); 217 219 system(['ln -s ' source ' ' link])%TODO translate for DOS … … 228 230 end 229 231 end 230 end 232 233 % check for dir and files in the link dir which do not exist in the source dir 234 if ~isempty(MirrorPath) 235 hdir=dir(fullfile(MirrorPath,ListExperiments{iexp})); %list files and folders in the link dir 236 for ilist=1:length(hdir) 237 Device=hdir(ilist).name; 238 if ~isequal(Device(1),'.') 239 if hdir(ilist).isdir 240 Device=[Device '/']; 241 end 242 check_list=strcmp(Device,ListDevices) | strcmp(['@' Device],ListDevices); 243 if isempty(find(check_list)) 244 ListDevices=[ListDevices;Device]; 245 end 246 end 247 end 248 end 249 end 250 251 %% display the updated list, keeping track of the previously selected item 252 PreviousList=get(handles.ListDevices,'String'); 253 NewValue=[]; 254 if ~isempty(PreviousList)&&iscell(PreviousList) 255 PreviousDevice=PreviousList{get(handles.ListDevices,'Value')}; 256 NewValue=find(strcmp(PreviousDevice,ListDevices)); 257 end 258 if isempty(NewValue) 259 NewValue=1; 260 end 261 set(handles.ListDevices,'Value',NewValue) 231 262 set(handles.ListDevices,'String',ListDevices) 232 263 … … 237 268 %------------------------------------------------------------------------ 238 269 list_val=get(handles.ListExperiments,'Value'); 239 if numel(list_val)~=1240 msgbox_uvmat('ERROR','select a single experiment ')270 if isequal(list_val,1) || numel(list_val)~=1 271 msgbox_uvmat('ERROR','select a single experiment in the column ''Experiments''') 241 272 return 242 273 end … … 253 284 Device=ListDevices{get(handles.ListDevices,'Value')}; 254 285 Device=regexprep(Device,'^@',''); 286 287 %% open the selected file 288 % case of a directory, open a file inside 255 289 if strcmp(Device(end),'/') 256 290 DataDir=fullfile(RootPath,Experiment,Device(1:end-1)); 257 291 DirList=dir(DataDir); 258 292 for ilist=1:numel(DirList) 259 [tild,tild,FileExt]=fileparts(DirList(ilist).name); 260 FileExt=regexprep(FileExt,'^.',''); 261 if ~isempty(FileExt) && (~isempty(imformats(FileExt))||strcmp(lower(FileExt),'avi')||strcmp(lower(FileExt),'nc')) 262 uvmat(fullfile(DataDir,DirList(ilist).name)) 263 return 293 if ~DirList(ilist).isdir 294 [tild,tild,FileExt]=fileparts(DirList(ilist).name); 295 FileExt=regexprep(FileExt,'^.',''); 296 if ~isempty(FileExt) && (~isempty(imformats(FileExt))||strcmp(lower(FileExt),'avi')||strcmp(lower(FileExt),'nc')) 297 uvmat(fullfile(DataDir,DirList(ilist).name)) 298 return 299 end 264 300 end 265 301 end 266 end 267 % 268 % set(handles.ListRecords,'Value',1) 269 % set(handles.ListXml,'Value',1) 270 % ListDevices=get(handles.ListDevices,'String'); 271 % list_val=get(handles.ListDevices,'Value'); 272 % if isequal(list_val,1) 273 % ListDevices=ListDevices(2:end); 274 % else 275 % ListDevices=ListDevices(list_val); 276 % end 277 % [ListDevices,ListRecords,ListXml]=ListDir(CurrentPath,ListExperiments,ListDevices,{}); 278 % set(handles.ListRecords,'String',[{'*'};ListRecords']) 279 % set(handles.ListXml,'String',[{'*'};ListXml']) 302 % open browser if no valid input file has been detected 303 [FileName, PathName] = uigetfile( ... 304 { '*.*', 'All Files (*.*)'}, ... 305 'Pick a mask file *.png',DataDir); 306 if ~isempty(FileName) 307 uvmat(fullfile(PathName,FileName)); 308 return 309 end 310 else %case of a file 311 uvmat(fullfile(RootPath,Experiment,Device)) 312 return 313 end 314 280 315 281 316
Note: See TracChangeset
for help on using the changeset viewer.