Skip to content

Developement

Tim edited this page Dec 18, 2016 · 5 revisions

So you want to help out? Great!

Take a look at TODO.md to see what needs to be done.

Important technical information

Familiarize yourself with Kivy

It is used not only for graphics, but kivy Properties are used to store information as well.

The get(obj, indexes, e, debug = False) function

This is used to get elements of dictionaries, lists, or objects and deals with None and nonexistent keys gracefully.
obj: The object, dict, or list to get data from. For example, app.client.job.
indexes: A list of indexes to use to get from the object, dict, or list. For example, ['file', 'name'].
e: What to return if there is a None or a nonexistent key involved. For example, "No File".
debug: If True, print debug info to the console, defaults to False if not provided.

Example: get(app.client.job, ['file', 'name'], "No File") will get the name of the currently loaded file from Octoprint, and give "No File" if there is no loaded file or Octoprint is not connected. This is equivalent to doing app.client.job['file']['name'], but with added error handling.

Data from Octoprint

Everything that comes from Octoprint is in the client instance in OctoprintLcd. This is accessable from kv as app.client and from python as App.get_running_app().client. Everything is stored in Kivy properties, which make it easy to make things update automatically. Anything that uses them in kv will be automatically updated by Kivy. If you need to update automatically when something changes in python, use something like App.get_running_app().client.bind(job=self.updateFilament), where self.updateFilament gets called whenever job is updated.

These properties follow Octoprint's common data model.

Clone this wiki locally