Skip to content

Commit 7dceca1

Browse files
committed
Moved status from title to status bar
1 parent cb8dd40 commit 7dceca1

File tree

6 files changed

+38
-16
lines changed

6 files changed

+38
-16
lines changed

src/main/matlab/+symphonyui/+app/NullProtocol.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
function [tf, msg] = isValid(obj) %#ok<MANU>
1010
tf = false;
11-
msg = [];
11+
msg = 'Cannot run null protocol';
1212
end
1313

1414
end

src/main/matlab/+symphonyui/+ui/+presenters/MainPresenter.m

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -485,6 +485,7 @@ function updateStateOfControls(obj)
485485
isPausing = controllerState.isPausing();
486486
isViewingPaused = controllerState.isViewingPaused();
487487
isRecordingPaused = controllerState.isRecordingPaused();
488+
isPaused = controllerState.isPaused();
488489
isStopping = controllerState.isStopping();
489490
isStopped = controllerState.isStopped();
490491
try
@@ -515,10 +516,14 @@ function updateStateOfControls(obj)
515516

516517
if ~isValid
517518
status = validationMessage;
518-
elseif isStopped
519-
status = '';
519+
statusMode = obj.view.INVALID_STATUS_MODE;
520520
else
521521
status = char(controllerState);
522+
if isStopped || isPaused
523+
statusMode = obj.view.VALID_STATUS_MODE;
524+
else
525+
statusMode = obj.view.BUSY_STATUS_MODE;
526+
end
522527
end
523528

524529
obj.view.enableNewFile(enableNewFile);
@@ -538,7 +543,7 @@ function updateStateOfControls(obj)
538543
obj.view.enableInitializeRig(enableInitializeRig);
539544
obj.view.enableConfigureDevices(enableConfigureDevices);
540545
obj.view.setStatus(status);
541-
obj.view.setIsValid(isValid);
546+
obj.view.setStatusMode(statusMode);
542547
end
543548

544549
function onViewSelectedResetProtocol(obj, ~, ~)

src/main/matlab/+symphonyui/+ui/+views/MainView.m

Lines changed: 29 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,14 @@
4343
recordButton
4444
pauseButton
4545
stopButton
46+
statusLabel
47+
statusIcon
48+
end
49+
50+
properties (Constant)
51+
VALID_STATUS_MODE = 1
52+
INVALID_STATUS_MODE = 2
53+
BUSY_STATUS_MODE = 3
4654
end
4755

4856
methods
@@ -241,8 +249,19 @@ function createUi(obj)
241249
'String', ['<html><img src="' path2Url(App.getResource('icons', 'stop_big.png')) '"/></html>'], ...
242250
'TooltipString', 'Stop', ...
243251
'Callback', @(h,d)notify(obj, 'Stop'));
252+
253+
statusLayout = uix.HBox( ...
254+
'Parent', mainLayout, ...
255+
'BackgroundColor', 'white');
256+
257+
obj.statusLabel = Label( ...
258+
'Parent', statusLayout);
259+
obj.statusIcon = Label( ...
260+
'Parent', statusLayout);
261+
262+
set(statusLayout, 'Widths', [-1 18]);
244263

245-
set(mainLayout, 'Heights', [-1 34]);
264+
set(mainLayout, 'Heights', [-1 34 18]);
246265
end
247266

248267
function close(obj)
@@ -412,20 +431,18 @@ function addModule(obj, name, value)
412431
end
413432

414433
function setStatus(obj, s)
415-
if isempty(s)
416-
title = symphonyui.app.App.name;
417-
else
418-
title = sprintf('%s (%s)', symphonyui.app.App.name, s);
419-
end
420-
set(obj.figureHandle, 'Name', title);
434+
set(obj.statusLabel, 'String', ['Status: ' s]);
421435
end
422436

423-
function setIsValid(obj, tf)
424-
if tf
425-
set(obj.protocolPopupMenu, 'ForegroundColor', 'black');
426-
else
427-
set(obj.protocolPopupMenu, 'ForegroundColor', 'red');
437+
function setStatusMode(obj, m)
438+
icon = '';
439+
switch m
440+
case obj.INVALID_STATUS_MODE
441+
icon = symphonyui.app.App.getResource('icons', 'invalid.png');
442+
case obj.BUSY_STATUS_MODE
443+
icon = symphonyui.app.App.getResource('icons', 'spinner.gif');
428444
end
445+
set(obj.statusIcon, 'Icon', icon)
429446
end
430447

431448
end
956 Bytes
Loading
3.06 KB
Loading

src/main/resources/icons/valid.png

756 Bytes
Loading

0 commit comments

Comments
 (0)