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': '
Wait…
' }); @@ -1143,7 +1168,7 @@ $(function() { if (popoverDmethod == "manual"){ $this.popover('hide'); } - }).attr('title',"Show more information"); + }).attr('title',tempName); }); } @@ -1365,8 +1390,8 @@ $(function() { } } - self.isCustom = function(string){ - if (string.slice(0,2) == "cu"){ + self.isCustom = function(strName){ + if (strName.slice(0,2) == "cu"){ return true; }else{ return false; @@ -1414,9 +1439,15 @@ $(function() { if (self.settings.clickPopover() && localSettings.graphSettings.show()){ className += " popclick"; } - $('#navbar_plugin_toptemp').append('
'); + var sepTxt = "" + if (localSettings.showSep()){ + sepTxt = ''; + } + $('#navbar_plugin_toptemp').append('
'+sepTxt); + if (!localSettings.show()){ $('#'+elname).hide(); + $('#'+elname+'_divider').hide(); } // Set fixed width if entered if (localSettings.width() > 0){ diff --git a/octoprint_toptemp/templates/toptemp_settings.jinja2 b/octoprint_toptemp/templates/toptemp_settings.jinja2 index 6152894..a474db3 100644 --- a/octoprint_toptemp/templates/toptemp_settings.jinja2 +++ b/octoprint_toptemp/templates/toptemp_settings.jinja2 @@ -149,7 +149,6 @@ -
@@ -157,11 +156,11 @@ When the temperature reaches this number the color changes
-
- + + -1 = return all digits
@@ -170,6 +169,13 @@
+
+
+ +
+

{{ _('Background graph') }}

@@ -309,6 +315,13 @@
+
+
+ +
+

{{ _('Background graph') }}

@@ -455,6 +468,13 @@
+
+
+ +
+

{{ _('Background graph') }}

@@ -646,7 +666,7 @@
- +
@@ -655,6 +675,13 @@
+
+
+ +
+

{{ _('Background graph') }}

diff --git a/setup.py b/setup.py index 199465c..f6746ad 100644 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ plugin_name = "Top Temp" # The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module -plugin_version = "0.0.1.5" +plugin_version = "0.0.1.6" # The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin # module