Commit 3d41444b authored by Brad Kennedy's avatar Brad Kennedy
Browse files

Made it possible to set hints for directories in batch context (runhtb.m)

parent ca13a7eb
% find_hinsts_context_config() - returns the value of the varname from
% context_config.misc
%
% Usage:
% >> rval = find_hints_context_config(context_config, varname)
%
% Inputs:
% context_config - context_config from batch context
% varname - name of variable in [<variable>] any/string
%
% Outputs:
% rval - the string from the context_config.misc right side
%
% Copyright (C) 2017 Brock University Cognitive and Affective Neuroscience Lab
%
% Code written by Brad Kennedy
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program (LICENSE.txt file in the root directory); if not,
% write to the Free Software Foundation, Inc., 59 Temple Place,
% Suite 330, Boston, MA 02111-1307 USA
function rval = find_hints_context_config(context_config, varname)
rval = '';
if ~exist('context_config', 'var') || isempty('context_config.misc')
return;
end
exp = '\[(?<key>\w+)\]\s+(?<val>\S+)';
tokens = regexp(context_config.misc, exp, 'names');
for i=1:length(tokens)
if strcmp(tokens{i}.key, varname)
rval = [tokens{i}.val '/'];
return;
end
end
end
......@@ -66,7 +66,10 @@ if nargin < 1
{...
{'Style', 'pushbutton', 'string', 'Batch configuration file', ...
'callback', ...
['[bcfgFName, bcfgFPath] = uigetfile(''*.cfg'',''Select batch configuration file:'',''*.cfg'',''multiselect'',''on'');', ...
['path = ''*.cfg'';' ...
'if exist(''context_config'', ''var''); path = [find_hints_context_config(context_config, ''config_dir'') path]; end;' ...
'[bcfgFName, bcfgFPath] = uigetfile(''*.cfg'',''Select batch configuration file:'',' ...
'path,''multiselect'',''on'');', ...
'if isnumeric(bcfgFName);return;end;', ...
'set(findobj(gcbf,''tag'',''edt_bcp''),''string'',bcfgFPath);', ...
'set(findobj(gcbf,''tag'',''edt_bcn''),''string'',bcfgFName);']} ... %2
......
......@@ -112,7 +112,10 @@ if nargin < 4
{'Style', 'text', 'string',blanks(16)} ... %1 This is just for a blank string of a given length to set the width of the GUI.
{'Style', 'pushbutton', 'string', 'History file', ...
'callback', ...
['[htb_fname, htb_fpath] = uigetfile(''*.htb'',''Select History Template Batch file:'',''*.htb'',''multiselect'',''on'');', ...
['path = ''*.htb'';' ...
'if exist(''context_config'', ''var''); path = [find_hints_context_config(context_config, ''scripts_dir'') path]; end;' ...
'[htb_fname, htb_fpath] = uigetfile(''*.htb'',''Select History Template Batch file:'',' ...
'path,''multiselect'',''on'');', ...
'if isnumeric(htb_fname);return;end;', ...
'set(findobj(gcbf,''tag'',''edt_hfp''),''string'',htb_fpath);', ...
'set(findobj(gcbf,''tag'',''edt_hfn''),''string'',htb_fname);']} ... %2 history file push button
......@@ -120,7 +123,10 @@ if nargin < 4
{'Style', 'edit', 'max', 500, 'tag', 'edt_hfn'} ... %4 history file edit box
{'Style', 'pushbutton','string','Data files or ESS Capsule', ...
'callback', ...
['[input_fname, input_fpath] = uigetfile(''*.**'',''Select data files or ESS metadata XML file:'',''*.*'',''multiselect'',''on'');', ...
['path = ''*.*'';' ...
'if exist(''context_config'', ''var''); path = [find_hints_context_config(context_config, ''data_dir'') path]; end;' ...
'[input_fname, input_fpath] = uigetfile(''*.*'',''Select data files or ESS metadata XML file:'',' ...
'path, ''multiselect'',''on'');', ...
'if isnumeric(input_fname);return;end;', ...
'set(findobj(gcbf,''tag'',''edt_dfp''),''string'',input_fpath);', ...
'set(findobj(gcbf,''tag'',''lst_dfn''),''string'',input_fname);']} ... %5 data file push button
......@@ -331,3 +337,5 @@ for hi=1:length(htb_fname)
end
end
end
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment