From b1368c1b7e3e53b14c098fce897454155fa14858 Mon Sep 17 00:00:00 2001 From: Amanda Ghassaei <amandaghassaei@gmail.com> Date: Fri, 11 Sep 2015 01:30:10 -0400 Subject: [PATCH] eod --- js/menus/MenuWrapperView.js | 15 ++++++++++++--- js/menus/SendMenuView.js | 6 +++--- js/menus/SetupCommMenuView.js | 1 - js/menus/templates/NavViewMenu.html | 2 +- js/menus/templates/SendMenuView.html | 2 -- js/models/AppState.js | 2 +- js/models/SerialComm.js | 4 ++++ 7 files changed, 21 insertions(+), 11 deletions(-) diff --git a/js/menus/MenuWrapperView.js b/js/menus/MenuWrapperView.js index 39e7870e..ac59d314 100644 --- a/js/menus/MenuWrapperView.js +++ b/js/menus/MenuWrapperView.js @@ -46,9 +46,18 @@ define(['jquery', 'underscore', 'plist', 'backbone', 'lattice', 'appState', 'tex } if ($(".floatInput").is(":focus")) this._updateFloat(e); - if ($(".intInput").is(":focus")) this._updateInt(e); - if ($(".textInput").is(":focus")) this._updateString(e); - if ($(".hexInput").is(":focus")) this._updateHex(e); + else if ($(".intInput").is(":focus")) this._updateInt(e); + else if ($(".textInput").is(":focus")) this._updateString(e); + else if ($(".hexInput").is(":focus")) this._updateHex(e); + + else if (!$("input").is(":focus") && e.keyCode == 77 && (e.ctrlKey || e.metaKey) && e.shiftKey && appState.get("currentNav") == "navComm"){ + e.preventDefault(); + require(['serialComm'], function(serialComm){ + serialComm.openSerialMonitor(); + }); + } + console.log(e); + }, _updateString: function(e){ diff --git a/js/menus/SendMenuView.js b/js/menus/SendMenuView.js index f47b837b..85eefd67 100644 --- a/js/menus/SendMenuView.js +++ b/js/menus/SendMenuView.js @@ -2,10 +2,10 @@ * Created by aghassaei on 3/11/15. */ -define(['jquery', 'underscore', 'commParentMenu', 'serialComm', 'commPlist', 'text!sendMenuTemplate', 'cam', 'camPlist'], - function($, _, CommParentMenu, serialComm, commPlist, template, cam, camPlist){ +define(['jquery', 'underscore', 'menuParent', 'serialComm', 'commPlist', 'text!sendMenuTemplate', 'cam', 'camPlist'], + function($, _, MenuParent, serialComm, commPlist, template, cam, camPlist){ - return CommParentMenu.extend({ + return MenuParent.extend({ events: { diff --git a/js/menus/SetupCommMenuView.js b/js/menus/SetupCommMenuView.js index cd8531ae..919c6b0d 100644 --- a/js/menus/SetupCommMenuView.js +++ b/js/menus/SetupCommMenuView.js @@ -17,7 +17,6 @@ define(['jquery', 'underscore', 'commParentMenu', 'serialComm', 'text!setupCommM "click #openSerialMonitor": "_openSerialMonitor" }, - __initialize: function(){ }, diff --git a/js/menus/templates/NavViewMenu.html b/js/menus/templates/NavViewMenu.html index 49ca72b5..48c16134 100644 --- a/js/menus/templates/NavViewMenu.html +++ b/js/menus/templates/NavViewMenu.html @@ -3,7 +3,7 @@ <ul class="dropdown-menu"> <li><a class="appState boolProperty" data-property="menuIsVisible" href="#">Menu</a></li> <li><a class="appState boolProperty" data-property="scriptIsVisible" href="#">Script</a></li> - <li><a class="appState boolProperty" data-property="consoleIsVisible" href="#">Console</a></li> + <!--<li><a class="appState boolProperty" data-property="consoleIsVisible" href="#">Console</a></li>--> <li><a class="appState boolProperty" data-property="ribbonIsVisible" href="#">Ribbon</a></li> </ul> </li> diff --git a/js/menus/templates/SendMenuView.html b/js/menus/templates/SendMenuView.html index 1ec28eb6..f71756ed 100644 --- a/js/menus/templates/SendMenuView.html +++ b/js/menus/templates/SendMenuView.html @@ -9,8 +9,6 @@ <a href="#" id="streamCommands" class="btn btn-block btn-lg btn-success">Stream</a> <% } %> <br/> - Incoming: <pre id="incomingSerialMessage"><%= lastMessageReceived %></pre><br/><br/> - Out: <input id="sendSerialMessage" value="" placeholder="Send Message" class="seventyFiveWidth form-control unresponsiveInput" type="text"><br/><br/> Next Line: <input id="nextLine" value="" placeholder="##" class="intInput form-control unresponsiveInput" type="text"> <a href="#" id="previousLineButton" class="btn btn-lg btn-default">Prev</a> <a href="#" id="nextLineButton" class="btn btn-lg btn-default">Next</a><br/><br/> diff --git a/js/models/AppState.js b/js/models/AppState.js index a55d2494..158fe6bb 100644 --- a/js/models/AppState.js +++ b/js/models/AppState.js @@ -25,7 +25,7 @@ define(['underscore', 'backbone', 'threeModel', 'three', 'plist', 'globals'], fu basePlaneIsVisible:true, highlighterIsVisible:true, axesAreVisible: false, - focusOnLattice: true, + focusOnLattice: false, //key bindings shift: false, diff --git a/js/models/SerialComm.js b/js/models/SerialComm.js index 68c0ee4a..cc43830a 100644 --- a/js/models/SerialComm.js +++ b/js/models/SerialComm.js @@ -53,6 +53,10 @@ define(['underscore', 'backbone', 'socketio'], function(_, Backbone, io){ }, openSerialMonitor: function(){ + if (!this.get("connected")) { + console.warn("can't open serial monitor if not connected to node server"); + return; + } require(['serialMonitorController'], function(serialMonitorController){ serialMonitorController.open(); }); -- GitLab