Skip to content

Commit

Permalink
fix: issue with Theme property empty for MATLAB without new desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
mfacchinelli committed Jan 20, 2025
1 parent 775ac21 commit 6dbcc94
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1 +1 @@
MAG_DATA_VISUALIZATION_VERSION=7.1.3
MAG_DATA_VISUALIZATION_VERSION=7.1.4
2 changes: 1 addition & 1 deletion app/core/+mag/+app/+internal/SelectMissionDialog.m
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function instantiate(this)
this.GridLayout.ColumnWidth = ["1x", "2x", "1x"];
this.GridLayout.RowHeight = ["2x", "1x", "2x"];

if isprop(this.Parent, "Theme") && isequal(this.Parent.Theme.BaseColorStyle, "dark")
if mag.internal.isThemeable(this.Parent) && isequal(this.Parent.Theme.BaseColorStyle, "dark")
this.GridLayout.BackgroundColor = 0.02 * ones(1, 3);
else
this.GridLayout.BackgroundColor = 0.98 * ones(1, 3);
Expand Down
2 changes: 1 addition & 1 deletion app/core/+mag/+app/+manage/ToolbarManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ function instantiate(this, parent)
% Create Toolbar.
this.Toolbar = uitoolbar(parent);

if isprop(parent, "Theme")
if mag.internal.isThemeable(parent)
theme = parent.Theme.BaseColorStyle;
else
theme = "light";
Expand Down
7 changes: 1 addition & 6 deletions resources/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,3 @@
# App

- Fix Bartington figures not being registered by app when generated

# Software

- Add sorting and removal of zeroed-out vectors for Bartington analysis processing
- Bartington field figures are also called "Bartington...", instead of "Field..."
- Fix issue with `Theme` property empty for MATLAB without new desktop
14 changes: 14 additions & 0 deletions src/utility/+mag/+internal/isThemeable.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
function value = isThemeable(figure)
% ISTHEMEABLE Determine whether figure is themeable (i.e., if setting
% dark/light mode is supported).

arguments (Input)
figure (1, 1) matlab.ui.Figure
end

arguments (Output)
value (1, 1) logical
end

value = isprop(figure, "Theme") && isa(figure.Theme, "matlab.graphics.theme.GraphicsTheme");
end
2 changes: 1 addition & 1 deletion src/visualize/+mag/+graphics/+factory/DefaultFactory.m
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
f = figure(Name = options.Name, NumberTitle = "off", WindowState = options.WindowState, Visible = "off");
setVisibility = onCleanup(@() set(f, Visible = matlab.lang.OnOffSwitchState(options.Visible)));

if isprop(f, "Theme")
if mag.internal.isThemeable(f)
f.Theme = options.Theme;
else
warning("Theme ""%s"" cannot be applied.", options.Theme);
Expand Down

0 comments on commit 6dbcc94

Please sign in to comment.