Skip to content

Commit

Permalink
Merge pull request #58 from LazeMSS/develop
Browse files Browse the repository at this point in the history
0.0.1.6 - Release
  • Loading branch information
LazeMSS authored Sep 20, 2021
2 parents 806bd5f + 697db30 commit 763570e
Show file tree
Hide file tree
Showing 5 changed files with 78 additions and 18 deletions.
3 changes: 2 additions & 1 deletion octoprint_toptemp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@ def __init__(self):
'opa': 0.2,
'width': 1,
'color' : '#000000',
}
},
'showSep' : False
}

# type can be cmd, gcIn, gcOut, psutil
Expand Down
1 change: 1 addition & 0 deletions octoprint_toptemp/static/css/TopTemp.css
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
55 changes: 43 additions & 12 deletions octoprint_toptemp/static/js/TopTemp.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand All @@ -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;
}
Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -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');
Expand Down Expand Up @@ -988,17 +1004,21 @@ $(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();
}
});

// Wait for print states to switch
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();
}
});

Expand Down Expand Up @@ -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();
}


Expand All @@ -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;
Expand Down Expand Up @@ -1101,7 +1126,7 @@ $(function() {
if (self.settings.clickPopover()){
iconstr += '<a onclick="javascript:$(\'#navbar_plugin_toptemp_'+$thisID+'\').popover(\'hide\');"><i class="far fa-times-circle"></i></a>';
}
return self.getTempName($thisID)+iconstr;
return tempName+iconstr;
},
'content': '<div id="TopTempPopoverText_'+$thisID+'" class="TopTempPopoverText clearfix">Wait&hellip;</div><div id="TopTempPopoverGraph_'+$thisID+'" class="TopTempPopoverGraph"></div>'
});
Expand Down Expand Up @@ -1143,7 +1168,7 @@ $(function() {
if (popoverDmethod == "manual"){
$this.popover('hide');
}
}).attr('title',"Show more information");
}).attr('title',tempName);
});
}

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -1414,9 +1439,15 @@ $(function() {
if (self.settings.clickPopover() && localSettings.graphSettings.show()){
className += " popclick";
}
$('#navbar_plugin_toptemp').append('<div title="'+prettyName+'" id="'+elname+'" class="'+className+'" data-toptempid="'+name+'" data-toptempcust="'+isCust+'"><div id="TopTempGraph_'+name+'_graph" class="TopTempGraph"></div><div id="navbar_plugin_toptemp_'+name+'_text" class="'+textClass+'"></div></div>');
var sepTxt = ""
if (localSettings.showSep()){
sepTxt = '<span id="'+elname+'_divider" class="divider-vertical"></span>';
}
$('#navbar_plugin_toptemp').append('<div title="'+prettyName+'" id="'+elname+'" class="'+className+'" data-toptempid="'+name+'" data-toptempcust="'+isCust+'"><div id="TopTempGraph_'+name+'_graph" class="TopTempGraph"></div><div id="navbar_plugin_toptemp_'+name+'_text" class="'+textClass+'"></div></div>'+sepTxt);

if (!localSettings.show()){
$('#'+elname).hide();
$('#'+elname+'_divider').hide();
}
// Set fixed width if entered
if (localSettings.width() > 0){
Expand Down
35 changes: 31 additions & 4 deletions octoprint_toptemp/templates/toptemp_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -149,19 +149,18 @@
</label>
</div>
</div>

<div data-bind="visible: settings.plugins.toptemp.bed.icon().length >0 && settings.plugins.toptemp.bed.colorIcons" class="control-group" title="When should we change the color?">
<label class="control-label">Color change level</label>
<div class="controls">
<input type="number" min="0" step="any" data-bind="value: settings.plugins.toptemp.bed.colorChangeLevel">
<span class="help-inline">When the temperature reaches this number the color changes</span>
</div>
</div>

<div class="control-group" title="Number of digits show for temperature">
<label class="control-label">Number of digits</label>
<div class="controls">
<input type="number" min="0" max="2" step="any" data-bind="value: settings.plugins.toptemp.bed.noDigits">
<input type="number" min="0" max="2" step="1" data-bind="value: settings.plugins.toptemp.bed.noDigits">
<span class="help-inline">-1 = return all digits</span>
</div>
</div>
<div class="control-group" title="Decimal seperator">
Expand All @@ -170,6 +169,13 @@
<input type="text" maxlength="1" data-bind="value: settings.plugins.toptemp.bed.decSep" placeholder="Decimal seperator symbol">
</div>
</div>
<div class="control-group" title="Show seperator">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.toptemp.bed.showSep"> {{ _('Show seperator to right') }}
</label>
</div>
</div>
<h4>{{ _('Background graph') }}</h4>
<div class="TopTempGraphSetting control-group" title="Show temperature graph backdrop">
<div class="controls">
Expand Down Expand Up @@ -309,6 +315,13 @@
<input type="text" maxlength="1" data-bind="value: settings.plugins.toptemp.chamber.decSep" placeholder="Decimal seperator symbol">
</div>
</div>
<div class="control-group" title="Show seperator">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: settings.plugins.toptemp.chamber.showSep"> {{ _('Show seperator to right') }}
</label>
</div>
</div>
<h4>{{ _('Background graph') }}</h4>
<div class="TopTempGraphSetting control-group" title="Show temperature graph backdrop">
<div class="controls">
Expand Down Expand Up @@ -455,6 +468,13 @@
<input type="text" maxlength="1" data-bind="value: $parent.settings.plugins.toptemp['tool'+$index()].decSep" placeholder="Decimal seperator symbol">
</div>
</div>
<div class="control-group" title="Show seperator">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-bind="checked: $parent.settings.plugins.toptemp['tool'+$index()].showSep"> {{ _('Show seperator to right') }}
</label>
</div>
</div>
<h4>{{ _('Background graph') }}</h4>
<div class="TopTempGraphSetting control-group" title="Show temperature graph backdrop">
<div class="controls">
Expand Down Expand Up @@ -646,7 +666,7 @@
<div class="control-group" title="Number of digits">
<label class="control-label">Number of digits</label>
<div class="controls">
<input type="number" min="0" max="2" step="any" data-settings="noDigits">
<input type="number" min="-1" step="1" data-settings="noDigits">
</div>
</div>
<div class="control-group" title="Decimal seperator">
Expand All @@ -655,6 +675,13 @@
<input type="text" maxlength="1" data-settings="decSep" placeholder="Decimal seperator symbol">
</div>
</div>
<div class="control-group" title="Show seperator">
<div class="controls">
<label class="checkbox">
<input type="checkbox" data-settings="showSep"> {{ _('Show seperator to right') }}
</label>
</div>
</div>
<h4>{{ _('Background graph') }}</h4>
<div class="TopTempGraphSetting control-group" title="Show graph backdrop">
<div class="controls">
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 763570e

Please sign in to comment.