{"id":4333,"date":"2022-09-10T13:34:46","date_gmt":"2022-09-10T13:34:46","guid":{"rendered":"https:\/\/www.petecodes.co.uk\/?p=4333"},"modified":"2022-09-15T14:42:57","modified_gmt":"2022-09-15T14:42:57","slug":"octoprint-for-the-seeed-studio-reterminal-live-blog-day-6","status":"publish","type":"post","link":"https:\/\/www.petecodes.co.uk\/octoprint-for-the-seeed-studio-reterminal-live-blog-day-6\/","title":{"rendered":"OctoPrint for the Seeed Studio reTerminal – Live Blog – Day 6"},"content":{"rendered":"\n
This post is a series of posts in which I detail my journey to bring OctoPrint to the Seeed Studio reTerminal.<\/p>\n\n\n\n
In today’s post we’ll be doing some more with the Hello World Plugin including adding a Settings Page so we can set the URL first with the Next in the tutorial, we go on to add a settings page to our plugin as well as allow the Wikipedia url to be set and delivered to our template.<\/p>\n\n\n\n For this part of the tutorial we’ll be implementing the Including the We can also then override the The Tutorial shows to replace our plugin code with;<\/p>\n\n\n\n This new code will spit out the Wikipedia URL to the console on startup.<\/p>\n\n\n\n So, replacing our init.py content and restarting OctoPrint;<\/p>\n\n\nconfig.yaml<\/code> file and also then with a new Template.<\/p>\n\n\n\n
Contents<\/h2>\n\n\n\n
Day 0<\/a> <\/a>–<\/a> <\/a>0<\/a>5<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> How it Started<\/a>:<\/a><\/summary>
Day 1<\/a> <\/a>–<\/a> <\/a>0<\/a>5<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>G<\/a>e<\/a>t<\/a>t<\/a>i<\/a>n<\/a>g<\/a> <\/a>S<\/a>t<\/a>a<\/a>r<\/a>t<\/a>e<\/a>d<\/a>:<\/a><\/summary>
Day 2<\/a> <\/a>–<\/a> <\/a>0<\/a>6<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>S<\/a>e<\/a>t<\/a>t<\/a>i<\/a>n<\/a>g<\/a> <\/a>u<\/a>p<\/a> <\/a>t<\/a>h<\/a>e<\/a> <\/a>Enviro<\/font>nment<\/a>:<\/a><\/summary>
Day 3<\/a> <\/a>–<\/a> <\/a>0<\/a>7<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>S<\/a>e<\/a>t<\/a>u<\/a>p<\/a> <\/a>W<\/a>i<\/a>z<\/a>a<\/a>r<\/a>d<\/a>:<\/a><\/summary>
Day 4:<\/a> <\/a>–<\/a> <\/a>0<\/a>8<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> Hello World <\/a>P<\/a>l<\/a>u<\/a>g<\/a>i<\/a>n<\/a> <\/a>D<\/a>e<\/a>v<\/a>e<\/a>l<\/a>o<\/a>p<\/a>ment<\/summary>
Day 5<\/a> <\/a>–<\/a> <\/a>0<\/a>9<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>A<\/a>d<\/a>d<\/a>i<\/a>n<\/a>g<\/a> <\/a>a<\/a> <\/a>F<\/a>r<\/a>o<\/a>n<\/a>t<\/a> <\/a>E<\/a>n<\/a>d<\/a>:<\/a><\/summary>
Day 6<\/a> <\/a>–<\/a> <\/a>1<\/a>0<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>A<\/a>d<\/a>d<\/a>i<\/a>n<\/a>g<\/a> <\/a>S<\/a>e<\/a>t<\/a>t<\/a>i<\/a>n<\/a>g<\/a>s<\/a>:<\/a><\/summary>
Day 7<\/a> <\/a>–<\/a> <\/a>1<\/a>2<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>c<\/a>o<\/a>n<\/a>f<\/a>i<\/a>g<\/a>.<\/a>y<\/a>a<\/a>m<\/a>l<\/a>:<\/a><\/summary>
Day 8<\/a> <\/a>–<\/a> <\/a>1<\/a>3<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>I<\/a>n<\/a>s<\/a>t<\/a>a<\/a>l<\/a>l<\/a>i<\/a>n<\/a>g<\/a> <\/a>O<\/a>c<\/a>t<\/a>o<\/a>P<\/a>r<\/a>i<\/a>n<\/a>t<\/a> <\/a>o<\/a>n<\/a> <\/a>t<\/a>h<\/a>e<\/a> <\/a>r<\/a>e<\/a>T<\/a>e<\/a>r<\/a>m<\/a>i<\/a>n<\/a>a<\/a>l<\/a>:<\/a><\/summary>
Day 9<\/a> <\/a>–<\/a> <\/a>1<\/a>4<\/a>–<\/a>0<\/a>9<\/a>–<\/a>2<\/a>2<\/a> <\/a>–<\/a> <\/a>A<\/a>d<\/a>d<\/a>i<\/a>n<\/a>g<\/a> <\/a>J<\/a>S<\/a>,<\/a> <\/a>C<\/a>S<\/a>S<\/a> <\/a>a<\/a>n<\/a>d<\/a> <\/a>L<\/a>E<\/a>S<\/a>S<\/a>:<\/a><\/summary>
Day 10<\/a> <\/a>–<\/a> 15-09-22 – <\/a>T<\/a>o<\/a>u<\/a>c<\/a>h<\/a>U<\/a>I<\/a>:<\/a><\/summary>
Day 11 – 16-09-22 – reTerminal User Buttons:<\/a><\/summary>
Adding a Settings Page to Hello World – 10-09-22<\/h2>\n\n\n\n
SettingsPlugin<\/code> plugin mixin;<\/p>\n\n\n\n
SettingsPlugin<\/code> mixin allows plugins to store and retrieve their own settings within OctoPrint\u2019s configuration.<\/p><\/blockquote>\n\n\n\n
get_settings_defaults()<\/code> function.<\/p>\n\n\n\n
import octoprint.plugin\n\nclass HelloWorldPlugin(octoprint.plugin.StartupPlugin,\n octoprint.plugin.TemplatePlugin,\n octoprint.plugin.SettingsPlugin):\n def on_after_startup(self):\n self._logger.info("Hello World! (more: %s)" % self._settings.get(["url"]))\n\n def get_settings_defaults(self):\n return dict(url="https:\/\/en.wikipedia.org\/wiki\/Hello_world")\n\n__plugin_name__ = "Hello World"\n__plugin_pythoncompat__ = ">=3.7,<4"\n__plugin_implementation__ = HelloWorldPlugin()<\/code><\/pre><\/div>\n\n\n\n