diff --git a/js_src/Message.js b/js_src/Message.js index 54c347e..09c05d1 100644 --- a/js_src/Message.js +++ b/js_src/Message.js @@ -14,29 +14,29 @@ function Message() { var autohideTimeout; this.init = function($element) { - console.log("Message:init"); - this.$element = $element; - console.log("$element: ",$element); } - - this.set = function(text,mode,autoHide) { - console.log("Message:set: ",text,mode,autoHide); - self.hide(function() { - self.show(); - self.clear(); - - self.$element.text(text); - self.$element.addClass(mode); - self.show(); - - self.mode = mode; - - clearTimeout(autohideTimeout); - if(autoHide) { - autohideTimeout = setTimeout(function(){ self.hide()},autoHideDelay); - } - }); + this.set = function(text,mode,autoHide,disableEffect) { + console.log("Message:set: ",text,mode,autoHide,disableEffect); + if(disableEffect) { + self.fill(text,mode,autoHide) + } else{ + self.hide(function() { + self.show(); + self.fill(text,mode,autoHide) + }); + } + } + this.fill = function(text,mode,autoHide) { + //console.log("Message:fill: ",text,mode,autoHide); + self.clear(); + self.$element.text(text); + self.$element.addClass(mode); + self.mode = mode; + clearTimeout(autohideTimeout); + if(autoHide) { + autohideTimeout = setTimeout(function(){ self.hide()},autoHideDelay); + } } this.clear = function($element) { this.$element.text(""); diff --git a/js_src/Printer.js b/js_src/Printer.js index 8e788f3..329e8d6 100644 --- a/js_src/Printer.js +++ b/js_src/Printer.js @@ -144,6 +144,10 @@ function Printer() { this.sendPrintPart = function(sendIndex,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 start = firstOne; // start printing right away