Skip to content

Commit 1c2a447

Browse files
committed
-BpodAnalogIn: Fixed GUI in r2025 dark mode
-PokesPlot plugin: Fixed GUI in r2025 dark mode
1 parent 985febf commit 1c2a447

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

Functions/Modules/Analog Input/BpodAnalogIn.m

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,14 @@ function scope(obj)
759759
figHeight = 500;
760760
dropFontSize = 10;
761761
end
762+
763+
% Set background colors to match UI theme
762764
oscBGColor = [0.55 0.55 0.55];
765+
bgColor = [.7 .7 .7];
766+
if IsMATLAB_DarkMode
767+
oscBGColor = [0.35 0.35 0.35];
768+
bgColor = [0.2 0.2 0.2];
769+
end
763770
lineColors = {[1 1 0], [0 1 1], [1 0.5 0], [0 1 0], [1 .3 .3], [.6 .2 1], [.3 .3 1], [1 0 1]};
764771
resetLineColors = cell(1,obj.nPhysicalChannels);
765772
for i = 1:obj.nPhysicalChannels
@@ -805,31 +812,30 @@ function scope(obj)
805812
'Color', resetLineColors{i}, 'LineStyle', ':', 'Visible', visibilityVec{obj.SMeventsEnabled(i)+1});
806813
end
807814

