Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
Common
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
Container 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
Skyward
Matlab dependencies
Common
Commits
b99a6fe0
Commit
b99a6fe0
authored
4 months ago
by
Giulia Ghirardini
Browse files
Options
Downloads
Patches
Plain Diff
[fixes][utilities] Added some tooltips, added buttons and save settings in .json file
parent
8f104c58
No related branches found
No related tags found
1 merge request
!20
Important improvements of ESFgui
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
functions/utilities/exportFigureGUI.m
+76
-12
76 additions, 12 deletions
functions/utilities/exportFigureGUI.m
with
76 additions
and
12 deletions
functions/utilities/exportFigureGUI.m
+
76
−
12
View file @
b99a6fe0
...
...
@@ -46,10 +46,11 @@ figNameField = uieditfield(fig, 'text', 'Position', [150 550 200 30], ...
%%% Dropdown menu for departement name
uilabel
(
fig
,
'Text'
,
'IPT Name:'
,
'Position'
,
[
370
550
100
30
]);
prefixIPTName
=
{
'[]'
,
'[MSA]'
,
'[AER]'
,
'[PRF]'
,
'[RCS]'
,
'[GNC]'
,
'[ARP]'
,
...
'[SWD]'
,
'[ELC]'
,
'[STR]'
,
'[
P
RP]'
,
'[LPS]'
,
'[AFD]'
,
'[MMC]'
,
'[ROV]'
};
'[SWD]'
,
'[ELC]'
,
'[STR]'
,
'[RP
S
]'
,
'[LPS]'
,
'[AFD]'
,
'[MMC]'
,
'[ROV]'
};
prefixIPTNameDropDown
=
uidropdown
(
fig
,
'Items'
,
prefixIPTName
,
...
'Value'
,
'[]'
,
...
'Position'
,
[
455
550
80
30
]);
'Position'
,
[
455
550
80
30
],
...
'Tooltip'
,
'Choose your IPT'
);
% WHratio Input
uilabel
(
fig
,
'Text'
,
'Width/Height Ratio:'
,
'Position'
,
[
50
170
150
30
]);
...
...
@@ -134,6 +135,7 @@ uilabel(fig, 'Text', 'Select Figure:', 'Position', [50, 500, 100, 30]);
figSelectionDropDown
=
uidropdown
(
fig
,
...
'Items'
,
figNames
,
...
'Position'
,
[
150
,
500
,
200
,
30
],
...
'Tooltip'
,
'Select the figure you want to export'
,
...
'ValueChangedFcn'
,
@
(
src
,
event
)
updatePreview
());
% Automatically update preview if only one figure exists
...
...
@@ -149,12 +151,6 @@ updateButton = uibutton(fig, 'Text', 'Update Figures', ...
'Tooltip'
,
'Update list of available figures'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
updateDropdown
());
% Submit Button
exportButton
=
uibutton
(
fig
,
'Text'
,
'Export Figure'
,
...
'Position'
,
[
350
100
100
30
],
...
'BackgroundColor'
,
'#cbffbe'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
exportFigureCallback
());
% preview image to export button
previewButton
=
uibutton
(
fig
,
'Text'
,
'Update preview'
,
...
'Position'
,
[
640
,
500
,
120
,
30
],
...
...
...
@@ -162,22 +158,71 @@ previewButton = uibutton(fig, 'Text', 'Update preview', ...
'Tooltip'
,
'Click to see a preview of your plot'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
previewFigureCallback
());
% return to default button
% return to default button
only for last 3 fields
defaultButton
=
uibutton
(
fig
,
'Text'
,
'Reset'
,
...
'Position'
,
[
710
,
170
,
50
,
30
],
...
'BackgroundColor'
,
[
.
7
.
7
.
7
],
...
'Tooltip'
,
'Return to default values'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
resetToDefault
());
'ButtonPushedFcn'
,
@
(
src
,
event
)
resetToDefault
Mini
());
% automatically generate a name
autoNameButton
=
uibutton
(
fig
,
'Text'
,
'Auto name'
,
...
'Position'
,
[
640
,
550
,
120
,
30
],
...
'BackgroundColor'
,
[
.
7
.
7
.
7
],
...
'Tooltip'
,
'Generate a automatic name'
,
...
'Tooltip'
,
'Generate a automatic name
: "plot"
'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
autoNameGenerator
());
% -------------------- BOTTOM PART ---------------------
% Export Button
exportButton
=
uibutton
(
fig
,
'Text'
,
'Export Figure'
,
...
'Position'
,
[
200
100
100
30
],
...
'BackgroundColor'
,
'#cbffbe'
,
...
'Tooltip'
,
'Click to export'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
exportFigureCallback
());
% Save settings Button
settingsSaveButton
=
uibutton
(
fig
,
'Text'
,
'Save settings'
,
...
'Position'
,
[
350
100
100
30
],
...
'BackgroundColor'
,
'#cbffbe'
,
...
'Tooltip'
,
'Save your configuration'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
saveSettings
());
% Reset to default settings to start over
allDefaultButton
=
uibutton
(
fig
,
'Text'
,
'Reset All'
,
...
'Position'
,
[
500
100
100
30
],
...
'BackgroundColor'
,
'#e17b4b'
,
...
'Tooltip'
,
'Reset all settings to default'
,
...
'ButtonPushedFcn'
,
@
(
src
,
event
)
resetToDefaultAll
());
%% Functions
% Function to update dropdown menu with new figures
function
saveSettings
()
% This function save all the settings in a json file
settings
.
addMarkers
=
addMarkersBox
.
Value
;
settings
.
changeColors
=
changeColorsBox
.
Value
;
settings
.
changeLineStyle
=
changeLineStyleBox
.
Value
;
settings
.
gridOption
=
gridBox
.
Value
;
settings
.
satelliteMapColors
=
satelliteMapColorsBox
.
Value
;
settings
.
legendLocation
=
legendLocationDropDown
.
Value
;
settings
.
legendOrientation
=
legendOrientationDropDown
.
Value
;
settings
.
exportPDF
=
exportPDFBox
.
Value
;
settings
.
exportFIG
=
exportFIGBox
.
Value
;
settings
.
overwriteFigure
=
overwriteFigureBox
.
Value
;
settings
.
percTextwidth
=
percTextField
.
Value
;
settings
.
forcedMarkers
=
forcedMarkersField
.
Value
;
settings
.
WHratio
=
WHratioField
.
Value
;
encoded
=
jsonencode
(
settings
,
PrettyPrint
=
true
);
nameFile
=
[
'settings_'
strrep
(
figSelectionDropDown
.
Value
,
' '
,
'-'
)
'.json'
];
fid
=
fopen
(
nameFile
,
'w'
);
fprintf
(
fid
,
'%s'
,
encoded
);
fclose
(
fid
);
end
function
autoNameGenerator
()
figNameField
.
Value
=
"plot"
;
end
...
...
@@ -202,10 +247,29 @@ autoNameButton = uibutton(fig, 'Text', 'Auto name', ...
end
end
function
resetToDefault
()
function
resetToDefaultMini
()
forcedMarkersField
.
Value
=
0
;
WHratioField
.
Value
=
0
;
percTextField
.
Value
=
0.75
;
end
function
resetToDefaultAll
()
forcedMarkersField
.
Value
=
0
;
WHratioField
.
Value
=
0
;
percTextField
.
Value
=
0.75
;
% Flags default settings
addMarkersBox
.
Value
=
true
;
changeColorsBox
.
Value
=
true
;
changeLineStyleBox
.
Value
=
false
;
gridBox
.
Value
=
true
;
satelliteMapColorsBox
.
Value
=
false
;
% Legend default settings
legendLocationDropDown
.
Value
=
'southoutside'
;
legendOrientationDropDown
.
Value
=
'horizontal'
;
% Export default settings
overwriteFigureBox
.
Value
=
false
;
exportPDFBox
.
Value
=
true
;
exportFIGBox
.
Value
=
false
;
end
function
updateDropdown
()
...
...
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