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.hide(function() { self.fill(text,mode,autoHide)
self.show(); } else{
self.clear(); self.hide(function() {
self.show();
self.$element.text(text); self.fill(text,mode,autoHide)
self.$element.addClass(mode); });
self.show(); }
}
self.mode = mode; this.fill = function(text,mode,autoHide) {
//console.log("Message:fill: ",text,mode,autoHide);
clearTimeout(autohideTimeout); self.clear();
if(autoHide) { self.$element.text(text);
autohideTimeout = setTimeout(function(){ self.hide()},autoHideDelay); self.$element.addClass(mode);
} self.mode = mode;
}); clearTimeout(autohideTimeout);
if(autoHide) {
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