gCodeVisualizer can be enabled as a feature in config now (enabled by

default)
master
Alex Ustyantsev 2013-02-02 19:45:36 +03:00
parent a5518f7877
commit e49669430b
5 changed files with 18 additions and 6 deletions

View File

@ -28,7 +28,8 @@ def index():
"index.html",
webcamStream=settings().get("webcam", "stream"),
enableTimelapse=(settings().get("webcam", "snapshot") is not None and settings().get("webcam", "ffmpeg") is not None),
enableEstimations=(settings().getBoolean("feature", "analyzeGcode"))
enableEstimations=(settings().getBoolean("feature", "analyzeGcode")),
gCodeVisualizer=settings().get("feature", "gCodeVisualizer")
)
#~~ Printer state

View File

@ -39,7 +39,8 @@ old_default_settings = {
"timelapse_tmp": None
},
"feature": {
"analyzeGcode": True
"analyzeGcode": True,
"gCodeVisualizer": True
},
}

View File

@ -109,7 +109,7 @@ GCODE.gCodeReader = (function(){
lines = reader.target.result.split(/\n/);
reader.target.result = null;
prepareGCode();
worker.postMessage({
"cmd":"parseGCode",
"msg":{

View File

@ -812,6 +812,12 @@ function GcodeViewModel() {
self.loadedFilename = undefined;
self.status = 'idle';
self.enabled = false;
self.initialize = function(){
self.enabled = true;
GCODE.ui.initHandlers();
}
self.loadFile = function(filename){
if(self.status == 'idle'){
@ -849,6 +855,8 @@ function GcodeViewModel() {
}
self._processData = function(data) {
if(!self.enabled)return;
if(self.loadedFilename == data.job.filename){
var cmdIndex = GCODE.gCodeReader.getLinesCmdIndex(data.progress.progress);
if(cmdIndex){
@ -1056,8 +1064,10 @@ $(function() {
if (webcamElement) {
ko.applyBindings(webcamViewModel, document.getElementById("webcam"));
}
GCODE.ui.initHandlers();
var gCodeVisualizerElement = document.getElementById("tab2d");
if(gCodeVisualizerElement){
gcodeViewModel.initialize();
}
//~~ startup commands
connectionViewModel.requestData();

View File

@ -128,7 +128,7 @@
<ul class="nav nav-tabs" id="tabs">
<li class="active"><a href="#temp" data-toggle="tab">Temperature</a></li>
<li><a href="#controls" data-toggle="tab">Controls</a></li>
<li><a href="#tab2d" data-toggle="tab">GCode Viewer</a></li>
{% if gCodeVisualizer %}<li><a href="#tab2d" data-toggle="tab">GCode Viewer</a></li>{% endif %}
<!--<li><a href="#speed" data-toggle="tab">Speed</a></li>-->
<li><a href="#term" data-toggle="tab">Terminal</a></li>
{% if webcamStream %}<li><a href="#webcam" data-toggle="tab">Webcam</a></li>{% endif %}