808-
809815
obj.UIhandles.MaskLine = line([lineEdge,obj.UIhandles.nXDivisions-lineEdge],[-0.2,-0.2],...
810816
'Color', [.2 .2 .2], 'LineWidth', 20);
811817
obj.UIhandles.VDivText = text(0.2,-0.2, 'V/div: 5.0', 'Color', 'yellow', 'FontName', 'Courier New', 'FontSize', 12);
812818
obj.UIhandles.TimeText = text(9.5,-0.2, 'Time 200.0ms', 'Color', 'yellow', 'FontName', 'Courier New', 'FontSize', 12);
813819
obj.UIhandles.StatText = text(0.2,7.7, 'Stopped', 'Color', 'red', 'FontName', 'Courier New', 'FontSize', 12);
814820
obj.UIhandles.RecStatText = text(10.1,7.7, '', 'Color', 'red', 'FontName', 'Courier New', 'FontSize', 12);
815821
obj.UIhandles.RunButton = uicontrol('Style', 'pushbutton', 'String', 'RUN', 'Position', [895 390 120 95],...
816-
'Callback',@(h,e)obj.scope_StartStop(), 'BackgroundColor', [0.7 0.7 0.7], 'FontSize', titleFontSize,...
822+
'Callback',@(h,e)obj.scope_StartStop(), 'BackgroundColor', bgColor, 'FontSize', titleFontSize,...
817823
'FontWeight', 'bold', 'TooltipString', 'Start/Stop Data Stream');
818824
obj.UIhandles.TimeScaleUpButton = uicontrol('Style', 'pushbutton', 'String', '>', 'Position', [970 10 50 50],...
819-
'Callback',@(h,e)obj.stepTimescale(1), 'BackgroundColor', [0.7 0.7 0.7], 'FontSize', titleFontSize,...
825+
'Callback',@(h,e)obj.stepTimescale(1), 'BackgroundColor', bgColor, 'FontSize', titleFontSize,...
820826
'FontWeight', 'bold', 'TooltipString', 'Increase time/div');
821827
obj.UIhandles.TimeScaleDnButton = uicontrol('Style', 'pushbutton', 'String', '<', 'Position', [845 10 50 50],...
822-
'Callback',@(h,e)obj.stepTimescale(-1), 'BackgroundColor', [0.7 0.7 0.7], 'FontSize', titleFontSize,...
828+
'Callback',@(h,e)obj.stepTimescale(-1), 'BackgroundColor', bgColor, 'FontSize', titleFontSize,...
823829
'FontWeight', 'bold', 'TooltipString', 'Decrease time/div');
824830
uicontrol('Style', 'text', 'Position', [895 37 70 30], 'String', 'Time', 'FontSize', scaleFontSize,...
825831
'BackgroundColor', oscBGColor, 'FontWeight', 'bold');
826832
uicontrol('Style', 'text', 'Position', [895 10 70 30], 'String', '/ div', 'FontSize', scaleFontSize,...
827833
'BackgroundColor', oscBGColor, 'FontWeight', 'bold');
828834
obj.UIhandles.VoltScaleUpButton = uicontrol('Style', 'pushbutton', 'String', '^', 'Position', [780 10 50 50],...
829-
'Callback',@(h,e)obj.stepVoltscale(1), 'BackgroundColor', [0.7 0.7 0.7], 'FontSize', titleFontSize,...
835+
'Callback',@(h,e)obj.stepVoltscale(1), 'BackgroundColor', bgColor, 'FontSize', titleFontSize,...
830836
'FontWeight', 'bold', 'TooltipString', 'Increase volts/div');
831837
obj.UIhandles.VoltScaleDnButton = uicontrol('Style', 'pushbutton', 'String', 'v', 'Position', [660 10 50 50],...
832-
'Callback',@(h,e)obj.stepVoltscale(-1), 'BackgroundColor', [0.7 0.7 0.7], 'FontSize', titleFontSize,...
838+
'Callback',@(h,e)obj.stepVoltscale(-1), 'BackgroundColor', bgColor, 'FontSize', titleFontSize,...
833839
'FontWeight', 'bold', 'TooltipString', 'Decrease volts/div');
834840
uicontrol('Style', 'text', 'Position', [710 37 70 30], 'String', 'Volts', 'FontSize', scaleFontSize,...
835841
'BackgroundColor', oscBGColor, 'FontWeight', 'bold');
@@ -855,13 +861,13 @@ function scope(obj)
855861
'BackgroundColor', oscBGColor, 'FontWeight', 'bold');
856862
obj.UIhandles.SFEdit = uicontrol('Style', 'edit', 'Position', [760 390 100 30], 'String',...
857863
num2str(obj.SamplingRate), 'FontSize', 12,...
858-
'BackgroundColor', [0.8 0.8 0.8], 'FontWeight', 'bold', 'Callback',@(h,e)obj.UIsetSamplingRate());
864+
'BackgroundColor', bgColor, 'FontWeight', 'bold', 'Callback',@(h,e)obj.UIsetSamplingRate());
859865
obj.UIhandles.DataFileEdit = uicontrol('Style', 'edit', 'Position', [713 350 301 30], 'String',...
860-
obj.USBStreamFile, 'FontSize', 10, 'BackgroundColor', [0.8 0.8 0.8], 'FontName', 'Courier New',...
866+
obj.USBStreamFile, 'FontSize', 10, 'BackgroundColor', bgColor, 'FontName', 'Courier New',...
861867
'FontWeight', 'bold', 'Callback',@(h,e)obj.setStreamFileFromGUI(),...
862868
'TooltipString', 'Full path to .mat file to store acquired data from channels selected below (optional).');
863869
obj.UIhandles.nChanSelect = uicontrol('Style', 'popupmenu', 'Position', [670 390 65 30],...
864-
'String', {'1','2','3','4','5','6','7','8'}, 'FontSize', 12, 'BackgroundColor', [0.8 0.8 0.8],...
870+
'String', {'1','2','3','4','5','6','7','8'}, 'FontSize', 12, 'BackgroundColor', bgColor,...
865871
'FontWeight', 'bold', 'Value', obj.nActiveChannels, 'Callback',@(h,e)obj.UIsetNactiveChannels());
866872
yPos = 285;
867873
enableStrings = {'off', 'on'};
@@ -872,18 +878,18 @@ function scope(obj)
872878
'BackgroundColor', oscBGColor, 'FontWeight', 'bold', 'Value', obj.Stream2USB(i),...
873879
'Callback',@(h,e)obj.UIenableChannel(i));
874880
obj.UIhandles.rangeSelect(i) = uicontrol('Style', 'popupmenu', 'Position', [730 yPos 97 20],...
875-
'FontSize', dropFontSize, 'BackgroundColor', [0.8 0.8 0.8], 'FontWeight', 'bold',...
881+
'FontSize', dropFontSize, 'BackgroundColor', bgColor, 'FontWeight', 'bold',...
876882
'Value', obj.RangeIndex(i), 'Callback',@(h,e)obj.UIsetRange(i),...
877883
'String',obj.Info.InputVoltageRanges, 'enable', enableStrings{(i<= obj.nActiveChannels)+1});
878884
obj.UIhandles.SMeventEnable(i) = uicontrol('Style', 'checkbox', 'Position', [845 yPos 20 20], 'FontSize', 12,...
879885
'BackgroundColor', oscBGColor, 'FontWeight', 'bold', 'Value', obj.SMeventsEnabled(i),...
880886
'Callback',@(h,e)obj.UIenableSMEvents(i),...
881887
'TooltipString', ['Send threshold crossing events from channel ' num2str(i) ' to state machine']);
882888
obj.UIhandles.thresholdSet(i) = uicontrol('Style', 'edit', 'Position', [890 yPos 55 20], 'FontSize', 10,...
883-
'BackgroundColor', [0.8 0.8 0.8], 'FontWeight', 'bold', 'Callback',@(h,e)obj.UIsetThreshold(i),...
889+
'BackgroundColor', bgColor, 'FontWeight', 'bold', 'Callback',@(h,e)obj.UIsetThreshold(i),...
884890
'String',num2str(obj.Thresholds(1,i)), 'enable', enableStrings{obj.SMeventsEnabled(i)+1});
885891
obj.UIhandles.resetSet(i) = uicontrol('Style', 'edit', 'Position', [960 yPos 55 20], 'FontSize', 10,...
886-
'BackgroundColor', [0.8 0.8 0.8], 'FontWeight', 'bold', 'Callback',@(h,e)obj.UIsetReset(i),...
892+
'BackgroundColor', bgColor, 'FontWeight', 'bold', 'Callback',@(h,e)obj.UIsetReset(i),...
887893
'String',num2str(obj.ResetVoltages(1,i)), 'enable', enableStrings{obj.SMeventsEnabled(i)+1});
888894
yPos= yPos - 30;
889895
end

