OctoPrint - Jinja2

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

OctoPrint - Jinja2

Post by Roberts_Clif » January 15th, 2018, 5:54 pm

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.
Electronics Technician / Computer Programmer

User avatar
LePaul
Reactions:
Posts: 3132
Joined: February 7th, 2016, 10:26 pm
Location: Bangor, Maine USA
3D Printer(s): Ultimaker 2+, FT-5, CR-10, CR-10S, Tevo Tornado
Contact:

Re: OctoPrint - Jinja2

Post by LePaul » January 16th, 2018, 7:50 pm

Sounds like a question for @nallath

nallath
Reactions:
Posts: 265
Joined: February 16th, 2016, 3:12 am
3D Printer(s): Ultimaker

Re: OctoPrint - Jinja2

Post by nallath » January 17th, 2018, 7:01 am

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: 431
Joined: March 25th, 2017, 8:17 am
Location: Washington
3D Printer(s): Hictop 3DP11/12

Re: OctoPrint - Jinja2

Post by Roberts_Clif » January 17th, 2018, 9:23 am

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.
Electronics Technician / Computer Programmer

User avatar
Roberts_Clif
Reactions:
Posts: 431
Joined: March 25th, 2017, 8:17 am
Location: Washington
3D Printer(s): Hictop 3DP11/12

Re: OctoPrint - Jinja2

Post by Roberts_Clif » January 17th, 2018, 11:06 am

P.S.S.

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

Thank You.
Electronics Technician / Computer Programmer

Post Reply

Return to “Wireless Printing and Controllers”

Who is online

Users browsing this forum: No registered users and 3 guests