Commit 6a48d3bc authored by Amanda Ghassaei's avatar Amanda Ghassaei

deleting things

parent a6bb3b5d
......@@ -42,4 +42,6 @@ node/node_modules/
.Spotlight-V100
.Trashes
ehthumbs.db
Thumbs.db
\ No newline at end of file
Thumbs.db
*.sh
\ No newline at end of file
body {
overflow: hidden;
min-height: 400px;
min-width: 500px;
}
#sendSerialMessage {
position: absolute;
bottom: 0px;
border-radius: 0px;
border: none;
border-top: 2px solid #bdc3c7;
left: 0;
right: 0;
}
#wrapper {
width: 100%;
height: 100%;
overflow: auto;
padding: 0 0 85px 0;
}
#serialMonitorOutput {
width: 100%;
height: 100%;
overflow: auto;
padding: 10px 20px;
font-family: Courier, monospace;
font-size: 13px;
line-height: 25px;
}
#serialMonitorView {
display: block;
height: 100%;
overflow: hidden;
position:relative;
}
#controlPanel .btn {
padding: 5px 10px;
margin: 5px 10px;
}
#controlPanel {
background: #eee;
width: 100%;
position: absolute;
bottom: 40px;
left: 0;
right: 0;
}
.checkbox input[type="checkbox"].custom-checkbox:checked + .icons .icon-checked, .radio input[type="checkbox"].custom-checkbox:checked + .icons .icon-checked, .checkbox input[type="radio"].custom-radio:checked + .icons .icon-checked, .radio input[type="radio"].custom-radio:checked + .icons .icon-checked {
color: #888;
}
#autoscrollCheckbox {
display: inline-block;
position: absolute;
margin-left: 10px;
margin-top: 12px;
}
span.incoming {
color: #999;
}
span.outgoing {
font-weight:700;
}
#positionPanel {
padding: 20px 30px;
width: 300px;
height: 100%;
background-color: red;
border-left: 2px solid #bdc3c7;
background-color: #fdfdfd;
display: inline-block;
font-size: 30px;
}
#positionPanel .btn-block {
margin-bottom: 15px;
}
#positionDataError{
font-size: 19px;
text-align: center;
padding-top: 20px;
}
.positionVal {
color: #7777FF;
font-size: 30px;
padding-left: 5px;
}
#machineStatus {
font-size: 18px;
}
This diff is collapsed.
#!/bin/sh
cd ~/Research/CBAStuff/git/dmdesign
git co master
git fetch upstream
git merge upstream/gh-pages
git push origin master
cd ~/Research/CBAStuff/git/archives/dma
git fetch origin
git merge origin/master
git subtree pull -P Web/dmdesign fabpeople:people/amanda.ghassaei/dmdesign master --squash
git push origin master
#!/bin/sh
cd ~/Research/CBAStuff/git/dmdesign
git co master
git fetch upstream
git merge upstream/master
git push origin master
cd ~/Research/CBAStuff/git/archives/dma
git fetch origin
git merge origin/master
git subtree pull -P Web/dmdesign fabpeople:people/amanda.ghassaei/dmdesign master --squash
git push origin master
<div id="positionData">
</div>
<a href="#" id="askForPosition" class="btn btn-block btn-lg btn-default">Refresh Position</a><br/>
<a href="#" id="pauseOutput" class="btn btn-block btn-lg btn-warning">Pause</a>
<a href="#" id="stopMachine" class="btn pull-right btn-block btn-lg btn-danger">Stop</a>
\ No newline at end of file
/**
* Created by aghassaei on 9/11/15.
*/
//this.model == serialComm
define(['jquery', 'underscore', 'backbone', 'text!PositionControlPanelView.html', 'text!PositionDataView.html'],
function($, _, Backbone, template, positionTemplate){
return Backbone.View.extend({
el: "#positionPanel",
events: {
"click #stopMachine": "_stopMachine",
"click #pauseOutput": "_pause",
"click #askForPosition": "_askForPosition"
},
initialize: function(){
this.listenTo(this.model.getMachineState(), "change", this._renderPositionData);
this.render();
this._askForPosition();
this.model.send('{"sr":{"stat":t, "posx":t, "posy":t, "posz":t, "posa":t, "line":t}}');
this.model.send('$ej=1');
this.model.send('$sv=2');
},
_renderPositionData: function(){
var machineState = this.model.getMachineState();
$("#positionData").html(_.template(positionTemplate)(machineState.toJSON()));
},
_askForPosition: function(e){//todo should be in machine state init
if (e) e.preventDefault();
this.model.send('{"sr":n}');
},
_stopMachine: function(e){
e.preventDefault();
this.model.send("!");
},
_pause: function(e){
e.preventDefault();
this.model.pauseStream();
},
_makeTemplateJSON: function(){
return {};
},
render: function(){
this.$el.html(this.template(this._makeTemplateJSON()));
this._renderPositionData();
},
template: _.template(template)
});
});
\ No newline at end of file
X: &nbsp;&nbsp;<span class="positionVal"><%= x %></span><br/>
Y: &nbsp;&nbsp;<span class="positionVal"><%= y %></span><br/>
Z: &nbsp;&nbsp;<span class="positionVal"><%= z %></span><br/><br/>
A: &nbsp;&nbsp;<span class="positionVal"><%= a %></span><br/>
B: &nbsp;&nbsp;<span class="positionVal"><%= b %></span><br/>
C: &nbsp;&nbsp;<span class="positionVal"><%= c %></span><br/><br/>
<span id="machineStatus">status: &nbsp;&nbsp;
<% if (status == 0) { %>initializing
<% } else if (status == 1 || status == 3 || status == 4){ %>ready
<% } else if (status == 2){ %>alarm
<% } else if (status == 5) { %>moving
<% } else if (status == 6) { %>holding
<% } else if (status == 9) { %>homing
<% } else if (status == 10) { %>bad footer status
<% } else { %>status = <%= status %><% } %></span>
\ No newline at end of file
/**
* Created by aghassaei on 9/9/15.
*/
define(['backbone'], function(Backbone){
var SerialMonitor = Backbone.Model.extend({
defaults: {
autoscroll: true
},
history: [],
historyIndex: -1,
appendOutput: function(message){
this.history.unshift(message);
this.historyIndex = -1;
if (this.history.length>50) this.history.pop();
},
getPrevHistElem: function(){
this.historyIndex++;
if (this.historyIndex < 0) this.historyIndex = 0;
if (this.history.length == 0) return "";
if (this.history.length <= this.historyIndex) this.historyIndex = this.history.length-1;
return this.history[this.historyIndex];
},
getNewerHistElem: function(){
if (this.history.length == 0) return "";
this.historyIndex --;
if (this.historyIndex < 0) {
this.historyIndex = -1;
return "";
}
if (this.history.length <= this.historyIndex) this.historyIndex = this.history.length-1;
return this.history[this.historyIndex];
}
});
return new SerialMonitor();
});
\ No newline at end of file
/**
* Created by aghassaei on 9/8/15.
*/
define(['jquery', 'underscore', 'backbone'], function($, _, Backbone){
var SerialMonitorView = Backbone.View.extend({
events: {
},
initialize: function(){
this.popup = null;
var self = this;
$(window).unload(function(){
self.popup.close();//close popup when leaving page
});
},
open: function(){
if (this.popup){
this.popup.focus();
return;
}
this.popup = window.open('js/SerialMonitor/', '', 'height=700, width=900, titlebar=no, toolbar=no, menubar=yes, scrollbars=no, resizable=yes, location=no, directories=no, status=no');
var self = this;
$(this.popup).unload(function(){
self.onClose();
});
},
onClose: function(){
var self = this;
setTimeout(function(){
if (self.popup.closed) self.dumpPopup();
}, 100);//todo this is stupid, find an event that fires with window.closed == true
},
dumpPopup: function(){
this.popup = null;
}
});
return new SerialMonitorView();
});
\ No newline at end of file
<div id="wrapper">
<div id="serialMonitorOutput"></div>
</div>
<div>
<div id="controlPanel">
<label id="autoscrollCheckbox" class="checkbox" for="autoscroll">
<input id="autoscroll" data-property="autoscroll" type="checkbox" <% if (autoscroll){ %> checked="checked"<% } %> value="" data-toggle="checkbox" class="serialMonitor custom-checkbox">
<span class="icons"><span class="icon-unchecked"></span><span class="icon-checked"></span></span>
Autoscroll</label>
<a href="#" id="clearMonitor" class="pull-right btn btn-lg btn-default">Clear</a><br/>
</div>
<input id="sendSerialMessage" value="" placeholder="Send Message" class="form-control" type="text">
</div>
\ No newline at end of file
/**
* Created by aghassaei on 9/9/15.
*/
define(['jquery', 'underscore', 'backbone', 'serialComm', 'text!SerialMonitorView.html'],
function($, _, Backbone, serialComm, template){
return Backbone.View.extend({
el: "#serialMonitorView",
events: {
"click #clearMonitor": "_clear",
"change input:checkbox": "_clickCheckbox"
},
initialize: function(){
_.bindAll(this, "_onKeyUp", "render");
$(document).bind('keyup', {}, this._onKeyUp);
this.listenTo(serialComm, "change:lastMessageReceived", this._updateIncomingMessage);
this.listenTo(serialComm, "change:lastMessageSent", this._updateOutgoingMessage);
this.listenTo(serialComm, "change:baudRate change:portName", this.render);
this.listenTo(serialComm, "change:connected", function(){
if (!serialComm.get("connected")) this._close();
});
this.render();
},
_onKeyUp: function(e){
var $output = $("#sendSerialMessage");
if ($output.is(":focus")){
if (e.keyCode == 38) $output.val(this.model.getPrevHistElem());
else if (e.keyCode == 40) $output.val(this.model.getNewerHistElem());
else if (e.keyCode == 13) this._sendMessage(e);
} else {
}
},
_clickCheckbox: function(e){
e.preventDefault();
var $target = $(e.target);
$target.blur();
var property = $target.data("property");
if (!property) {
console.warn("no property associated with checkbox input");
return;
}
this._toggleProperty($target, property);
},
_toggleProperty: function($target, property){ //val = !val
var owner = this._getPropertyOwner($target);
if (owner) this._setOwnerProperty(owner, property, !(this._getOwnerProperty(owner, property)));
},
_getPropertyOwner: function($target){
if ($target.hasClass("serialMonitor")) return this.model;
return null;
},
_getOwnerProperty: function(owner, property){
if (owner instanceof Backbone.Model) return owner.get(property);
return owner[property];
},
_setOwnerProperty: function(owner, property, value){
if (owner instanceof Backbone.Model) owner.set(property, value);
else {
owner[property] = value;
}
},
_sendMessage: function(e){
e.preventDefault();
var message = $("#sendSerialMessage").val();
$("#sendSerialMessage").val("");
if (message == "") return;
serialComm.send(message);
},
_makeTemplateJSON: function(){
return this.model.toJSON();
},
_updateOutgoingMessage: function(){
var message = serialComm.get("lastMessageSent");
this._addOutputData("<span class='outgoing'>" + message + "</span><br/>");
this.model.appendOutput(message);
},
_updateIncomingMessage: function(){
this._addOutputData("<span class='incoming'>" + serialComm.get("lastMessageReceived") + "</span><br/>");
},
_addOutputData: function(html){
var $output = $("#serialMonitorOutput");
$output.append(html);
if (this.model.get("autoscroll")) $output.scrollTop($output.scrollTop()+$output.innerHeight());
},
_clear: function(e){
e.preventDefault();
$("#serialMonitorOutput").html("");
},
_close: function(){
window.close();
},
render: function(){
if ($("input[type=text]").is(":focus")) return;
this.$el.html(this.template(this._makeTemplateJSON()));
},
template: _.template(template)
});
});
\ No newline at end of file
/**
* Created by aghassaei on 10/22/15.
*/
define([], function(){
return {};
});
\ No newline at end of file
/**
* Created by aghassaei on 9/18/15.
*/
define([], function(){
return {
setPosition: function(){}
}
});
\ No newline at end of file
<head>
<title>Serial Monitor</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../../dependencies/flatUI/css/vendor/bootstrap.min.css" rel="stylesheet"><!-- Loading Bootstrap -->
<link href="../../dependencies/flatUI/css/flat-ui.css" rel="stylesheet"><!-- Loading Flat UI -->
<link href="../../css/serialMonitor.css" rel="stylesheet"><!-- Loading custom stylingI -->
<script data-main="main" src="../../dependencies/require/require.js"></script>
</head>
<html>
<div>
<div class="pull-right" id="positionPanel"></div>
<div id="serialMonitorView"></div>
</div>
</html>
\ No newline at end of file
/**
* Created by aghassaei on 10/22/15.
*/
define([], function(){
return {};
});
\ No newline at end of file
/**
* Created by aghassaei on 9/9/15.
*/
require.config({
paths: {
jquery: '../../dependencies/jquery-2.1.3',
underscore: '../../dependencies/underscore',
backbone: '../../dependencies/backbone',
text: '../../dependencies/require/text',
three: '../../dependencies/three',
socketio: '../../dependencies/socket.io-1.3.5',
serialMonitor: 'SerialMonitor',
serialMonitorView: 'SerialMonitorView',
positionControlPanelView: 'PositionControlPanelView',
menuParent: '../menus/MenuParentView',
commParentMenu: '../menus/CommParentMenu',
plist: '../plists/PList',
commPlist: '../plists/commPlist',
serialComm: '../models/SerialComm',
machineState: '../models/MachineState',
cam: 'fakeCam'
},
shim: {
three: {
exports: 'THREE'
},