OctoPrint - Jinja2

Wireless/network connectivity to print, control and monitor prints!
Post Reply
User avatar
Roberts_Clif
Reactions:
Posts: 1372
Joined: March 25th, 2017, 8:17 am
Location: Washington, State USA
3D Printer(s): Hictop 3DP11/12

OctoPrint - Jinja2

Post by Roberts_Clif »

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.
User avatar
LePaul
Reactions:
Posts: 3966
Joined: February 7th, 2016, 10:26 pm
Location: Bangor, Maine USA
3D Printer(s): 24 - Yes I have a problem!
Contact:

Re: OctoPrint - Jinja2

Post by LePaul »

Sounds like a question for @nallath
nallath
Reactions:
Posts: 267
Joined: February 16th, 2016, 3:12 am
3D Printer(s): Ultimaker

Re: OctoPrint - Jinja2

Post by nallath »

I don't know anything about how Octoprint does what it does, sorry. Web development isn't my cup of tea.
User avatar
Roberts_Clif
Reactions:
Posts: 1372
Joined: March 25th, 2017, 8:17 am
Location: Washington, State USA
3D Printer(s): Hictop 3DP11/12

Re: OctoPrint - Jinja2

Post by Roberts_Clif »

Thank you for responding.

Believe that it is correct as 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. It is told that they are the simplest language's to learn, however I believe BASIC was (Beginner's All-Purpose Symbolic Instruction Code). And as a programmer this should make the learning all that much easier.

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.
User avatar
Roberts_Clif
Reactions:
Posts: 1372
Joined: March 25th, 2017, 8:17 am
Location: Washington, State USA
3D Printer(s): Hictop 3DP11/12

Re: OctoPrint - Jinja2

Post by Roberts_Clif »

P.S.S.

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

Thank You.
Post Reply

Return to “Wireless Printing and Controllers”