diff --git a/octoprint_toptemp/__init__.py b/octoprint_toptemp/__init__.py index 16cc44e..5a16a24 100644 --- a/octoprint_toptemp/__init__.py +++ b/octoprint_toptemp/__init__.py @@ -102,7 +102,8 @@ def __init__(self): 'opa': 0.2, 'width': 1, 'color' : '#000000', - } + }, + 'showSep' : False } # type can be cmd, gcIn, gcOut, psutil diff --git a/octoprint_toptemp/static/css/TopTemp.css b/octoprint_toptemp/static/css/TopTemp.css index 5f5d7d7..5eaf301 100644 --- a/octoprint_toptemp/static/css/TopTemp.css +++ b/octoprint_toptemp/static/css/TopTemp.css @@ -167,6 +167,7 @@ div.popover.toptempPopover .popover-title a{ float: left; margin-right: 5px; margin-left: -8px; + cursor: pointer; } #navbar_plugin_toptemp div.TopTempGraph .ct-line { diff --git a/octoprint_toptemp/static/js/TopTemp.js b/octoprint_toptemp/static/js/TopTemp.js index 915a3c2..e8da448 100644 --- a/octoprint_toptemp/static/js/TopTemp.js +++ b/octoprint_toptemp/static/js/TopTemp.js @@ -61,9 +61,11 @@ $(function() { // Do know this or want it shown if (typeof iSettings == "undefined" || iSettings.show() == false || data.actual == null || data.actual == undefined || (data.target == 0 && iSettings.hideOnNoTarget()) || (!customType && self.settings.hideInactiveTemps() && self.tempModel.isOperational() !== true) || ('waitForPrint' in iSettings && iSettings.waitForPrint() && !self.connection.isPrinting()) ){ $('#navbar_plugin_toptemp_'+name).hide(); + $('#navbar_plugin_toptemp_'+name+'_divider').hide(); return; }else{ $('#navbar_plugin_toptemp_'+name).show(); + $('#navbar_plugin_toptemp_'+name+'_divider').show(); } // Create if not found @@ -208,8 +210,15 @@ $(function() { if(iSettings.postCalc() != null){ value = self.PostCalcProces(value,iSettings.postCalc()); } - value = Number.parseFloat(value).toFixed(iSettings.noDigits()); - value = value.replace(".",iSettings.decSep()); + if (iSettings.noDigits() != -1){ + value = Number.parseFloat(value).toFixed(iSettings.noDigits()); + }else{ + value = Number.parseFloat(value); + } + value = value.toString(); + if (iSettings.decSep() != ""){ + value = value.replace(".",iSettings.decSep()); + } // Add unit if (iSettings.unit() != ""){ value += iSettings.unit(); @@ -224,8 +233,15 @@ $(function() { formatSymbol = "F"; } - value = Number.parseFloat(value).toFixed(iSettings.noDigits()); - value = value.replace(".",iSettings.decSep()); + if (iSettings.noDigits() != -1){ + value = Number.parseFloat(value).toFixed(iSettings.noDigits()); + }else{ + value = Number.parseFloat(value); + } + value = value.toString(); + if (iSettings.decSep() != ""){ + value = value.replace(".",iSettings.decSep()); + } if (iSettings.showUnit()){ value += '°'+formatSymbol; } @@ -657,7 +673,7 @@ $(function() { if (self.previewOn){ var sortlist = $('#TopTempSortList >div').map(function(){return $(this).data('sortid')}).get(); $.each(sortlist,function(i,val){ - $('#navbar_plugin_toptemp').append($('#navbar_plugin_toptemp_'+val)); + $('#navbar_plugin_toptemp').append($('#navbar_plugin_toptemp_'+val),$('#navbar_plugin_toptemp_'+val+"_divider")); }); self.fixMargins(); } @@ -827,14 +843,14 @@ $(function() { // Sort them to update preview var sortlist = $('#TopTempSortList >div').map(function(){return $(this).data('sortid')}).get(); $.each(sortlist,function(i,val){ - $('#navbar_plugin_toptemp').append($('#navbar_plugin_toptemp_'+val)); + $('#navbar_plugin_toptemp').append($('#navbar_plugin_toptemp_'+val),$('#navbar_plugin_toptemp_'+val+"_divider")); }); self.fixMargins(); $('div.modal-backdrop').css('top',$('#navbar').outerHeight()+'px'); }else{ // Restore sort order $.each(self.settings.sortOrder().reverse(),function(i,val){ - $('#navbar_plugin_toptemp').append($('#navbar_plugin_toptemp_'+val)); + $('#navbar_plugin_toptemp').append($('#navbar_plugin_toptemp_'+val),$('#navbar_plugin_toptemp_'+val+"_divider")); }); self.fixMargins(); $('div.modal-backdrop').css('top','0px'); @@ -988,8 +1004,10 @@ $(function() { self.tempModel.isOperational.subscribe(function(state){ if (state){ $('#navbar_plugin_toptemp div.TopTempPrinter').show(); + $('#navbar_plugin_toptemp div.TopTempPrinter + span.divider-vertical').show(); }else if(self.settings.hideInactiveTemps()){ $('#navbar_plugin_toptemp div.TopTempPrinter').hide(); + $('#navbar_plugin_toptemp div.TopTempPrinter + span.divider-vertical').hide(); } }); @@ -997,8 +1015,10 @@ $(function() { self.connection.isPrinting.subscribe(function(state){ if (state){ $('#navbar_plugin_toptemp div.TopTempWaitPrinter').show(); + $('#navbar_plugin_toptemp div.TopTempWaitPrinter + span.divider-vertical').show(); }else{ $('#navbar_plugin_toptemp div.TopTempWaitPrinter').hide(); + $('#navbar_plugin_toptemp div.TopTempWaitPrinter + span.divider-vertical').hide(); } }); @@ -1057,12 +1077,15 @@ $(function() { // Hide all non operationel if (self.settings.hideInactiveTemps() && (!('isOperational' in self.tempModel) || self.tempModel.isOperational() !== true)){ $('#navbar_plugin_toptemp div.TopTempPrinter').hide(); + $('#navbar_plugin_toptemp div.TopTempPrinter + span.divider-vertical').hide(); } if (self.connection.isPrinting()){ $('#navbar_plugin_toptemp div.TopTempWaitPrinter').show(); + $('#navbar_plugin_toptemp div.TopTempWaitPrinter + span.divider-vertical').show(); }else{ $('#navbar_plugin_toptemp div.TopTempWaitPrinter').hide(); + $('#navbar_plugin_toptemp div.TopTempWaitPrinter + span.divider-vertical').hide(); } @@ -1073,6 +1096,8 @@ $(function() { var $isCustom = $this.data('toptempcust'); var $thisID = $this.data('toptempid'); var isettings = self.getSettings($thisID); + var tempName = self.getTempName($thisID); + $this.attr('title',tempName); // Hide or not if (!isettings.showPopover()){ return; @@ -1101,7 +1126,7 @@ $(function() { if (self.settings.clickPopover()){ iconstr += ''; } - return self.getTempName($thisID)+iconstr; + return tempName+iconstr; }, 'content': '