Changeset 421 for trunk/src/civ.m
- Timestamp:
- May 14, 2012, 7:03:14 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/civ.m
r419 r421 922 922 if isempty(hfig) 923 923 hfig=figure('DeleteFcn',@stop_status); 924 set(hfig,'MenuBar','none')% suppress the menu bar 925 set(hfig,'NumberTitle','off')%suppress the fig number in the title 924 926 set(hfig,'name','civ_status') 925 uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list'); 927 set(hfig,'tag','civ_status') 928 set(hfig,'UserData',civ_files) 929 hlist= uicontrol('Style','listbox','Units','normalized', 'Position',[0.05 0.09 0.9 0.71], 'Callback', {'open_uvmat'},'tag','list'); 926 930 uicontrol('Style','edit','Units','normalized', 'Position', [0.05 0.87 0.9 0.1],'tag','msgbox','Max',2,'String','checking files...'); 927 931 uicontrol('Style','frame','Units','normalized', 'Position', [0.05 0.81 0.9 0.05]); 928 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','OK','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 932 uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.7 0.01 0.2 0.07],'String','Close','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@close_GUI); 933 hrefresh=uicontrol('Style','pushbutton','Units','normalized', 'Position', [0.1 0.01 0.2 0.07],'String','Refresh','FontWeight','bold','FontUnits','normalized','FontSize',0.9,'Callback',@refresh_GUI); 929 934 BarPosition=[0.05 0.81 0.01 0.05]; 930 hwaitbar=uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 931 drawnow 932 end 935 uicontrol('Style','frame','Units','normalized', 'Position',BarPosition ,'BackgroundColor',[1 0 0],'tag','waitbar'); 936 drawnow 937 end 938 set(hrefresh,'UserData',option_civ) 939 filepath=fileparts(civ_files{1}); 940 set(hlist,'UserData',fileparts(filepath)) 941 refresh_GUI(hrefresh,[]) 942 943 %------------------------------------------------------------------------ 944 % launched by refreshing the status figure 945 function refresh_GUI(hObject, eventdata) 946 %------------------------------------------------------------------------ 933 947 Tabchar={}; 948 BarPosition=[0.05 0.81 0.01 0.05]; 949 hfig=get(hObject,'parent'); 950 civ_files=get(hfig,'UserData'); 951 [filepath,filename,ext]=fileparts(civ_files{1}); 952 [tild,SubDir,extdir]=fileparts(filepath); 953 SubDir=[SubDir extdir]; 954 option_civ=get(hObject,'UserData'); 934 955 nbfiles=numel(civ_files); 935 956 count=0; 936 957 testrecent=0; 937 while count<nbfiles958 % while count<nbfiles 938 959 count=0; 939 960 datnum=zeros(1,nbfiles); … … 976 997 count=count+1; 977 998 end 978 [ rr,filename,ext]=fileparts(civ_files{ifile});979 Tabchar{ifile,1}=[fullfile( [SubDir extdir],filename) ext '...' option_str];999 [filepath,filename,ext]=fileparts(civ_files{ifile}); 1000 Tabchar{ifile,1}=[fullfile(SubDir,filename) ext '...' option_str]; 980 1001 end 981 1002 datnum=datnum(datnum~=0);%keep the non zero values corresponding to existing files … … 990 1011 [first,ind]=min(datnum); 991 1012 [last,indlast]=max(datnum); 992 if test_new993 message='existing file status, no processing launched yet';994 else1013 % if test_new 1014 % message='existing file status, no processing launched yet'; 1015 % else 995 1016 message={[num2str(count) ' file(s) done over ' num2str(nbfiles)] ;['oldest modification: ' cell2mat(filefound(ind)) ' : ' datestr(first)];... 996 1017 ['latest modification: ' cell2mat(filefound(indlast)) ' : ' datestr(last)]}; 997 end998 end 999 hfig=findobj(allchild(0),'name','civ_status');1000 if isempty(hfig)% the status list has been deleted1001 return1002 else1018 % end 1019 end 1020 %hfig=findobj(allchild(0),'name','civ_status'); 1021 % if isempty(hfig)% the status list has been deleted 1022 % return 1023 % else 1003 1024 hlist=findobj(hfig,'tag','list'); 1004 1025 hmsgbox=findobj(hfig,'tag','msgbox'); … … 1006 1027 set(hlist,'String',Tabchar) 1007 1028 set(hmsgbox,'String', message) 1008 if count>0 && ~test_new1029 if count>0 %&& ~test_new 1009 1030 BarPosition(3)=0.9*count/nbfiles; 1010 1031 set(hwaitbar,'Position',BarPosition) 1011 1032 end 1012 end 1013 set(hlist,'UserData',rootroot) 1014 if count<10||(nbfiles-count)<10 1015 pause(.5)% wait 0.5 seconds for next check 1016 else 1017 pause(10)% wait 10 seconds for next check 1018 end 1019 end 1033 % end 1034 % [root,filename,ext]=fileparts(civ_files{1}); 1035 % [rootroot,SubDir,extdir]=fileparts(root); 1036 % 1037 % set(hlist,'UserData',rootroot) 1038 % if count<10||(nbfiles-count)<10 1039 % pause(.5)% wait 0.5 seconds for next check 1040 % else 1041 % pause(10)% wait 10 seconds for next check 1042 % end 1043 % end 1044 1045 %------------------------------------------------------------------------ 1046 % launched by deleting the status figure 1047 function stop_status(hObject, eventdata) 1048 %------------------------------------------------------------------------ 1049 hciv=findobj(allchild(0),'tag','civ'); 1050 hhciv=guidata(hciv); 1051 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ 1052 set(hhciv.status,'BackgroundColor',[0 1 0]) 1053 1054 %------------------------------------------------------------------------ 1055 % launched by pressing OK on the status figure 1056 function close_GUI(hObject, eventdata) 1057 %------------------------------------------------------------------------ 1058 delete(gcbf) 1059 1020 1060 1021 1061 %------------------------------------------------------------------------ … … 1143 1183 for bin_name=binary_list %loop on the list of binaries 1144 1184 if isfield(Param.xml,bin_name{1})% bin_name{1} =current name in the list 1145 if ~exist(Param.xml.(bin_name{1}),'file')%look for the full path if the file name has been defined with a relative path in PARAM.xml 1185 if exist(Param.xml.(bin_name{1}),'file') 1186 [path,name,ext]=fileparts(Param.xml.(bin_name{1})); 1187 currentdir=pwd; 1188 if exist(path,'dir') 1189 cd(path); 1190 binpath=pwd;%path of the binary 1191 Param.xml.(bin_name{1})=fullfile(binpath,[name ext]); 1192 cd(currentdir) 1193 else 1194 errormsg=['path ' path ' for binaries defined in PARAM.xml does not exist']; 1195 return 1196 end 1197 else %look for the full path if the file name has been defined with a relative path in PARAM.xm 1146 1198 fullname=fullfile(path_civ,Param.xml.(bin_name{1})); 1147 1199 if exist(fullname,'file') … … 1151 1203 return 1152 1204 end 1153 else 1154 [path,name,ext]=fileparts(Param.xml.(bin_name{1})); 1155 currentdir=pwd; 1156 cd(path); 1157 binpath=pwd;%path of the binary 1158 Param.xml.(bin_name{1})=fullfile(binpath,[name ext]); 1159 cd(currentdir); 1160 end 1161 1205 end 1162 1206 end 1163 1207 end … … 3215 3259 % end 3216 3260 3217 %------------------------------------------------------------------------3218 % launched by pressing OK on the status figure3219 function close_GUI(hObject, eventdata)3220 %------------------------------------------------------------------------3221 delete(gcbf)3222 3223 %------------------------------------------------------------------------3224 % launched by deleting the status figure3225 function stop_status(hObject, eventdata)3226 %------------------------------------------------------------------------3227 hciv=findobj(allchild(0),'tag','civ');3228 hhciv=guidata(hciv);3229 set(hhciv.status,'value',0) %reset the status uicontrol in the GUI civ3230 set(hhciv.status,'BackgroundColor',[0 1 0])3231 3232 3261 3233 3262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Note: See TracChangeset
for help on using the changeset viewer.