Skip to content

Commit

Permalink
Merge branch 'dev' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Nabarb committed Apr 14, 2020
2 parents 5d36310 + f9fba65 commit 2fdada9
Show file tree
Hide file tree
Showing 6 changed files with 61 additions and 16 deletions.
2 changes: 2 additions & 0 deletions +nigeLab/+libs/@ChannelUI/ChannelUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ function setChannel(obj,src,~)
if set(obj.Parent,'channel',src.Value)
obj.Channel = src.Value;
notify(obj,'NewChannel');
else
src.Value = obj.Channel;
end
end
end
Expand Down
29 changes: 26 additions & 3 deletions +nigeLab/+libs/@DashBoard/DashBoard.m
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@
toSplit % Struct array of Block and corresponding Animal to split
toAdd % Struct array of Block and corresponding Animal to add
end

properties (Access=private)
warningsToSolence = {'MATLAB:ui:javacomponent:FunctionToBeRemoved';
'MATLAB:ui:javaframe:PropertyToBeRemoved'};
end
% % % % % % % % % % END PROPERTIES %

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


% turn off java warnings
for ii=1:numel(obj.warningsToSolence)
warnID = obj.warningsToSolence{ii};
warning('off',warnID);
end


% Check input
if nargin < 1
obj = nigeLab.libs.DashBoard.empty(); % Empty DashBoard
Expand Down Expand Up @@ -168,6 +181,9 @@
% Add "rollover" interaction mediator for nigelButtons
obj.RollOver = nigeLab.utils.Mouse.rollover(...
obj.nigelGUI,[obj.nigelButtons.Tree,obj.nigelButtons.TitleBar]);



end
end

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


% turn on java warnings previously deactivated
for ii=1:numel(obj.warningsToSolence)
warnID = obj.warningsToSolence{ii};
warning('on',warnID);
end

end

% Delete all current event.listener object handles
Expand Down Expand Up @@ -1103,15 +1126,15 @@ function refreshStats(obj,~,evt)
h = obj.Tree.SelectedItems;
switch h.Type
case 'Tank'
[~,a] = getSelectedItems('obj');
a = b.Parent;
a_all = h.Children;
idx = ismember(a_all,a);
status = getStatus(h,[]);
obj.Status = status(idx,:);
obj.Status(idx,:) = status(idx,:);
obj.Mask = nigeLab.libs.DashBoard.animal2info(h);

case 'Animal'
b_all = getSelectedItems('obj');
b_all = obj.Tree.SelectedBlocks;
idx = find(b==b_all,1,'first');
obj.Status(idx,:) = getStatus(b,[]);
obj.Mask = nigeLab.libs.DashBoard.animal2info(h);
Expand Down
5 changes: 4 additions & 1 deletion +nigeLab/+libs/@HighDimsUI/HighDimsUI.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@
end

function PlotFig(obj)
if isvalid(obj.Figure)
return;
end
obj.Figure = figure('Color',nigeLab.defaults.nigelColors(0),...
'ToolBar','none',...
'MenuBar','none',...
'CloseRequestFcn',@(~,~)obj.closeF);
'CloseRequestFcn',@(~,~)obj.closeF,'Name','High-dimensional Navigator','numbertitle', 'off');

p1 = uipanel( obj.Figure,...
'BackgroundColor',nigeLab.defaults.nigelColors(0.1),...
Expand Down
35 changes: 23 additions & 12 deletions +nigeLab/+libs/@SpikeImage/SpikeImage.m
Original file line number Diff line number Diff line change
Expand Up @@ -186,22 +186,33 @@ function delete(obj)
obj.Init(fs);
obj.UpdateChannel;
end

function flag = checkForUnconfirmedChanges(obj,askUser)
% CHECKFORUNCONFIRMEDCHANGES cheacks if there are any unconfirmed changes.
% also asks the suer if it's ok to proceed anyway.

% returns true if we unconfirmed changes are present, therefore
% actions should be taken.

% is the user is prompted and decides to proceed, this will return false as
% if there were no unconfirmed changes.
flag = false;

% Check if it's okay to lose changes if there are any
if obj.UnconfirmedChanges
if askUser
str = questdlg('Unconfirmed changes will be lost. Proceed anyways?',...
'Discard Sorting on this Channel?','Yes','No','Yes');
flag = strcmp(str,'No');
else
flag = true;
end
end
end

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

% Check if it's okay to lose changes if there are any
if obj.UnconfirmedChanges
str = questdlg('Unconfirmed changes will be lost. Change channel anyways?',...
'Discard Sorting on this Channel?','Yes','No','Yes');
else
str = 'Yes';
end

if strcmp(str,'No')
return;
end

% Interpolate spikes
obj.Interpolate(obj.Parent.spk.spikes{obj.Parent.UI.ch});

Expand Down
4 changes: 4 additions & 0 deletions +nigeLab/@Sort/Sort.m
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ function delete(sortObj)
return;
end

if checkForUnconfirmedChanges(sortObj.UI.SpikeImage,true)
return;
end

sortObj.UI.ch = value;

case 'cluster'
Expand Down
2 changes: 2 additions & 0 deletions +nigeLab/@nigelObj/nigelObj.m
Original file line number Diff line number Diff line change
Expand Up @@ -3860,6 +3860,8 @@ function nigelDash(obj)
% think of a reason that we would want the
% nigeLab.libs.DashBoard object in the base workspace.



requestDash(obj);
end

Expand Down

0 comments on commit 2fdada9

Please sign in to comment.