Skip to content

Commit

Permalink
Disable buttons until we are connected.
Browse files Browse the repository at this point in the history
  • Loading branch information
dastaple committed Sep 18, 2017
1 parent 7bfbec7 commit 7f10356
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
11 changes: 8 additions & 3 deletions app/start.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,11 +292,15 @@ BounceUI.prototype.setup_menu = function() {
});
$('#scan').click(() => _ui.start_scan());
this.connectMenu = $('#connections');

$('#play').click( ()=>_ui.run());
$('#stop').click( ()=>_ui.currentMcu.stop());
};

BounceUI.prototype.enable_connected_menu_items_ = function() {
$('#play').removeClass('disabled');
$('#stop').removeClass('disabled');
$('#play').click( ()=>this.run());
$('#stop').click( ()=>this.currentMcu.stop());
};

BounceUI.prototype.new_document = function() {
/* todo - request confirmation */
this._is_preparing = true;
Expand Down Expand Up @@ -350,6 +354,7 @@ BounceUI.prototype.start_scan = function() {
mcu_console.writeLine("Connecting.. outer");
_ui.connect_menu_item_clicked_(connectItem, mcu);
_ui.connectMenu.hide();
_ui.enable_connected_menu_items_();
return false;
});
});
Expand Down
7 changes: 6 additions & 1 deletion bounce.css
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,19 @@ html, body {
padding-bottom: 20px;
margin: 0;
}

.layered-button.disabled, .layered-button.disabled > i, .layered-button.disabled > control, .layered-button.disabled > :hover, .layered-button.disabled:hover {
color: darkgray;
background-color: lightgray;
}

.layered-button > i {
padding: 4px;
}
.layered-button > .control {
display: inline;
font-size: 1em;
border-left: 2px solid black;
color: darkgray;
}
.layered-button > .control:hover {
color: white;
Expand Down
4 changes: 2 additions & 2 deletions bounce_window.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@
<ul id="connections" class="toggle-list">
</ul>
</div>
<div id="play" class="layered-button">
<div id="play" class="layered-button disabled">
<i class="fa fa-play" aria-hidden="true"></i>
</div>
<div id="stop" class="layered-button">
<div id="stop" class="layered-button disabled">
<i class="fa fa-stop" aria-hidden="true"></i>
</div>

Expand Down

0 comments on commit 7f10356

Please sign in to comment.