Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
TSG QC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
US191
TSG QC
Commits
5549dcf5
Commit
5549dcf5
authored
17 years ago
by
jacques.grelet_ird.fr
Browse files
Options
Downloads
Patches
Plain Diff
move tsg_initialisation in new config and and waitbar when preference file is loading
parent
b2e8b1d9
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
tsg_util/tsg_preferences.m
+54
-28
54 additions, 28 deletions
tsg_util/tsg_preferences.m
with
54 additions
and
28 deletions
tsg_util/tsg_preferences.m
+
54
−
28
View file @
5549dcf5
...
...
@@ -29,45 +29,73 @@ config_file = [prefdir, filesep, app_name, '.mat'];
% Open config file
% ----------------
config
=
fopen
(
config_file
,
'r'
);
%config = -1;
% test fopen return value
% -----------------------
if
config
==
-
1
% config file dosn't exist, call default tsg_initialisation
% ---------------------------------------------------------
tsg
=
tsg_initialisation
;
% ccall new config private function
% call new config private function
% ---------------------------------
new_config
;
else
try
% Pointer set to watch during loading preference file
% ---------------------------------------------------
set
(
hTsgGUI
,
'Pointer'
,
'watch'
);
% Initialize loading preference file waitbar
% ------------------------------------------
wb
=
waitbar
(
0
,
'Loading préference file. Please wait...'
);
% display waitbar
% ---------------
waitbar
(
1
/
10
,
wb
,
'loading structure root'
);
try
% if file exist, load in workspace
% -----------------------------
% -----------------------------
---
load
(
config_file
,
'root'
,
'tsg'
);
catch
% display warning
% ---------------
warning
(
'tsgqc_GUI:tsg_preferences'
,
...
'Can
''
t load preference file
''
%s
''
'
,
config_file
);
'Can
''
t load preference file
''
%s
''
'
,
config_file
);
% quit program
% ------------
quitProgram
(
hTsgGUI
,
DEFAULT_PATH_FILE
);
end
try
end
% display waitbar
% ---------------
waitbar
(
1
/
2
,
wb
,
'loading structure tsg'
);
% Close waitbar
% -------------
close
(
wb
)
% cursor back to normal
% ---------------------
set
(
hTsgGUI
,
'Pointer'
,
'arrow'
);
try
% set current preference autoload in submenu option/preference
% ------------------------------------------------------------
set
(
findobj
(
'tag'
,
'TAG_UIMENU_OPTION_PREFERENCES'
,
...
'checked'
,
root
.
preference
.
autoload
));
'checked'
,
root
.
preference
.
autoload
));
catch
warning
(
'tsgqc_GUI:tsg_preferences'
,
...
[
'Preference file
''
%s
''
\nis malformed\n'
...
'delete it.'
],
config_file
);
quitProgram
(
hTsgGUI
,
DEFAULT_PATH_FILE
);
'delete it.'
],
config_file
);
quitProgram
(
hTsgGUI
,
DEFAULT_PATH_FILE
);
end
% If there no field version or wrong version, initialize
...
...
@@ -88,27 +116,25 @@ setappdata( hTsgGUI, 'tsg_data', tsg);
% save root in userdata property
% ------------------------------
set
(
0
,
'userdata'
,
root
);
set
(
0
,
'userdata'
,
root
);
% cas d'erreur si l'utilisation change de disque (cle USB -> disque dur
% par ex, self.path ne sera pas a jour et la lecture fichier genere une
% erreur
% if ~exist( root.path, 'dir' )
% root.path = [pwd filesep];
% end
% ----------------------------------------------------------------------
%
priva
te function new_config
%
nes
te
d
function new_config
% ----------------------------------------------------------------------
function
new_config
% call default tsg_initialisation
% -------------------------------
tsg
=
tsg_initialisation
;
% init root structure to default values
% -------------------------------------
root
.
preference
.
autoload
=
'off'
;
root
.
version
=
VERSION
;
% save root and tsg to prefdir
mat file
% -------------------------------------
% save root and tsg to
'
prefdir
.
mat
'
file
% -------------------------------------
--
save
(
config_file
,
'root'
,
'tsg'
);
% save root in root object for next use
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment