adding settings

This commit is contained in:
sergiuToporjinschi
2022-01-30 18:04:21 +02:00
parent d6323b6392
commit e2a0710442
15 changed files with 192 additions and 15 deletions
+27
View File
@@ -5,6 +5,14 @@ import octoprint.plugin
from octoprint_CalibrationTools import (api, hooks, models)
defaultSettings = {
"eSteps": {
"extrudeTemp": 210,
"extrudeLength": 100,
"extrudeSpeed": 50,
"markLength": 120
}
}
class CalibrationtoolsPlugin(
octoprint.plugin.StartupPlugin,
@@ -36,6 +44,25 @@ class CalibrationtoolsPlugin(
"css": ["css/style.css"]
}
def get_settings_defaults(self):
return defaultSettings
def get_template_configs(self):
return [
{
"type": "tab",
"name": "Calibration Tools",
"template": "CalibrationTools_tab.jinja2",
"custom_bindings": True,
},
{
"type": "settings",
"name": "Calibration settings",
"template": "CalibrationTools_settings.jinja2",
"custom_bindings": False,
},
]
def get_update_information(self):
# Define the configuration for your plugin to use with the Software Update
# Plugin here. See https://docs.octoprint.org/en/master/bundledplugins/softwareupdate.html
@@ -1,6 +1,7 @@
$(function () {
function CalibrationToolsViewModel(parameters) {
var self = this;
console.log(gettext("test"));
self.loginStateViewModel = parameters[0];
self.settingsViewModel = parameters[1];
self.controlViewModel = parameters[2];
@@ -1,7 +1,29 @@
<div class="container">
<h3>Something in settings</h3>
<div class="row"><span class="title col">Actual extrusion: </span> <span class="val col" data-bind="text: $root.results.actualExtrusion"></span></div>
<div class="row"><span class="title col">New steps value: </span> <span class="val col" data-bind="text: $root.results.newSteps"> </span></div>
<div class="row"><span class="title col">Extrusion marking length: </span> <input class="val col" type="number" step="0.01" class="numberInputField" data-bind="value: $root.results.markLength" ></div>
<div class="row"><span class="title col">Measured value: </span> <input class="val col" type="number" step="0.01" class="numberInputField" data-bind="value: $root.results.remainedLength" ></div>
</div>
{% import "macros.jinja2" as snipped %}
{{ snipped.subSection("E-Steps default settings", true) }}
{{ snipped.field("Extrusion temperature", "The temperature used to extrude in testing&#013;Is better to be a bit higher then usual for reducing the nuzzle pressure",
"number", "settings.plugins.CalibrationTools.eSteps.extrudeTemp", "true", "&ordmC", 1) }}
{{ snipped.field("Filament extrusion length", "The length of filament to be extruded in testing",
"number", "settings.plugins.CalibrationTools.eSteps.extrudeLength", "true", "mm", 1) }}
{{ snipped.field("Filament extrusion speed", "How fast the filament should be extruded in test&#013;A lower value is recommended for avoiding skipping steps",
"number", "settings.plugins.CalibrationTools.eSteps.extrudeSpeed", "true", "mm/s", 1) }}
{{ snipped.field("Filament mark length", "The length marked on filament",
"number", "settings.plugins.CalibrationTools.eSteps.markLength", "true", "mm") }}
<!-- <div class="row-fluid">
<div class="span6">
<label for="temperature" class="pull-right" style="margin-top: 5px;" title="x">
Heating
</label>
</div>
<div class="span6">
<div class="input-prepend input-append">
<span class="add-on" title="Command to preheat the tool before testing">M104 &nbsp&nbsp&nbspS</span>
<input type="number" id="temperature" title="The temperature used to extrude in testing&#013;Is better to be a bit higher then usual for reducing the nuzzle pressure" class="input-mini" step="1"
data-bind="value: $root.testParam.extrudeTemp">
</div>
</div>
</div> -->
@@ -31,10 +31,10 @@
<a data-toggle="tab" href="#calibration_documentation">Documentation</a>
</li>
<li>
<a data-toggle="tab" href="#calibration_x-y-z">X-Y-Z</a>
<a data-toggle="tab" href="#calibration_eSteps">E-Steps</a>
</li>
<li>
<a data-toggle="tab" href="#calibration_eSteps">E-Steps</a>
<a data-toggle="tab" href="#calibration_x-y-z">X-Y-Z-Steps</a>
</li>
<li>
<a data-toggle="tab" href="#calibration_pid">PID</a>
@@ -17,7 +17,8 @@
</blockquote>
{% endmacro %}
{% macro field(label, title, type, binding, enable, unit) %}
{% macro field(label, title, type, binding, enable, unit, step) %}
{% set step = step|default('0.01') %}
<div class="row-fluid">
<div class="span6">
<label for="{{ label }}" class="pull-right" style="margin-top: 5px;" title="{{ title }}">
@@ -26,7 +27,7 @@
</div>
<div class="span6">
<div class="input-append">
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="0.01" data-bind="value: {{ binding }}, enable: {{ enable }}">
<input type="{{ type }}" id="{{ label }}" title="{{ title }}" class="input-small" step="{{ step }}" data-bind="value: {{ binding }}, enable: {{ enable }}">
<span class="add-on" title="{{ title }}">{{ _(unit) }}</span>
</div>
</div>
@@ -12,7 +12,7 @@
<div class="span6">
<div class="input-prepend input-append">
<span class="add-on" title="Command to preheat the tool before testing">M104 &nbsp&nbsp&nbspS</span>
<input type="number" id="temperature" title="The temperature used to extrude in testing&#013;Is better to be a bit higher then usual for reducing the nuzzle pressure" class="input-mini" step="1"
<input type="number" id="temperature" title="The temperature used to extrude in testing (&#186;C)&#013;Is better to be a bit higher then usual for reducing the nuzzle pressure" class="input-mini" step="1"
data-bind="value: $root.testParam.extrudeTemp">
</div>
</div>
@@ -27,10 +27,10 @@
<div class="span6">
<div class="input-prepend input-append">
<span class="add-on" title="Command to extrude filament for testing">G1&nbsp&nbsp&nbspE</span>
<input type="number" id="extrusionLenSpeed" title="The length of filament to be extruded in testing" class="input-mini" step="1"
<input type="number" id="extrusionLenSpeed" title="The length of filament to be extruded in testing (in millimeters)" class="input-mini" step="1"
data-bind="value: $root.testParam.extrudeLength">
<span class="add-on" title="Command to extrude filament for testing">&nbsp&nbsp&nbspF</span>
<input type="number" id="extrusionLenSpeed" title="The speed to extrude filament in testing&#013;Lowest possible" class="input-mini" step="1"
<input type="number" id="extrusionLenSpeed" title="The speed to extrude filament in testing&#013;Lowest possible (mm/s)" class="input-mini" step="1"
data-bind="value: $root.testParam.extrudeSpeed">
</div>
</div>
@@ -91,4 +91,6 @@ First <a href='https://teachingtechyt.github.io/calibration.html#esteps' target=
This calibration is best done with the extruder detached from the hot end, so no restriction is present on the movement. If it is convenient, you can partially disassemble the printer so the output of the extruder is
open and the filament exits in free air. If this is inconvenient, the process below aims to minimize restrictions by extruding very slowly and with a slightly higher temperature. The results from this should still be
reliable.
", "text-warning" ) }}
", "text-warning" ) }}
<strong data-bind="text: gettext('test')"></strong>
@@ -0,0 +1,25 @@
# German translations for OctoPrint-CalibrationTools.
# Copyright (C) 2022 The OctoPrint Project
# This file is distributed under the same license as the
# OctoPrint-CalibrationTools project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: OctoPrint-CalibrationTools 0.1.0\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2022-01-30 12:36+0000\n"
"PO-Revision-Date: 2022-01-30 12:36+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: de\n"
"Language-Team: de <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: octoprint_CalibrationTools/static/js/CalibrationTools.js:4
msgid "test"
msgstr "somethingElse"
@@ -0,0 +1,25 @@
# English translations for OctoPrint-CalibrationTools.
# Copyright (C) 2022 The OctoPrint Project
# This file is distributed under the same license as the
# OctoPrint-CalibrationTools project.
# FIRST AUTHOR <EMAIL@ADDRESS>, 2022.
#
msgid ""
msgstr ""
"Project-Id-Version: OctoPrint-CalibrationTools 0.1.0\n"
"Report-Msgid-Bugs-To: i18n@octoprint.org\n"
"POT-Creation-Date: 2022-01-30 12:36+0000\n"
"PO-Revision-Date: 2022-01-30 12:18+0000\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language: en\n"
"Language-Team: en <LL@li.org>\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Generated-By: Babel 2.9.1\n"
#: octoprint_CalibrationTools/static/js/CalibrationTools.js:4
msgid "test"
msgstr "something"