From e2a071044275fceeaede7c61f673d134040a2dd9 Mon Sep 17 00:00:00 2001 From: sergiuToporjinschi Date: Sun, 30 Jan 2022 18:04:21 +0200 Subject: [PATCH] adding settings --- octoprint_CalibrationTools/__init__.py | 27 +++++++++++++ .../static/js/CalibrationTools.js | 1 + .../CalibrationTools_settings.jinja2 | 36 ++++++++++++++---- .../templates/CalibrationTools_tab.jinja2 | 4 +- .../templates/macros.jinja2 | 5 ++- .../templates/tabs/tab-esteps.jinja2 | 10 +++-- .../translations/de/LC_MESSAGES/messages.mo | Bin 0 -> 465 bytes .../translations/de/LC_MESSAGES/messages.po | 25 ++++++++++++ .../translations/en/LC_MESSAGES/messages.mo | Bin 0 -> 496 bytes .../translations/en/LC_MESSAGES/messages.po | 25 ++++++++++++ translations/de/LC_MESSAGES/messages.mo | Bin 0 -> 465 bytes translations/de/LC_MESSAGES/messages.po | 25 ++++++++++++ translations/en/LC_MESSAGES/messages.mo | Bin 0 -> 496 bytes translations/en/LC_MESSAGES/messages.po | 25 ++++++++++++ translations/messages.pot | 24 ++++++++++++ 15 files changed, 192 insertions(+), 15 deletions(-) create mode 100644 octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.mo create mode 100644 octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.po create mode 100644 octoprint_CalibrationTools/translations/en/LC_MESSAGES/messages.mo create mode 100644 octoprint_CalibrationTools/translations/en/LC_MESSAGES/messages.po create mode 100644 translations/de/LC_MESSAGES/messages.mo create mode 100644 translations/de/LC_MESSAGES/messages.po create mode 100644 translations/en/LC_MESSAGES/messages.mo create mode 100644 translations/en/LC_MESSAGES/messages.po create mode 100644 translations/messages.pot diff --git a/octoprint_CalibrationTools/__init__.py b/octoprint_CalibrationTools/__init__.py index 80d5afc..98134b0 100644 --- a/octoprint_CalibrationTools/__init__.py +++ b/octoprint_CalibrationTools/__init__.py @@ -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 diff --git a/octoprint_CalibrationTools/static/js/CalibrationTools.js b/octoprint_CalibrationTools/static/js/CalibrationTools.js index dd62392..68e6f9a 100644 --- a/octoprint_CalibrationTools/static/js/CalibrationTools.js +++ b/octoprint_CalibrationTools/static/js/CalibrationTools.js @@ -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]; diff --git a/octoprint_CalibrationTools/templates/CalibrationTools_settings.jinja2 b/octoprint_CalibrationTools/templates/CalibrationTools_settings.jinja2 index 5762b7c..e18dfb9 100644 --- a/octoprint_CalibrationTools/templates/CalibrationTools_settings.jinja2 +++ b/octoprint_CalibrationTools/templates/CalibrationTools_settings.jinja2 @@ -1,7 +1,29 @@ -
-

Something in settings

-
Actual extrusion:
-
New steps value:
-
Extrusion marking length:
-
Measured value:
-
\ No newline at end of file +{% import "macros.jinja2" as snipped %} +{{ snipped.subSection("E-Steps default settings", true) }} + +{{ snipped.field("Extrusion temperature", "The temperature used to extrude in testing Is better to be a bit higher then usual for reducing the nuzzle pressure", + "number", "settings.plugins.CalibrationTools.eSteps.extrudeTemp", "true", "ºC", 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 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") }} + + diff --git a/octoprint_CalibrationTools/templates/CalibrationTools_tab.jinja2 b/octoprint_CalibrationTools/templates/CalibrationTools_tab.jinja2 index 63a22b2..38c4373 100644 --- a/octoprint_CalibrationTools/templates/CalibrationTools_tab.jinja2 +++ b/octoprint_CalibrationTools/templates/CalibrationTools_tab.jinja2 @@ -31,10 +31,10 @@ Documentation
  • - X-Y-Z + E-Steps
  • - E-Steps + X-Y-Z-Steps
  • PID diff --git a/octoprint_CalibrationTools/templates/macros.jinja2 b/octoprint_CalibrationTools/templates/macros.jinja2 index d7d4d4f..8752094 100644 --- a/octoprint_CalibrationTools/templates/macros.jinja2 +++ b/octoprint_CalibrationTools/templates/macros.jinja2 @@ -17,7 +17,8 @@ {% endmacro %} -{% macro field(label, title, type, binding, enable, unit) %} +{% macro field(label, title, type, binding, enable, unit, step) %} +{% set step = step|default('0.01') %}
    - + {{ _(unit) }}
    diff --git a/octoprint_CalibrationTools/templates/tabs/tab-esteps.jinja2 b/octoprint_CalibrationTools/templates/tabs/tab-esteps.jinja2 index 3a65f47..a21bf76 100644 --- a/octoprint_CalibrationTools/templates/tabs/tab-esteps.jinja2 +++ b/octoprint_CalibrationTools/templates/tabs/tab-esteps.jinja2 @@ -12,7 +12,7 @@
    M104    S -
    @@ -27,10 +27,10 @@
    G1   E -    F -
    @@ -91,4 +91,6 @@ First \ No newline at end of file diff --git a/octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.mo b/octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..6b95cc9a68ccd3f3d22cffce5d67e6980f601705 GIT binary patch literal 465 zcmaJ-O-sW-5LNJ$qh}8zcu;g=l7iHNkl4^h@7rV>SJK_EyAk_C{006me~Y^n ztS27~%zHbtZ+Ks)Cm%-!$EMCqU0Cu5H>UqIk7%__idR}_oR|1arDB4Iuqd?1B;y(< zq-JYLw2^ZmY6YI_yPmV8jgT5sRk0GsZKW_5Auzwohr;YOcGnfMaj4Wbt_4YGa^ew9zGp^9cMa zC!MG9At;;0L~u<_RQawkR+_%++omRr_n>$oQc)eXdV}4=oIQR+CC0oECF4~H-8IwB Y1Lf2tO--P?5XNLpYY5zX*LRM-0e^{yzW@LL literal 0 HcmV?d00001 diff --git a/octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.po b/octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.po new file mode 100644 index 0000000..869199d --- /dev/null +++ b/octoprint_CalibrationTools/translations/de/LC_MESSAGES/messages.po @@ -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 , 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 \n" +"Language: de\n" +"Language-Team: de \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" + diff --git a/octoprint_CalibrationTools/translations/en/LC_MESSAGES/messages.mo b/octoprint_CalibrationTools/translations/en/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..39eb8d4f3b1be3051a1aafc1a1bf3c8d375588c6 GIT binary patch literal 496 zcmZutO-sW-5RKx+96fs&Z;EbAB1nym^eajs(Nd%LZ9B%5bT{ly#r_a~f&a^+zr%@w zdho$x=M8UmhWEa+_3AM;nY+xRR{TMi>n&!=eB1E60l(YK53W5zN8ZGmC!CWQFT_1s zr;JYEW=>{el_oKiwVGK;+%Ao&9fUy?g#Hv8V@VXQQVTIyRZf&90Tp$0&+u&1&IZO- z{^X_;{rAP(bLgpoK2A&Qfe)5DO#Mlr=_)$ae-7j?dUxpX8-E48a78Joc6 zU7o{rzsR7Q75#DE>yJj$?DqD;&!w(bvf`Dfe}pJeF53=t^SoE9_R0%?Qm?G6#ig-J zmw;}*q)X#-_%73Z4SOj>2YxXwvfrTEEQUrCa#ZEI;Z=k$bllWZ>2sJrO6!o)6+MW~ uudhA+0j, 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 \n" +"Language: en\n" +"Language-Team: en \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" + diff --git a/translations/de/LC_MESSAGES/messages.mo b/translations/de/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..6b95cc9a68ccd3f3d22cffce5d67e6980f601705 GIT binary patch literal 465 zcmaJ-O-sW-5LNJ$qh}8zcu;g=l7iHNkl4^h@7rV>SJK_EyAk_C{006me~Y^n ztS27~%zHbtZ+Ks)Cm%-!$EMCqU0Cu5H>UqIk7%__idR}_oR|1arDB4Iuqd?1B;y(< zq-JYLw2^ZmY6YI_yPmV8jgT5sRk0GsZKW_5Auzwohr;YOcGnfMaj4Wbt_4YGa^ew9zGp^9cMa zC!MG9At;;0L~u<_RQawkR+_%++omRr_n>$oQc)eXdV}4=oIQR+CC0oECF4~H-8IwB Y1Lf2tO--P?5XNLpYY5zX*LRM-0e^{yzW@LL literal 0 HcmV?d00001 diff --git a/translations/de/LC_MESSAGES/messages.po b/translations/de/LC_MESSAGES/messages.po new file mode 100644 index 0000000..869199d --- /dev/null +++ b/translations/de/LC_MESSAGES/messages.po @@ -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 , 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 \n" +"Language: de\n" +"Language-Team: de \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" + diff --git a/translations/en/LC_MESSAGES/messages.mo b/translations/en/LC_MESSAGES/messages.mo new file mode 100644 index 0000000000000000000000000000000000000000..39eb8d4f3b1be3051a1aafc1a1bf3c8d375588c6 GIT binary patch literal 496 zcmZutO-sW-5RKx+96fs&Z;EbAB1nym^eajs(Nd%LZ9B%5bT{ly#r_a~f&a^+zr%@w zdho$x=M8UmhWEa+_3AM;nY+xRR{TMi>n&!=eB1E60l(YK53W5zN8ZGmC!CWQFT_1s zr;JYEW=>{el_oKiwVGK;+%Ao&9fUy?g#Hv8V@VXQQVTIyRZf&90Tp$0&+u&1&IZO- z{^X_;{rAP(bLgpoK2A&Qfe)5DO#Mlr=_)$ae-7j?dUxpX8-E48a78Joc6 zU7o{rzsR7Q75#DE>yJj$?DqD;&!w(bvf`Dfe}pJeF53=t^SoE9_R0%?Qm?G6#ig-J zmw;}*q)X#-_%73Z4SOj>2YxXwvfrTEEQUrCa#ZEI;Z=k$bllWZ>2sJrO6!o)6+MW~ uudhA+0j, 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 \n" +"Language: en\n" +"Language-Team: en \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" + diff --git a/translations/messages.pot b/translations/messages.pot new file mode 100644 index 0000000..ab65caf --- /dev/null +++ b/translations/messages.pot @@ -0,0 +1,24 @@ +# Translations template for OctoPrint-CalibrationTools. +# Copyright (C) 2022 The OctoPrint Project +# This file is distributed under the same license as the +# OctoPrint-CalibrationTools project. +# FIRST AUTHOR , 2022. +# +#, fuzzy +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: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \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" +