0
0
mirror of https://github.com/Doodle3D/doodle3d-client.git synced 2024-11-22 01:07:56 +01:00

Display send percentage in status message #126

This commit is contained in:
peteruithoven 2013-12-19 17:33:06 +01:00
parent 8222591041
commit f0492e9246
2 changed files with 25 additions and 21 deletions

View File

@ -14,29 +14,29 @@ function Message() {
var autohideTimeout; var autohideTimeout;
this.init = function($element) { this.init = function($element) {
console.log("Message:init");
this.$element = $element; this.$element = $element;
console.log("$element: ",$element);
} }
this.set = function(text,mode,autoHide,disableEffect) {
this.set = function(text,mode,autoHide) { console.log("Message:set: ",text,mode,autoHide,disableEffect);
console.log("Message:set: ",text,mode,autoHide); if(disableEffect) {
self.fill(text,mode,autoHide)
} else{
self.hide(function() { self.hide(function() {
self.show(); self.show();
self.fill(text,mode,autoHide)
});
}
}
this.fill = function(text,mode,autoHide) {
//console.log("Message:fill: ",text,mode,autoHide);
self.clear(); self.clear();
self.$element.text(text); self.$element.text(text);
self.$element.addClass(mode); self.$element.addClass(mode);
self.show();
self.mode = mode; self.mode = mode;
clearTimeout(autohideTimeout); clearTimeout(autohideTimeout);
if(autoHide) { if(autoHide) {
autohideTimeout = setTimeout(function(){ self.hide()},autoHideDelay); autohideTimeout = setTimeout(function(){ self.hide()},autoHideDelay);
} }
});
} }
this.clear = function($element) { this.clear = function($element) {
this.$element.text(""); this.$element.text("");

View File

@ -144,6 +144,10 @@ function Printer() {
this.sendPrintPart = function(sendIndex,sendLength) { this.sendPrintPart = function(sendIndex,sendLength) {
console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength); console.log("Printer:sendPrintPart sendIndex: " + sendIndex + "/" + this.gcode.length + ", sendLength: " + sendLength);
var sendPercentage = Math.round(sendIndex/this.gcode.length*100);
message.set("Sending doodle to printer: "+sendPercentage+"%",Message.NOTICE,false,true);
var firstOne = (sendIndex == 0)? true : false; var firstOne = (sendIndex == 0)? true : false;
var start = firstOne; // start printing right away var start = firstOne; // start printing right away