Changeset 147


Ignore:
Timestamp:
Oct 22, 2010, 12:41:54 PM (7 years ago)
Author:
tjniskan
Message:
  • Added support for Windows network paths (
    server\share) to

aedes_juigetfiles.m (Windows only)

  • Added a link for suppressing the license information from printing to

workspace

  • Fixed some uicontrol colors in aedes_headerbrowser.m
  • Changed the buffer size for reading VNMR PROCPAR to 1MB. The

previous buffer size (10kB) was apparently too low for some SWIFT data

  • aedes_killfigs.m now has an option to force close only Aedes-related

figures

  • Updated figure tags for aedes_killfigs.m
  • Added a request for restarting Aedes to the "Update successful" dialog

M aedes_readprocpar.m
M aedes_killfigs.m
M aedes_data_read.m
M aedes_gui_defaults.m
M aedes_resviewer.m
M aedes.m
M aedes_update.m
M aedes_export_gui.m
M aedes_headerbrowser.m
M aedes_revision.m
M aedes_juigetfiles.m
M aedes_errordump.m

Files:
12 edited

Legend:

Unmodified
Added
Removed
  • aedes.m

    r146 r147  
    5252%
    5353% Department of Physics, Department of Neurobiology
    54 % University of Kuopio, FINLAND
     54% University of Eastern Finland, Kuopio, FINLAND
    5555%
    5656% This program may be used under the terms of the GNU General Public
     
    9797end
    9898
     99% Detect Matlab version
     100Dat.MatlabVersion = aedes_getmatlabversion;
     101
    99102% Show license and warranty notification ----------------
    100103%
     
    105108  l_PrintLicense([],[]);
    106109end
    107 
    108 % Detect Matlab version
    109 Dat.MatlabVersion = aedes_getmatlabversion;
    110110
    111111
     
    547547  'callback','aedes_readfidprefs',...
    548548  'enable','on');
    549 resview_h = uimenu(tools_h,'Label','Results Viewer', ...  'callback','aedes_resviewer',...
     549resview_h = uimenu(tools_h,'Label','Results Viewer', ... 
     550  'callback','aedes_resviewer',...
    550551  'enable','on',...
    551552  'separator','on');
     
    43854386    'Name','Image Overlay Controls',...
    43864387    'numbertitle','off',...
     4388    'tag','aedes_overlay_controls_fig',...
    43874389    'Toolbar','none',...
    43884390    'Color',FigColor,...
     
    1054110543  fprintf(1,'*\n')
    1054210544  fprintf(1,'* Department of Physics, Department of Neurobiology\n');
    10543   fprintf(1,'* University of Eastern Finland, FINLAND\n');
     10545  fprintf(1,'* University of Eastern Finland, Kuopio, FINLAND\n');
    1054410546  fprintf(1,'*\n')
    1054510547  fprintf(1,'* This program may be used under the terms of the GNU General Public\n');
     
    1055210554  fprintf(1,'*\n')
    1055310555  fprintf(1,'*\n')
    10554   fprintf(1,'* NOTE: You can suppress this license notification by typing the following\n')
    10555   fprintf(1,'* in the Matlab command window:\n');
    10556   fprintf(1,'* setpref(''Aedes'',''ShowLicenseAtStartUp'',false)\n');
     10556  if Dat.MatlabVersion>=7.05
     10557    fprintf(1,'* NOTE: You can suppress this license notification by ');
     10558    fprintf(1,'<a href="matlab:setpref(''Aedes'',''ShowLicenseAtStartUp'',false)">clicking here</a>\n');
     10559  else
     10560    fprintf(1,'* NOTE: You can suppress this license notification by typing the following\n')
     10561    fprintf(1,'* in the Matlab command window:\n');
     10562    fprintf(1,'* setpref(''Aedes'',''ShowLicenseAtStartUp'',false)\n');
     10563  end
    1055710564  fprintf(1,'****************************************************************************\n');
    1055810565 
  • aedes_data_read.m

    r146 r147  
    366366    OrientImages = getpref('Aedes','ReadfidOrientImages');
    367367  else
    368     OrientImages = 'off';
     368    OrientImages = 'on';
    369369  end
    370370 
  • aedes_errordump.m

    r80 r147  
    4848  % Error dialog
    4949  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
    50   hh=errordlg({['An unexpected error has occurred with Aedes!',...
     50  hh=errordlg({['Oops... An unhandeled error has occurred in Aedes! ',...
    5151        'This is probably a bug. ',...
    52         'The error dump was written into following file:'],...
     52        'An error dump was written into the following file:'],...
    5353        ['"',error_dir,error_fname,'"'],'','',...
    5454        'The returned error message was:',...
     
    5858        'workspace. This will delete ALL currently open Matlab figures ' ...
    5959        'with brute force!!!']},...
    60         'UNEXPECTED ERROR','modal');
     60        'UNHANDELED ERROR!','modal');
    6161end
  • aedes_export_gui.m

    r138 r147  
    131131                     'Name','Export Dialog', ...
    132132                     'Numbertitle','off', ...
    133                      'Tag','export_fig', ...
     133                     'Tag','aedes_export_fig', ...
    134134                     'Color',GD.col.mainfig, ...
    135135                     'Toolbar','none', ...
  • aedes_gui_defaults.m

    r144 r147  
    7575  Dat.col.radio_btn  = [0.72 0.72 0.82];
    7676  Dat.col.toggle_btn = [0.72 0.72 0.82];
    77   Dat.col.edit       = [0.92 0.92 1];
     77  Dat.col.edit       = [1 1 1];
    7878  Dat.col.checkbox   = Dat.col.subframe; %[0.72 0.72 0.82];
    7979  Dat.col.listbox    = [0.72 0.72 0.82];
    80   Dat.col.popup      = [0.72 0.72 0.82];
     80  Dat.col.popup      = [1 1 1];
    8181  %Dat.col.slider     = [0.398 0.398 0.578];
    8282  Dat.col.slider     = [166 179 201]./255;
  • aedes_headerbrowser.m

    r146 r147  
    166166  set(H.DataTableJavaHandle.KeyPressedCallback,@l_KeyPressFcn)
    167167end
    168 assignin('base','H',H) % debug
     168
     169% For debuging
     170%assignin('base','H',H) % debug
    169171
    170172%% ------------------------------------------
  • aedes_juigetfiles.m

    r143 r147  
    8585          'DockControls','off',...
    8686          'renderer','painters',...
    87           'closereq','uiresume(gcbf)',...
    88           'windowstyle','modal',...
     87          'closereq','uiresume(gcbf)',...'windowstyle','modal',...
    8988          'handlevisibility','off',...
    9089          'resize','off',...
     
    127126end
    128127
    129 set(tree,'NodeExpandedCallback',{@l_ExpFcnAlt,tree})
     128
    130129
    131130%% Create uitree for files ---------------------------
     
    135134  filetree = uitree(fh,'position',[pos(1)+pos(3)+5 pos(2) 220 pos(4)]);
    136135end
    137 set(filetree,'MultipleSelectionEnabled',true,...
    138              'NodeCollapsedCallback',{@l_FileTreeNodeCollapsed,filetree},...
    139              'NodeExpandedCallback',{@l_OpenDirectory,tree,1});
     136
    140137%'NodeSelectedCallback',{@l_FileTreeNodeSelected,filetree},...
    141138if version_number>=7.06
     
    147144filetree.reloadNode(fileroot);
    148145
    149 %% Set NodeSelected callback for directory tree
    150 set(tree,'NodeSelectedCallback',{@l_DirNodeSelected,tree,filetree});
     146
    151147
    152148%% Create selected files uitree
     
    159155  selfiletree = uitree(fh,'Root',selfiletreeroot,'position',[pos(1)+pos2(3)+pos(3)+100 pos(2) 220 pos(4)]);
    160156end
    161 set(selfiletree,'DndEnabled',true);
    162 set(selfiletree,'MultipleSelectionEnabled',true);
    163 set(selfiletree,'NodeDroppedCallback',{@l_SelFileTreeNodeDropped,selfiletree});
    164 
    165 
    166 % Expand My Computer
    167 tree.expand(rootnode);
     157
     158
     159
     160
    168161
    169162%% UICONTROLS ----------------------------------
     
    378371setappdata(H.fh,'H',H)
    379372
     373%% Set tree callbacks and options
     374set(tree,'NodeExpandedCallback',{@l_ExpFcnAlt,tree})
     375set(filetree,'MultipleSelectionEnabled',true,...
     376             'NodeCollapsedCallback',{@l_FileTreeNodeCollapsed,filetree},...
     377             'NodeExpandedCallback',{@l_OpenDirectory,tree,1});
     378set(tree,'NodeSelectedCallback',{@l_DirNodeSelected,tree,filetree});
     379set(selfiletree,'DndEnabled',true);
     380set(selfiletree,'MultipleSelectionEnabled',true);
     381set(selfiletree,'NodeDroppedCallback',{@l_SelFileTreeNodeDropped,selfiletree});
     382
     383% Expand My Computer
     384tree.expand(rootnode);
     385
    380386% Try to open default directory
    381387if ~ischar(defaultdir)
     
    437443% $$$   r=java.io.File.listRoots;
    438444% $$$   for n=1:length(r)
    439 % $$$     drives{n} = char(r(n).toString);
     445% $$$     drive s{n} = char(r(n).toString);
    440446% $$$   end
    441447% $$$   
     
    509515if ~tree.isLoaded(evdnode)
    510516
    511   if strcmpi(value,'My Computer')
     517
     518        if strcmpi(value,'My Computer')
    512519   
    513520    %% Use Java to determine available drives, as using DIR is veeryy
     
    532539    end
    533540        end
    534   else
    535     count = 0;
    536     ch = dir(value);
    537     if isempty(ch)
     541        else
     542               
     543                if ispc && length(value)>=4 && strcmpi(value(1:2),'\\') && ...
     544                                length(find(value=='\'))==3
     545                       
     546                        % Handle Windows network shares
     547                        [t,s]=dos(['net view ',value]);
     548                        if t~=0
     549                                directories = {'.','..'};
     550                        else
     551                                % Use regexp to find share names
     552                                tmp=regexp(s,'([\w-\$]+)\s+Disk','tokens');
     553                                directories=cat(1,tmp{:});
     554                        end
     555                        count = 0;
     556                else
     557                        count = 0;
     558                        ch = dir(value);
     559                        if isempty(ch)
     560                                directories = {};
     561                        else
     562                                directories = {ch([ch(:).isdir]).name};
     563                        end
     564                end
     565               
     566   
     567                if isempty(directories)
    538568      %tmp=tree.SelectedNodes;
    539569      %node = handle(tmp(1));
     
    549579      return
    550580    else
    551       directories = {ch([ch(:).isdir]).name};
    552           if isunix
    553                 % Hide hidden directories in Linux
    554                 ind = regexp(directories,'^\.');
    555                 directories = {directories{cellfun('isempty',ind)}};
    556           end
    557     end
     581      %directories = {ch([ch(:).isdir]).name};
     582                        if isunix
     583                                % Hide hidden directories in Linux
     584                                ind = regexp(directories,'^\.');
     585                                directories = {directories{cellfun('isempty',ind)}};
     586                        end
     587                end
    558588   
    559589    for ii=1:length(directories)
     
    650680% Get selected node
    651681currentnode=tree.getSelectedNodes;
    652 currentnode=handle(currentnode(1));
     682if isempty(currentnode)
     683        set(H.fh,'pointer','arrow')
     684  return
     685else
     686        currentnode=handle(currentnode(1));
     687end
    653688
    654689% Get path
     
    668703
    669704% Try to get file information from the path
    670 ch=dir(path);
     705if strncmp(path,'\\',2) && length(find(path=='\'))==3
     706        [t,s]=dos(['net view ',path]);
     707        if t~=0
     708                %directories = {'.','..'};
     709                ch = [];
     710        else
     711                % Use regexp to find share names
     712                tmp=regexp(s,'([\w-\$]+)\s+Disk','tokens');
     713                directories=cat(1,tmp{:});
     714                ch = 1;
     715        end
     716        filenames = {};
     717else
     718        ch=dir(path);
     719        filenames={ch(~[ch(:).isdir]).name};
     720        directories={ch([ch(:).isdir]).name};
     721end
     722
    671723if isempty(ch)
    672724  %rootnode = uitreenode(['Cannot access ' path],['Cannot access 'path],'',false);
     
    714766
    715767% Filter filenames
    716 filenames={ch(~[ch(:).isdir]).name};
     768
    717769filter_val=get(H.filefilter_popup,'value');
    718770if ~isempty(hCaller) && hCaller~=H.customfilter_popup
     
    734786%   end
    735787end
    736 directories={ch([ch(:).isdir]).name};
     788
     789
    737790if isunix
    738791  % Hide hidden directories in Linux
     
    11221175  directory=tmp.getValue;
    11231176end
     1177
    11241178% Check that directory exists
    1125 if ~isdir(directory)
     1179if ~isdir(directory) && ( ~ispc | ~strncmp(directory,'\\',2) )
    11261180  h=errordlg({['Cannot open folder "' directory '".'],['Make sure the path is ' ...
    11271181                      'correct.']},'Cannot open folder','modal');
    11281182  set(H.fh,'pointer','arrow')
    11291183  return
     1184elseif strncmp(directory,'\\',2) && ispc
     1185        % Test if the Windows computer is accessible
     1186        ind=find(directory=='\');
     1187        if ind<3
     1188                str = directory;
     1189        else
     1190                str = directory(1:ind(3)-1);
     1191        end
     1192        [t,s]=dos(['net view ',str]);
     1193        if t~=0
     1194                h=errordlg(s,'Cannot open folder','modal');
     1195                set(H.fh,'pointer','arrow')
     1196                return
     1197        end
    11301198end
    11311199if ~strcmp(directory(end),filesep)
     
    11681236rootnode = tree.getRoot;
    11691237
    1170 
    1171 ind=find(directory==filesep);
     1238% Get Matlab version
     1239version_number = aedes_getmatlabversion;
     1240
     1241% Split the directory using file separator
     1242if ispc
     1243        sDir = regexp(directory,'\\','split');
     1244        if isempty(sDir{1})
     1245                % Windows network drive
     1246                sDir([1 2])=[];
     1247                sDir{1} = ['\\',sDir{1},'\'];
     1248                childcount=rootnode.getChildCount;
     1249                nodeFound = false;
     1250                for kk=1:childcount
     1251                        tmp=rootnode.getChildAt(kk-1);
     1252                        name=tmp.getName;
     1253                        if strcmp(name,sDir{1})
     1254                                nodeFound = true;
     1255                        end
     1256                end
     1257                if ~nodeFound
     1258                        if version_number >= 7.06
     1259                                nodes = uitreenode('v0',sDir{1},sDir{1},'',0);
     1260                        else
     1261                                nodes = uitreenode(sDir{1},sDir{1},'',0);
     1262                        end
     1263                        if length(nodes)==1 && version_number==7.01
     1264                                % Make nodes a JavaArray
     1265                                tmpnodes = nodes;
     1266                                nodes=javaArray('com.mathworks.hg.peer.UITreeNode',1);
     1267                                nodes(1) = java(tmpnodes);
     1268                        end
     1269                        tree.add(rootnode,nodes);
     1270                        %tree.setSelectedNode(nodes);
     1271                        tree.setLoaded(rootnode,true);
     1272                        tree.reloadNode(rootnode);
     1273                        tree.setSelectedNode(nodes);
     1274                end
     1275        else
     1276                sDir{1} = [sDir{1},'\'];
     1277        end
     1278        if isempty(sDir{end})
     1279                sDir(end)=[];
     1280        end
     1281else
     1282        sDir = regexp(directory,'/','split');
     1283        sDir{1}='/';
     1284end
     1285
     1286%ind=find(directory==filesep);
     1287%if ind(1)==1 && ind(2)==2
     1288%       % Windows network share
     1289%       ind(1)=[];
     1290%end
     1291
     1292
    11721293
    11731294%keyboard
     
    11761297start_ind=0;
    11771298currentnode = rootnode;
    1178 for ii=1:length(ind)
    1179   if ii==1
    1180     currentdir=directory(start_ind+1:ind(ii));
    1181   else
    1182     currentdir=directory(start_ind+1:ind(ii)-1);
    1183   end
     1299for ii=1:length(sDir)
     1300  %if ii==1
     1301  %  currentdir=sDir{ii};
     1302  %else
     1303    currentdir=sDir{ii};
     1304  %end
    11841305  childcount=currentnode.getChildCount;
    11851306  for kk=1:childcount
     
    11911312      %tree.reloadNode(tmp);
    11921313      currentnode=tmp;
    1193       if ii~=length(ind)
     1314      if ii~=length(sDir)
    11941315        tree.expand(currentnode)
    11951316      end
     
    12021323    end
    12031324  end
    1204   start_ind = ind(ii);
     1325  %start_ind = ind(ii);
    12051326end
    12061327
     
    12081329%tree.setLoaded(currentnode,true)
    12091330tree.setSelectedNode(currentnode);
     1331drawnow, pause(0.01)
    12101332tree.reloadNode(currentnode);
    12111333set(H.fh,'pointer','arrow')
  • aedes_killfigs.m

    r80 r147  
    1 function aedes_killfigs()
     1function aedes_killfigs(opt)
    22% AEDES_KILLFIGS - Close all Matlab figures (also with hidden handles) with brute force
    33%   
     
    2828% WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
    2929
     30if nargin<1
     31  opt = 'all';
     32end
    3033
    31 % Get handles to all figures (with hidden and normal handles)
    32 H = findall(0,'type','figure');
    33 fprintf(1,'Killing %d figure(s)...\n',length(H))
    34 delete(H);
     34switch opt
     35  case 'all'
     36    % Get handles to all figures (with hidden and normal handles)
     37    H = findall(0,'type','figure');
     38    fprintf(1,'Killing %d figure(s)...\n',length(H))
     39    delete(H);
     40   
     41  case 'aedes'
     42    % Find handles to aedes windows
     43    tags = {'aedes_main_fig','aedes_juigetfiles_main_fig',...
     44      'header_browser_fig','aedes_overlay_controls_fig',...
     45      'aedes_resview_fig','aedes_export_fig'};
     46    for ii=1:length(tags)
     47      h=findall(0,'tag',tags{ii});
     48      delete(h)
     49    end
     50   
     51  otherwise
     52   error('Valid input arguments are ''all'' or ''aedes''!')
     53end
    3554
  • aedes_readprocpar.m

    r139 r147  
    9191%% Read whole file into cell array
    9292try
    93   C = textscan(fid,'%s','delimiter','\n','BufSize',10*1024);
     93  C = textscan(fid,'%s','delimiter','\n','BufSize',1024*1024);
    9494  procpar_str=C{1};
    9595catch
  • aedes_resviewer.m

    r143 r147  
    8989                     'Name','Results viewer', ...
    9090                     'Numbertitle','off', ...
    91                      'Tag','resview_fig', ...
     91                     'Tag','aedes_resview_fig', ...
    9292                     'Color',GD.col.mainfig, ...
    9393                     'Toolbar','none', ...
  • aedes_revision.m

    r146 r147  
    9393% bash-script every time it is called so that this file "aedes_revision.m" is
    9494% always in the list of committed files. DO NOT EDIT THE NEXT LINE!!!
    95 % - Svn Hook -
     95% - SVN Hook -
  • aedes_update.m

    r80 r147  
    157157  if any(strcmpi(opt,{'prompt','semiprompt'}))
    158158    resp=questdlg({['Updated successfully to revision ',num2str(HeadRev),'.'],...
    159       '',...
     159      'Please close all Aedes windows and restart Aedes.','',...
    160160      ['You can use "View Details..." the view the changelog.']},...
    161161      'Update successful','OK','View Details...','View Details...');
Note: See TracChangeset for help on using the changeset viewer.

Powered by Trac 1.0.9.Copyright © Juha-Pekka Niskanen 2008