Changeset 733
- Timestamp:
- Apr 4, 2014, 1:31:34 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/browse_data.m
r651 r733 22 22 function varargout = browse_data(varargin) 23 23 24 % Last Modified by GUIDE v2.5 07-Mar-2013 18:55:0024 % Last Modified by GUIDE v2.5 11-Mar-2014 22:09:37 25 25 26 26 % Begin initialization code - DO NOT EDIT … … 71 71 set(hObject, 'Position', FigPos); 72 72 set(hObject, 'Units', OldUnits); 73 % 74 % if exist('GeometryCalib','var') 75 % DataviewData.GeometryCalib=GeometryCalib; 76 % set(hObject,'UserData',DataviewData) 77 % end 78 if exist('Campaign','var') 73 if exist('Campaign','var') 79 74 [CampaignPath,CampaignName]=fileparts(Campaign); 80 75 RootXml=fullfile(Campaign,[CampaignName '.xml']); … … 94 89 set(handles.CreateMirror,'String','create_mirror') 95 90 end 96 scan_campaign(handles,Campaign) 97 set(handles.OK,'Visible','on') 98 set(handles.Cancel,'Visible','on') 99 set(handles.browse_data,'WindowStyle','modal')% Make the GUI modal 100 set(hObject,'Visible','on') 101 drawnow 102 % UIWAIT makes GUI wait for user response (see UIRESUME) 103 uiwait(handles.browse_data); 91 errormsg=scan_campaign(handles,Campaign); 92 if ~isempty(errormsg) 93 msgbox_uvmat('ERROR',errormsg) 94 return 95 end 96 set(handles.OK,'Visible','on') 97 set(handles.Cancel,'Visible','on') 98 set(handles.browse_data,'WindowStyle','modal')% Make the GUI modal 99 set(hObject,'Visible','on') 100 drawnow 101 % UIWAIT makes GUI wait for user response (see UIRESUME) 102 uiwait(handles.browse_data); 104 103 end 105 104 … … 116 115 function CreateMirror_Callback(hObject, eventdata, handles) 117 116 %------------------------------------------------------------------------ 117 set(handles.SourceDir,'BackgroundColor',[1 1 0])% indicate action of button by yellow color 118 drawnow 118 119 SourceDir=get(handles.SourceDir,'String'); 119 120 [SourcePath,ProjectName]=fileparts(SourceDir); 120 121 if strcmp(get(handles.MirrorDir,'Visible'),'on') 121 MirrorDir=get(handles.MirrorDir,'String'); 122 else 122 MirrorDir=get(handles.MirrorDir,'String');% name of the mirror folder 123 else% create the mirror folder if it does not exist 123 124 MirrorRoot=uigetfile_uvmat('select the folder which must contain the mirror directory:',SourcePath,'uigetdir'); 124 % MirrorRoot=uigetdir('','select the dir which must contain the mirror directory, then press OK'); %file browser125 125 if isempty(MirrorRoot) 126 126 return … … 138 138 set(handles.MirrorDir,'Visible','on') 139 139 end 140 set(handles.SourceDir,'BackgroundColor',[1 1 0])141 drawnow142 140 ExpName={''}; 141 142 %% update the mirror from the source dir 143 143 if exist(SourceDir,'dir') 144 144 hdir=dir(SourceDir); %list files and dirs 145 145 idir=0; 146 146 for ilist=1:length(hdir) 147 if hdir(ilist).isdir 148 dirname=hdir(ilist).name; 149 if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0') 147 if hdir(ilist).isdir% scan all subfolders 148 dirname=hdir(ilist).name;% 149 if ~isequal(dirname(1),'.')&&~isequal(dirname(1),'0')%skip subfolder beginning by '0' 150 150 idir=idir+1; 151 mirror=fullfile(MirrorDir,hdir(ilist).name); 151 mirror=fullfile(MirrorDir,hdir(ilist).name);% corresponding name in the mirror 152 152 if ~exist(mirror,'dir') 153 mkdir(mirror) 153 mkdir(mirror)% create the mirror folder if it does not exist 154 154 end 155 ExpName{idir}=['+/' hdir(ilist).name]; 155 ExpName{idir}=['+/' hdir(ilist).name];% insert '+/' in the list to show that it is a folder 156 156 end 157 157 % look for the list of 'devices' … … 162 162 set(handles.ListExperiments,'String',[{'*'};ExpName']) 163 163 set(handles.ListExperiments,'Value',1) 164 ListExperiments_Callback(hObject, eventdata, handles) 164 update_experiments(handles,[{'*'};ExpName'],SourceDir,MirrorDir) 165 % ListExperiments_Callback(hObject, eventdata, handles) % list the content of the experiment 165 166 else 166 167 msgbox_uvmat('ERROR',['The input ' SourceDir ' is not a directory']) … … 169 170 170 171 171 % %------------------------------------------------------------------------ 172 % function MirrorDir_Callback(hObject, eventdata, handles) 173 % %------------------------------------------------------------------------ 174 % MirrorDir=get(handles.MirrorDir,'String'); 175 % [tild,MirrorName]=fileparts(MirrorDir); 176 % s=xml2struct(fullfile(MirrorDir,[MirrorName '.xml'])); 177 % set(handles.SourceDir,'String',s.SourceDir) 178 % SourceDir_Callback([],[], handles) 179 180 181 %------------------------------------------------------------------------ 182 function scan_campaign(handles,Campaign) 172 %------------------------------------------------------------------------ 173 function errormsg=scan_campaign(handles,Campaign) 183 174 %------------------------------------------------------------------------ 184 175 %set(handles.SourceDir,'BackgroundColor',[1 1 0]) 185 drawnow176 %drawnow 186 177 %SourceDir=get(handles.SourceDir,'String'); 187 178 %MirrorDir=get(handles.MirrorDir,'String'); 188 179 % ExpName={''}; 180 errormsg=''; 189 181 if exist(Campaign,'dir') 190 182 ListStruct=dir(Campaign); %list files and dirs 183 if numel(ListStruct)>1000% A campaign folder must contain maily a list of 'experiment' sub-folders 184 errormsg=[Campaign ' contains too many items (>1000) to be a Campaign folder']; 185 return 186 end 191 187 ListCells=struct2cell(ListStruct);% transform dir struct to a cell arrray 192 188 ListFiles=ListCells(1,:);%list of dir and file names … … 218 214 list_val=get(handles.ListExperiments,'Value'); 219 215 if isequal(list_val(1),1) 220 ListExperiments=ListExperiments(2:end); %choose all experiments 216 ListExperiments=ListExperiments(2:end); %choose all experiments if the first line '*' is selected 221 217 set(handles.ListExperiments,'Value',1) 222 218 else 223 219 ListExperiments=ListExperiments(list_val);%choose selected experiments 224 220 end 225 scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) 226 227 228 %------------------------------------------------------------------------ 229 % --- Executes on selection change in ListExperiments. 230 %------------------------------------------------------------------------ 231 function scan_experiments(handles,ListExperiments,CampaignPath,MirrorPath) 221 list_dataseries(handles,ListExperiments,MirrorPath) 222 223 %------------------------------------------------------------------------ 224 % --- List the DataSeries when a set of experiments is selected 225 %------------------------------------------------------------------------ 226 function list_dataseries(handles,ListExperiments,MirrorPath) 232 227 233 228 ListDevices={}; … … 235 230 if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory 236 231 ListExperiments{iexp}(1)=[]; 237 ListStruct=dir(fullfile( CampaignPath,ListExperiments{iexp})); %list files and dir in the experiment directory238 ListCells=struct2cell(ListStruct);% 232 ListStruct=dir(fullfile(MirrorPath,ListExperiments{iexp})); %list files and dir in the source experiment directory 233 ListCells=struct2cell(ListStruct);%transform dir struct to a cell arrray 239 234 ListFiles=ListCells(1,:);%list of dir and file names 240 235 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) … … 242 237 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 243 238 for ilist=1:numel(ListFiles) 244 if check_keep(ilist) 245 DataSeries=fullfile(CampaignPath,ListExperiments{iexp},ListFiles{ilist}); 246 if ~isempty(MirrorPath) 247 mirror=fullfile(MirrorPath,ListExperiments{iexp},ListFiles{ilist}); 248 if ~exist(mirror)% create mirror if needed 249 system(['ln -s ' DataSeries ' ' mirror]) 239 if check_keep(ilist)% loop on eligible DataSeries folders 240 mirror=fullfile(MirrorPath,ListExperiments{iexp},ListFiles{ilist});%source folder 241 if ~exist(mirror,'file') && ~exist(mirror,'dir')% if the name is a broken link 242 delete(mirror)% delete broken link 243 else %update the list of dataSeries 244 [tild,msg]=fileattrib(mirror); 245 if ~strcmp(msg.Name,mirror)% if it is a link 246 ListFiles{ilist}=['~' ListFiles{ilist}];%mark link by '@' in the list 250 247 end 251 end252 if isempty(find(strcmp(ListFiles{ilist},ListDevices), 1))% if the item is not already in ListDevices253 248 if check_dir(ilist) 254 249 ListFiles{ilist}=['+/' ListFiles{ilist}];%mark dir by '+' in the list 255 250 end 256 ListDevices=[ListDevices;ListFiles{ilist}]; %append the item to the list 251 if isempty(find(strcmp(ListFiles{ilist},ListDevices), 1))% if the item is not already in ListDevices 252 ListDevices=[ListDevices;ListFiles{ilist}]; %append the item to the list 253 end 254 end 255 end 256 end 257 end 258 end 259 set(handles.ListDevices,'String',sort(ListDevices)) 260 261 %------------------------------------------------------------------------ 262 % --- Executes when the mirror is created or updated 263 %------------------------------------------------------------------------ 264 function update_experiments(handles,ListExperiments,CampaignPath,MirrorPath) 265 266 ListDevices={}; 267 for iexp=1:numel(ListExperiments) 268 if strcmp(ListExperiments{iexp}(1),'+')% if the item is a directory 269 ListExperiments{iexp}(1)=[]; 270 ListStruct=dir(fullfile(CampaignPath,ListExperiments{iexp})); %list files and dir in the source experiment directory 271 ListCells=struct2cell(ListStruct);%transform dir struct to a cell arrray 272 ListFiles=ListCells(1,:);%list of dir and file names 273 cell_remove=regexp(ListFiles,'^(-|\.|\+/\.)');% detect strings beginning by '-' ,'.' or '+/.'(dir beginning by . ) 274 check_keep=cellfun('isempty', cell_remove); 275 check_dir=cell2mat(ListCells(4,:));% =1 for directories, =0 for files 276 for ilist=1:numel(ListFiles) 277 if check_keep(ilist)% loop on eligible DataSeries folders 278 DataSeries=fullfile(CampaignPath,ListExperiments{iexp},ListFiles{ilist});%source folder 279 if ~isempty(MirrorPath) 280 mirror=fullfile(MirrorPath,ListExperiments{iexp},ListFiles{ilist}); 281 if exist(mirror,'dir')||exist(mirror,'file') 282 [tild,msg]=fileattrib(mirror); 283 if strcmp(msg.Name,mirror)%if the mirror name already exists as a local file or dir 284 if msg.directory% case of a f 285 answer=msgbox_uvmat('INPUT_Y-N',['replace local folder ' msg.Name ' by a link to the source dir']); 286 if strcmp(answer,'Yes') 287 [ss,msg]=rmdir(mirror); 288 if ss==1 289 system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder 290 else 291 msgbox_uvmat('ERROR',['enable to delete local folder: ' msg]); 292 end 293 end 294 else 295 answer=msgbox_uvmat('INPUT_Y-N',['replace local file ' msg.Name ' by a link to the source file']); 296 if strcmp(answer,'Yes') 297 delete(mirror); 298 system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder 299 300 end 301 end 302 else% create mirror to the data series if needed 303 system(['ln -s ' DataSeries ' ' mirror]); % create the link to the source folder 304 end 305 end 306 if isempty(find(strcmp(ListFiles{ilist},ListDevices), 1))% if the item is not already in ListDevices 307 if check_dir(ilist) 308 ListFiles{ilist}=['+/' ListFiles{ilist}];%mark dir by '+' in the list 309 end 310 ListDevices=[ListDevices;ListFiles{ilist}]; %append the item to the list 311 end 257 312 end 258 313 end … … 343 398 save(t,outputfile) 344 399 345 % ------------------------------------------------------------------------346 % --- Executes on button press in CampaignDoc.347 function edit_xml_Callback(hObject, eventdata, handles)348 % ------------------------------------------------------------------------349 CurrentPath=get(handles.SourceDir,'String');350 % [CurrentPath,Name,Ext]=fileparts(CurrentDir);351 ListExperiments=get(handles.ListExperiments,'String');352 Value=get(handles.ListExperiments,'Value');353 if ~isequal(Value,1)354 ListExperiments=ListExperiments(Value);355 end356 ListDevices=get(handles.ListDevices,'String');357 Value=get(handles.ListDevices,'Value');358 if ~isequal(Value,1)359 ListDevices=ListDevices(Value);360 end361 ListRecords=get(handles.ListRecords,'String');362 Value=get(handles.ListRecords,'Value');363 if ~isequal(Value,1)364 ListRecords=ListRecords(Value);365 end366 [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords);367 ListXml=get(handles.ListXml,'String');368 Value=get(handles.ListXml,'Value');369 set(handles.ListXml,'Value',Value(1));370 if isequal(Value(1),1)371 msgbox_uvmat('ERROR','an xml file needs to be selected')372 return373 else374 XmlName=ListXml{Value(1)};375 end376 for iexp=1:length(List.Experiment)377 ExpName=List.Experiment{iexp}.name;378 if isfield(List.Experiment{iexp},'Device')379 for idevice=1:length(List.Experiment{iexp}.Device)380 DeviceName=List.Experiment{iexp}.Device{idevice}.name;381 if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile')382 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile)383 FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml};384 if isequal(FileName,XmlName)385 editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName));386 return387 end388 end389 elseif isfield(List.Experiment{iexp}.Device{idevice},'Record')390 for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record)391 RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name;392 if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile')393 for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile)394 FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml};395 if isequal(FileName,XmlName)396 editxml(fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName));397 return398 end399 end400 end401 end402 end403 end404 end405 end406 407 408 409 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%410 % CurrentPath/Campaign: root directory411 function [Title,test_mod]=check_heading(Currentpath,Campaign,Experiment,Device,Record,xmlname,testSubCampaign)412 413 %Shema for Heading:414 % Campaign415 % (SubCampaign)416 % Experiment417 % Device418 % (Record)419 % ImageName420 % DateExp421 % old: %Project: suppressed ( changed to Campaign)422 %Exp: suppressed (changed to experiment)423 %ImaNames: changed to ImageName424 if exist('Record','var') && ~isempty(Record)425 xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,Record,xmlname);426 testrecord=1;427 else428 xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,xmlname);429 testrecord=0;430 end431 if ~exist('testSubCampaign','var')432 testSubCampaign=0;433 end434 if testSubCampaign435 SubCampaign=Campaign;436 [Currentpath,Campaign,DirExt]=fileparts(Currentpath);437 Campaign=[Campaign DirExt];438 end439 test_mod=0; %test for the modification of the xml file440 t_device=xmltree(xmlfullname);441 Title=get(t_device,1,'name');442 uid_child=children(t_device,1);443 Heading_old=[];444 uidheading=0;445 for ilist=1:length(uid_child)446 name=get(t_device,uid_child(ilist),'name');447 if isequal(name,'Heading')448 uidheading=uid_child(ilist);449 end450 end451 if uidheading452 subt=branch(t_device,uidheading);453 Heading_old=convert(subt);454 else455 return % do not edit xml files without element 'Heading'456 end457 if ~(isfield(Heading_old,'Campaign')&& isequal(Heading_old.Campaign,Campaign))458 test_mod=1;459 end460 Heading.Campaign=Campaign;461 if testSubCampaign462 if ~(isfield(Heading_old,'SubCampaign')&& isequal(Heading_old.SubCampaign,SubCampaign))463 test_mod=1;464 end465 Heading.SubCampaign=SubCampaign;466 end467 if ~(isfield(Heading_old,'Experiment')&& isequal(Heading_old.Experiment,Experiment))468 test_mod=1;469 end470 Heading.Experiment=Experiment;471 if ~(isfield(Heading_old,'Device')&& isequal(Heading_old.Device,Device))472 test_mod=1;473 end474 Heading.Device=Device;475 if testrecord476 if ~(isfield(Heading_old,'Record')&& isequal(Heading_old.Record,Record))477 test_mod=1;478 end479 Heading.Record=Record;480 end481 if isfield(Heading_old,'ImaNames')482 test_mod=1;483 if ~isempty(Heading_old.ImaNames)484 Heading.ImageName=Heading_old.ImaNames;485 end486 end487 if isfield(Heading_old,'ImageName')&& ~isempty(Heading_old.ImageName)488 Heading.ImageName=Heading_old.ImageName;489 end490 if isfield(Heading_old,'DateExp')&& ~isempty(Heading_old.DateExp)491 Heading.DateExp=Heading_old.DateExp;492 end493 if test_mod && uidheading494 uid_child=children(t_device,uidheading);495 t_device=delete(t_device,uid_child);496 t_device=struct2xml(Heading,t_device,uidheading);497 backupfile=xmlfullname;498 testexist=2;499 while testexist==2500 backupfile=[backupfile '~'];501 testexist=exist(backupfile,'file');502 end503 [success,message]=copyfile(xmlfullname,backupfile);%make backup504 if isequal(success,1)505 delete(xmlfullname)506 else507 return508 end509 save(t_device,xmlfullname)510 end400 % %------------------------------------------------------------------------ 401 % % --- Executes on button press in CampaignDoc. 402 % function edit_xml_Callback(hObject, eventdata, handles) 403 % %------------------------------------------------------------------------ 404 % CurrentPath=get(handles.SourceDir,'String'); 405 % %[CurrentPath,Name,Ext]=fileparts(CurrentDir); 406 % ListExperiments=get(handles.ListExperiments,'String'); 407 % Value=get(handles.ListExperiments,'Value'); 408 % if ~isequal(Value,1) 409 % ListExperiments=ListExperiments(Value); 410 % end 411 % ListDevices=get(handles.ListDevices,'String'); 412 % Value=get(handles.ListDevices,'Value'); 413 % if ~isequal(Value,1) 414 % ListDevices=ListDevices(Value); 415 % end 416 % ListRecords=get(handles.ListRecords,'String'); 417 % Value=get(handles.ListRecords,'Value'); 418 % if ~isequal(Value,1) 419 % ListRecords=ListRecords(Value); 420 % end 421 % [ListDevices,ListRecords,ListXml,List]=ListDir(CurrentPath,ListExperiments,ListDevices,ListRecords); 422 % ListXml=get(handles.ListXml,'String'); 423 % Value=get(handles.ListXml,'Value'); 424 % set(handles.ListXml,'Value',Value(1)); 425 % if isequal(Value(1),1) 426 % msgbox_uvmat('ERROR','an xml file needs to be selected') 427 % return 428 % else 429 % XmlName=ListXml{Value(1)}; 430 % end 431 % for iexp=1:length(List.Experiment) 432 % ExpName=List.Experiment{iexp}.name; 433 % if isfield(List.Experiment{iexp},'Device') 434 % for idevice=1:length(List.Experiment{iexp}.Device) 435 % DeviceName=List.Experiment{iexp}.Device{idevice}.name; 436 % if isfield(List.Experiment{iexp}.Device{idevice},'xmlfile') 437 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.xmlfile) 438 % FileName=List.Experiment{iexp}.Device{idevice}.xmlfile{ixml}; 439 % if isequal(FileName,XmlName) 440 % editxml(fullfile(CurrentPath,ExpName,DeviceName,FileName)); 441 % return 442 % end 443 % end 444 % elseif isfield(List.Experiment{iexp}.Device{idevice},'Record') 445 % for irecord=1:length(List.Experiment{iexp}.Device{idevice}.Record) 446 % RecordName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.name; 447 % if isfield(List.Experiment{iexp}.Device{idevice}.Record{irecord},'xmlfile') 448 % for ixml=1:length(List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile) 449 % FileName=List.Experiment{iexp}.Device{idevice}.Record{irecord}.xmlfile{ixml}; 450 % if isequal(FileName,XmlName) 451 % editxml(fullfile(CurrentPath,ExpName,DeviceName,RecordName,FileName)); 452 % return 453 % end 454 % end 455 % end 456 % end 457 % end 458 % end 459 % end 460 % end 461 % 462 % 463 % 464 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 465 % % CurrentPath/Campaign: root directory 466 % function [Title,test_mod]=check_heading(Currentpath,Campaign,Experiment,Device,Record,xmlname,testSubCampaign) 467 % 468 % %Shema for Heading: 469 % % Campaign 470 % % (SubCampaign) 471 % % Experiment 472 % % Device 473 % % (Record) 474 % % ImageName 475 % % DateExp 476 % % old: %Project: suppressed ( changed to Campaign) 477 % %Exp: suppressed (changed to experiment) 478 % %ImaNames: changed to ImageName 479 % if exist('Record','var') && ~isempty(Record) 480 % xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,Record,xmlname); 481 % testrecord=1; 482 % else 483 % xmlfullname=fullfile(Currentpath,Campaign,Experiment,Device,xmlname); 484 % testrecord=0; 485 % end 486 % if ~exist('testSubCampaign','var') 487 % testSubCampaign=0; 488 % end 489 % if testSubCampaign 490 % SubCampaign=Campaign; 491 % [Currentpath,Campaign,DirExt]=fileparts(Currentpath); 492 % Campaign=[Campaign DirExt]; 493 % end 494 % test_mod=0; %test for the modification of the xml file 495 % t_device=xmltree(xmlfullname); 496 % Title=get(t_device,1,'name'); 497 % uid_child=children(t_device,1); 498 % Heading_old=[]; 499 % uidheading=0; 500 % for ilist=1:length(uid_child) 501 % name=get(t_device,uid_child(ilist),'name'); 502 % if isequal(name,'Heading') 503 % uidheading=uid_child(ilist); 504 % end 505 % end 506 % if uidheading 507 % subt=branch(t_device,uidheading); 508 % Heading_old=convert(subt); 509 % else 510 % return % do not edit xml files without element 'Heading' 511 % end 512 % if ~(isfield(Heading_old,'Campaign')&& isequal(Heading_old.Campaign,Campaign)) 513 % test_mod=1; 514 % end 515 % Heading.Campaign=Campaign; 516 % if testSubCampaign 517 % if ~(isfield(Heading_old,'SubCampaign')&& isequal(Heading_old.SubCampaign,SubCampaign)) 518 % test_mod=1; 519 % end 520 % Heading.SubCampaign=SubCampaign; 521 % end 522 % if ~(isfield(Heading_old,'Experiment')&& isequal(Heading_old.Experiment,Experiment)) 523 % test_mod=1; 524 % end 525 % Heading.Experiment=Experiment; 526 % if ~(isfield(Heading_old,'Device')&& isequal(Heading_old.Device,Device)) 527 % test_mod=1; 528 % end 529 % Heading.Device=Device; 530 % if testrecord 531 % if ~(isfield(Heading_old,'Record')&& isequal(Heading_old.Record,Record)) 532 % test_mod=1; 533 % end 534 % Heading.Record=Record; 535 % end 536 % if isfield(Heading_old,'ImaNames') 537 % test_mod=1; 538 % if ~isempty(Heading_old.ImaNames) 539 % Heading.ImageName=Heading_old.ImaNames; 540 % end 541 % end 542 % if isfield(Heading_old,'ImageName')&& ~isempty(Heading_old.ImageName) 543 % Heading.ImageName=Heading_old.ImageName; 544 % end 545 % if isfield(Heading_old,'DateExp')&& ~isempty(Heading_old.DateExp) 546 % Heading.DateExp=Heading_old.DateExp; 547 % end 548 % if test_mod && uidheading 549 % uid_child=children(t_device,uidheading); 550 % t_device=delete(t_device,uid_child); 551 % t_device=struct2xml(Heading,t_device,uidheading); 552 % backupfile=xmlfullname; 553 % testexist=2; 554 % while testexist==2 555 % backupfile=[backupfile '~']; 556 % testexist=exist(backupfile,'file'); 557 % end 558 % [success,message]=copyfile(xmlfullname,backupfile);%make backup 559 % if isequal(success,1) 560 % delete(xmlfullname) 561 % else 562 % return 563 % end 564 % save(t_device,xmlfullname) 565 % end 511 566 512 567 %------------------------------------------------------------------------ … … 562 617 %------------------------------------------------------------------------ 563 618 function browse_data_CloseRequestFcn(hObject, eventdata, handles) 564 565 619 if isequal(get(handles.browse_data, 'waitstatus'), 'waiting') 566 620 % The GUI is still in UIWAIT, us UIRESUME 621 handles.output = get(hObject,'String'); 622 guidata(hObject, handles); % Update handles structure 567 623 uiresume(handles.browse_data); 568 624 else … … 589 645 uiresume(handles.browse_data); 590 646 end 647 648 649 % --- Executes during object deletion, before destroying properties. 650 function browse_data_DeleteFcn(hObject, eventdata, handles) -
trunk/src/mouse_down.m
r714 r733 145 145 output=msgbox_uvmat(['uicontrol: ' get(hchild,'Tag')],display_str,get(hchild,'String'),msg_pos); 146 146 %update the parent edit box and indicat that refresh is needed with the new input 147 if strcmp(get(hchild,'Style'),'edit')&&strcmp(get(hchild,'Enable'),'on')147 if ~strcmp(output,'Cancel') && strcmp(get(hchild,'Style'),'edit')&&strcmp(get(hchild,'Enable'),'on') 148 148 set(hchild,'String',output) 149 149 if strcmp(get(get(hchild,'parent'),'tag'),'InputFile') … … 185 185 output=msgbox_uvmat(['uicontrol: ' get(hhchild,'Tag')],display_str,get(hhchild,'String'),msg_pos); 186 186 %update the parent edit box and indicat that refresh is needed with the new input 187 if strcmp(get(hhchild,'Style'),'edit')&&strcmp(get(hhchild,'Enable'),'on')187 if ~strcmp(output,'Cancel') && strcmp(get(hhchild,'Style'),'edit')&&strcmp(get(hhchild,'Enable'),'on') 188 188 set(hhchild,'String',output) 189 189 if strcmp(get(get(hhchild,'parent'),'tag'),'InputFile') … … 229 229 Left=GUI_pos(1)+GUI_pos(3)-Width; %right edge close to the right, with margin=40 230 230 Bottom=GUI_pos(2)+GUI_pos(4)-Height; %put fig at top right 231 %hfig_text=figure('Name','text_display','MenuBar','none','NumberTitle','off','Position',[Left,Bottom,Width,Height]);231 hfig_text=figure('Name','text_display','MenuBar','none','NumberTitle','off','Position',[Left,Bottom,Width,Height]); 232 232 AxeData.htext_display=uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.05 0.9 0.9],'Max',2,'BackgroundColor',[1 1 1],... 233 233 'FontUnits','points','FontSize',14); -
trunk/src/msgbox_uvmat.m
r726 r733 1 1 2 %'msgbox_uvmat': associated with GUI msgbox_uvmat.fig to display message boxes, for error, warning or input calls 2 3 % … … 111 112 end 112 113 set(handles.edit_box, 'String', default_answer); 113 if exist('Position','var') 114 if exist('Position','var')&&numel(Position)>=2 114 115 if iscell(default_answer) 115 116 widthstring=max(max(cellfun('length',default_answer)),length(display_str)); … … 138 139 set(handles.text1, 'Position', [0.15 0.3 0.85 0.7]); 139 140 end 140 % Determine the position of the dialog - centered on the screen141 % FigPos=get(0,'DefaultFigurePosition');142 % OldUnits = get(hObject, 'Units');143 % set(hObject, 'Units', 'pixels');144 % OldPos = get(hObject,'Position');145 % FigWidth = OldPos(3);146 % FigHeight = OldPos(4);147 % ScreenUnits=get(0,'Units');148 % set(0,'Units','pixels');149 % ScreenSize=get(0,'ScreenSize');150 % set(0,'Units',ScreenUnits);151 %152 % FigPos(1)=1/2*(ScreenSize(3)-FigWidth);153 % FigPos(2)=2/3*(ScreenSize(4)-FigHeight);154 % FigPos(3:4)=[FigWidth FigHeight];155 % set(hObject, 'Position', FigPos);156 % set(hObject, 'Units', OldUnits);157 141 158 142 % Show a question icon from dialogicons.mat - variables questIconData and questIconMap … … 254 238 function figure1_CloseRequestFcn(hObject, eventdata, handles) 255 239 %------------------------------------------------------------------------ 256 if isequal(get(handles.figure1, 'waitstatus'), 'waiting') 257 % The GUI is still in UIWAIT, us UIRESUME 258 uiresume(handles.figure1); 259 else 240 % Cancel_Callback(hObject, eventdata, handles) 241 % if isequal(get(handles.figure1, 'waitstatus'), 'waiting') 242 % % The GUI is still in UIWAIT, us UIRESUME 243 % uiresume(handles.figure1); 244 % else 260 245 % The GUI is no longer waiting, just close it 261 delete(handles.figure1); 262 end 246 % delete(handles.figure1); 247 % end 248 % handles.output = get(hObject,'String'); 249 % %handles.output = 'Cancel' 250 % guidata(hObject, handles); % Update handles structure 251 % Use UIRESUME instead of delete because the OutputFcn needs 252 % to get the updated handles structure. 253 % uiresume(handles.figure1); 254 263 255 264 256 %------------------------------------------------------------------------ -
trunk/src/series.m
r727 r733 260 260 set(handles.num_incr_j,'String',num2str(Param.incr_j)) 261 261 end 262 262 set(handles.REFRESH,'BackgroundColor',[1 0 1])% set REFRESH button to magenta color to indicate that input refresh is needed 263 263 264 264 %------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.