Skip to content

Commit f9fba65

Browse files
committed
hotfix
hotfix collection solved a bug that was causing the Sort interface to change channel when unconfirmed changes were present, regardless the user answer to the message prompt. Solved a bug in Dashboard that was preventing the "status" figure to update properly after a task was completed. Silenced some warnings about java in matlab 2019b and later. I reserve the pleasure of dealing with this to the future me.
1 parent e60ed45 commit f9fba65

6 files changed

Lines changed: 61 additions & 16 deletions

File tree

+nigeLab/+libs/@ChannelUI/ChannelUI.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,8 @@ function setChannel(obj,src,~)
132132
if set(obj.Parent,'channel',src.Value)
133133
obj.Channel = src.Value;
134134
notify(obj,'NewChannel');
135+
else
136+
src.Value = obj.Channel;
135137
end
136138
end
137139
end

+nigeLab/+libs/@DashBoard/DashBoard.m

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
toSplit % Struct array of Block and corresponding Animal to split
7575
toAdd % Struct array of Block and corresponding Animal to add
7676
end
77+
78+
properties (Access=private)
79+
warningsToSolence = {'MATLAB:ui:javacomponent:FunctionToBeRemoved';
80+
'MATLAB:ui:javaframe:PropertyToBeRemoved'};
81+
end
7782
% % % % % % % % % % END PROPERTIES %
7883

7984
% % % EVENTS % % % % % % % % % % % %
@@ -105,6 +110,14 @@
105110
% be created separate from a Tank, but in order to use this
106111
% interface, you must have a Tank object.
107112

113+
114+
% turn off java warnings
115+
for ii=1:numel(obj.warningsToSolence)
116+
warnID = obj.warningsToSolence{ii};
117+
warning('off',warnID);
118+
end
119+
120+
108121
% Check input
109122
if nargin < 1
110123
obj = nigeLab.libs.DashBoard.empty(); % Empty DashBoard
@@ -168,6 +181,9 @@
168181
% Add "rollover" interaction mediator for nigelButtons
169182
obj.RollOver = nigeLab.utils.Mouse.rollover(...
170183
obj.nigelGUI,[obj.nigelButtons.Tree,obj.nigelButtons.TitleBar]);
184+
185+
186+
171187
end
172188
end
173189

@@ -852,6 +868,13 @@ function deleteDashBoard(obj)
852868
obj.nigelGUI(:) = []; % Remove object so not deleted twice
853869
delete(obj);
854870

871+
872+
% turn on java warnings previously deactivated
873+
for ii=1:numel(obj.warningsToSolence)
874+
warnID = obj.warningsToSolence{ii};
875+
warning('on',warnID);
876+
end
877+
855878
end
856879

857880
% Delete all current event.listener object handles
@@ -1103,15 +1126,15 @@ function refreshStats(obj,~,evt)
11031126
h = obj.Tree.SelectedItems;
11041127
switch h.Type
11051128
case 'Tank'
1106-
[~,a] = getSelectedItems('obj');
1129+
a = b.Parent;
11071130
a_all = h.Children;
11081131
idx = ismember(a_all,a);
11091132
status = getStatus(h,[]);
1110-
obj.Status = status(idx,:);
1133+
obj.Status(idx,:) = status(idx,:);
11111134
obj.Mask = nigeLab.libs.DashBoard.animal2info(h);
11121135

11131136
case 'Animal'
1114-
b_all = getSelectedItems('obj');
1137+
b_all = obj.Tree.SelectedBlocks;
11151138
idx = find(b==b_all,1,'first');
11161139
obj.Status(idx,:) = getStatus(b,[]);
11171140
obj.Mask = nigeLab.libs.DashBoard.animal2info(h);

+nigeLab/+libs/@HighDimsUI/HighDimsUI.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,13 @@
3737
end
3838

3939
function PlotFig(obj)
40+
if isvalid(obj.Figure)
41+
return;
42+
end
4043
obj.Figure = figure('Color',nigeLab.defaults.nigelColors(0),...
4144
'ToolBar','none',...
4245
'MenuBar','none',...
43-
'CloseRequestFcn',@(~,~)obj.closeF);
46+
'CloseRequestFcn',@(~,~)obj.closeF,'Name','High-dimensional Navigator','numbertitle', 'off');
4447

4548
p1 = uipanel( obj.Figure,...
4649
'BackgroundColor',nigeLab.defaults.nigelColors(0.1),...

+nigeLab/+libs/@SpikeImage/SpikeImage.m

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -186,22 +186,33 @@ function delete(obj)
186186
obj.Init(fs);
187187
obj.UpdateChannel;
188188
end
189+
190+
function flag = checkForUnconfirmedChanges(obj,askUser)
191+
% CHECKFORUNCONFIRMEDCHANGES cheacks if there are any unconfirmed changes.
192+
% also asks the suer if it's ok to proceed anyway.
193+
194+
% returns true if we unconfirmed changes are present, therefore
195+
% actions should be taken.
196+
197+
% is the user is prompted and decides to proceed, this will return false as
198+
% if there were no unconfirmed changes.
199+
flag = false;
200+
201+
% Check if it's okay to lose changes if there are any
202+
if obj.UnconfirmedChanges
203+
if askUser
204+
str = questdlg('Unconfirmed changes will be lost. Proceed anyways?',...
205+
'Discard Sorting on this Channel?','Yes','No','Yes');
206+
flag = strcmp(str,'No');
207+
else
208+
flag = true;
209+
end
210+
end
211+
end
189212

190213
function UpdateChannel(obj,~,~)
191214
%UPDATECHANNEL Update the spike data structure to new channel
192215

193-
% Check if it's okay to lose changes if there are any
194-
if obj.UnconfirmedChanges
195-
str = questdlg('Unconfirmed changes will be lost. Change channel anyways?',...
196-
'Discard Sorting on this Channel?','Yes','No','Yes');
197-
else
198-
str = 'Yes';
199-
end
200-
201-
if strcmp(str,'No')
202-
return;
203-
end
204-
205216
% Interpolate spikes
206217
obj.Interpolate(obj.Parent.spk.spikes{obj.Parent.UI.ch});
207218

+nigeLab/@Sort/Sort.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,10 @@ function delete(sortObj)
161161
return;
162162
end
163163

164+
if checkForUnconfirmedChanges(sortObj.UI.SpikeImage,true)
165+
return;
166+
end
167+
164168
sortObj.UI.ch = value;
165169

166170
case 'cluster'

+nigeLab/@nigelObj/nigelObj.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3860,6 +3860,8 @@ function nigelDash(obj)
38603860
% think of a reason that we would want the
38613861
% nigeLab.libs.DashBoard object in the base workspace.
38623862

3863+
3864+
38633865
requestDash(obj);
38643866
end
38653867

0 commit comments

Comments
 (0)