Skip to content

Commit e027666

Browse files
committed
add advanced section that allows data and layout overrides to the plotly.js graphing call.
1 parent b332a4d commit e027666

File tree

4 files changed

+28
-2
lines changed

4 files changed

+28
-2
lines changed

octoprint_bedlevelvisualizer/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,8 @@ def get_settings_defaults(self):
8888
'graph_height': "450px", 'show_prusa_adjustments': False, 'show_additional_mesh_data': False,
8989
'show_mesh_statistics': True,
9090
'bed_offset_left': 0, 'bed_offset_right': 0, 'bed_offset_front': 0, 'bed_offset_back': 0,
91-
'show_reference_plane': False, 'render_orthographic': False, 'graph_type': 'surface'}
91+
'show_reference_plane': False, 'render_orthographic': False, 'graph_type': 'surface',
92+
'advanced': {'data': '{"contours": {"showlines": false}}', 'layout': '{}'}}
9293

9394
def get_settings_version(self):
9495
return 1

octoprint_bedlevelvisualizer/static/js/bedlevelvisualizer.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,10 @@ $(function () {
451451
}];
452452
}
453453

454+
// merge advanced overrides into data and layout
455+
$.extend(data[0], JSON.parse(self.settingsViewModel.settings.plugins.bedlevelvisualizer.advanced.data()));
456+
$.extend(layout, JSON.parse(self.settingsViewModel.settings.plugins.bedlevelvisualizer.advanced.layout()));
457+
454458
// graph surface
455459
Plotly.react('bedlevelvisualizergraph', data, layout, config_options).then(self.postPlotHandler);
456460
if (!self.graph_rendered){

octoprint_bedlevelvisualizer/templates/bedlevelvisualizer_settings.jinja2

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<li><a data-toggle="tab" href="#bedlevelvisualizer_stored_data">Data</a></li>
88
<li><a data-toggle="tab" href="#bedlevelvisualizer_corrections">Corrections</a></li>
99
<li><a data-toggle="tab" href="#bedlevelvisualizer_custom_commands">Commands</a></li>
10+
<li><a data-toggle="tab" href="#bedlevelvisualizer_advanced">Advanced</a></li>
1011
<li><a data-toggle="tab" href="#bedlevelvisualizer_support">Support</a></li>
1112
</ul>
1213
<div class="tab-content">
@@ -141,6 +142,15 @@
141142
<input type="text" id="bedlevelvisualizer_date_locale_format" title="Enter the js locale string for date display format for last stored mesh message. If left blank this will default to your browser's date locale settings." data-toggle="tooltip" class="input-small" data-bind="value: settingsViewModel.settings.plugins.bedlevelvisualizer.date_locale_format">
142143
</div>
143144
</div>
145+
<div class="control-group span3">
146+
<div class="control-group">
147+
<input class="input-checkbox" type="checkbox" id="snap_shot"
148+
title="Will average the four quadrants of the bed and render a 4 point reference plane overlaid on graph."
149+
data-toggle="tooltip"
150+
data-bind="checked: settingsViewModel.settings.plugins.bedlevelvisualizer.show_reference_plane"
151+
style="display: inline-block;margin-bottom: 5px;"/> Show Reference Plane
152+
</div>
153+
</div>
144154
</div>
145155
<div class="row-fluid">
146156
<div class="control-group">
@@ -295,6 +305,17 @@
295305
</div>
296306
</div>
297307

308+
<div id="bedlevelvisualizer_advanced" class="tab-pane">
309+
<div class="control-group">
310+
<label for="bedlevelvisualizer_advanced_data"><i class="icon icon-info-sign" title="Custom plotly.js data parameters to merge with other settings" data-toggle="tooltip"></i> Data Overrides</label>
311+
<textarea class="input-block-level" id="bedlevelvisualizer_advanced_data" rows="15" data-bind="value: settingsViewModel.settings.plugins.bedlevelvisualizer.advanced.data"></textarea>
312+
</div>
313+
<div class="control-group">
314+
<label for="bedlevelvisualizer_advanced_layout"><i class="icon icon-info-sign" title="Custom plotly.js layout parameters to merge with other settings" data-toggle="tooltip"></i> Layout Overrides</label>
315+
<textarea class="input-block-level" id="bedlevelvisualizer_advanced_layout" rows="15" data-bind="value: settingsViewModel.settings.plugins.bedlevelvisualizer.advanced.layout"></textarea>
316+
</div>
317+
</div>
318+
298319
<div id="bedlevelvisualizer_support" class="tab-pane">
299320
<div class="row-fluid">
300321
<label class="well">It is extremely important to enable debug logging, restart OctoPrint, and attempt a probing process prior to submitting a bug report. Include the file <code>plugin_bedlevelvisualizer_debug.log</code> from OctoPrint's logging section by downloading it locally and dragging it into your bug report's comment. Check out the <a href="http://github.com/jneilliii/OctoPrint-BedLevelVisualizer/blob/master/wiki/index.md" target="_blank">wiki</a> for explanation of settings and tips.</label>

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
plugin_name = "Bed Visualizer"
1515

1616
# The plugin's version. Can be overwritten within OctoPrint's internal data via __plugin_version__ in the plugin module
17-
plugin_version = "1.1.2rc3"
17+
plugin_version = "1.1.2rc4"
1818

1919
# The plugin's description. Can be overwritten within OctoPrint's internal data via __plugin_description__ in the plugin
2020
# module

0 commit comments

Comments
 (0)