Functions/Plugins/Plots/PokesPlot.m

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,20 +35,20 @@ function PokesPlot(varargin)
3535
BpodSystem.GUIHandles.PokesPlot.AlignOnLabel = uicontrol('Style', 'text','String','align on:',...
3636
'Position', [30 70 60 20], 'FontWeight', 'normal', 'FontSize', 10,'FontName', 'Arial');
3737
BpodSystem.GUIHandles.PokesPlot.AlignOnMenu = uicontrol('Style', 'popupmenu','Value',2, 'String', fields(stateColors),...
38-
'Position', [95 70 150 20], 'FontWeight', 'normal', 'FontSize', 10, 'BackgroundColor','white', 'FontName', 'Arial',...
38+
'Position', [95 70 150 20], 'FontWeight', 'normal', 'FontSize', 10, 'FontName', 'Arial',...
3939
'Callback', {@PokesPlot, 'alignon'});
4040
BpodSystem.GUIHandles.PokesPlot.LeftEdgeLabel = uicontrol('Style', 'text','String','start', 'Position', [30 35 40 20],...
4141
'FontWeight', 'normal', 'FontSize', 10,'FontName', 'Arial');
4242
BpodSystem.GUIHandles.PokesPlot.LeftEdge = uicontrol('Style', 'edit','String',-0.25, 'Position', [75 35 40 20],...
43-
'FontWeight', 'normal', 'FontSize', 10, 'BackgroundColor','white', 'FontName', 'Arial','Callback', {@PokesPlot, 'time_axis'});
43+
'FontWeight', 'normal', 'FontSize', 10, 'FontName', 'Arial','Callback', {@PokesPlot, 'time_axis'});
4444
BpodSystem.GUIHandles.PokesPlot.LeftEdgeLabel = uicontrol('Style', 'text','String','end', 'Position', [30 10 40 20],...
4545
'FontWeight', 'normal', 'FontSize', 10, 'FontName', 'Arial');
4646
BpodSystem.GUIHandles.PokesPlot.RightEdge = uicontrol('Style', 'edit','String',2, 'Position', [75 10 40 20],...
47-
'FontWeight', 'normal', 'FontSize', 10, 'BackgroundColor','white', 'FontName', 'Arial','Callback', {@PokesPlot, 'time_axis'});
47+
'FontWeight', 'normal', 'FontSize', 10, 'FontName', 'Arial','Callback', {@PokesPlot, 'time_axis'});
4848
BpodSystem.GUIHandles.PokesPlot.LastnLabel = uicontrol('Style', 'text','String','N trials', 'Position', [130 33 50 20],...
4949
'FontWeight', 'normal', 'FontSize', 10, 'FontName', 'Arial');
5050
BpodSystem.GUIHandles.PokesPlot.Lastn = uicontrol('Style', 'edit','String',10, 'Position', [185 35 40 20],...
51-
'FontWeight', 'normal', 'FontSize', 10, 'BackgroundColor','white', 'FontName', 'Arial','Callback', {@PokesPlot, 'time_axis'});
51+
'FontWeight', 'normal', 'FontSize', 10, 'FontName', 'Arial','Callback', {@PokesPlot, 'time_axis'});
5252
BpodSystem.GUIHandles.PokesPlot.PokesPlotAxis = axes('Position', [0.1 0.38 0.8 0.54],'Color', 0.3*[1 1 1]);
5353
fnames = fieldnames(stateColors);
5454
for j=1:str2double(get(BpodSystem.GUIHandles.PokesPlot.Lastn, 'String'))

0 commit comments

Comments
 (0)