Welcome! Log In Create A New Profile

Advanced

OctoPrint - Jinja2

Posted by Roberts_Clif 
OctoPrint - Jinja2
January 15, 2018 06:12PM
Octoprint uses Jinja2 a central object called the template Environment. In OctoPrint Jinja2 environment is this line in control.jinja2.
input type="number" style="width: 153px" data-bind="slider: {min: 50, max: 150, step: 1, value: feedRate, tooltip: 'hide'}"

I would like to know if I changed it to this, would it still work only sliding between 30 and 130.
input type="number" style="width: 153px" data-bind="slider: {min: 30, max: 130, step: 1, value: feedRate, tooltip: 'hide'}"

Or is there more to the Jinja template environment than just changing a line in the template.

I Found this.
To load a template from this environment you just have to call the get_template(Feed rate) method which then returns the loaded Template:
To render it with some variables, just call the print template.render(value: feedRate) method:

Can someone tell me if I am on the rite track.

Edited 2 time(s). Last edit at 01/15/2018 06:15PM by Roberts_Clif.
Re: OctoPrint - Jinja2
January 17, 2018 11:18AM
Jinja2 is a full featured template engine for Python, and python is an interpreted language.

Will do what I do best and self teach myself Jinja2 and Python. I have cloned my OctoPrint's SD cards Using the same program that was used to burn to SD card with (Win32DiskImager).
This should make recovering from an error simpler. I will now start testing my learning and programming skills.

Have discovered that if Cura Print Speed is set to 40 then the OctoPrint slider control changes the speed accordingly. I Mean it adjusts the speed based on the Set printer speed of 40. 40 being OctoPrint slider 100 percent and 20 would be OctoPrint slider 50 percent making OctoPrint slider 150 percent Printer speed 60.


If any one know of a Good web Site to Learn Jinja2 and Python, would appreciate help.

Thank You.
Sorry, only registered users may post in this forum.

Click here to login