From 4189c0c988daa939be0e8ec979ce0ae0563c4b7d Mon Sep 17 00:00:00 2001 From: "jakob.stendahl" Date: Mon, 12 Dec 2022 14:13:40 +0100 Subject: Create docs from python code --- public/docs/Scripting/NeoBehaviour/index.html | 1851 +++++++++++++++++++++++++ 1 file changed, 1851 insertions(+) create mode 100644 public/docs/Scripting/NeoBehaviour/index.html (limited to 'public/docs/Scripting/NeoBehaviour/index.html') diff --git a/public/docs/Scripting/NeoBehaviour/index.html b/public/docs/Scripting/NeoBehaviour/index.html new file mode 100644 index 0000000..7d049d8 --- /dev/null +++ b/public/docs/Scripting/NeoBehaviour/index.html @@ -0,0 +1,1851 @@ + + + + + + + + + + + + + + + + Main interface - Luxcena Neo Documentation + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + Skip to content + + +
+
+ +
+ + + + +
+ + +
+ +
+ + + + + + +
+
+ + + +
+
+
+ + + + +
+
+
+ + + +
+
+
+ + + +
+
+
+ + + +
+
+ + + + +

Documentation for NeoBehaviour

+ + +
+ + + +

+ luxcena_neo.neo_behaviour.NeoBehaviour + + +

+ + +
+ + +

This is the base-class "main" should inherit from!

+ +
+ All methods are blocking +

This means that you could potentially loose a "tick"

+

For example, if "eachSecond" is taking up the thread, and the clock goes from 11:58 to 12:02, "eachHour", will not be called.

+
+
+ Do NOT override init in your implementation, this will break some features. +

For this purpose you should instead use the on_start method!

+

Important: An instance of the Strip class will be available in your module as strip without any setup on your part.

+ + + + + +
+ + + + + + + + + +
+ + + +

+declare_variables() + +

+ + +
+ +

This should be overridden, and ALL variables should be declared here. +When this method is called, variables can be declared using self.declare().

+ +
+ +
+ +
+ + + +

+each_day() + +

+ + +
+ +

This method is called every day at noon, given that the thread is open

+ +
+ +
+ +
+ + + +

+each_hour() + +

+ + +
+ +

This method is called every whole hour (on the clock), given that the thread is open

+ +
+ +
+ +
+ + + +

+each_minute() + +

+ + +
+ +

This method is called every mintue (on the clock), given that the thread is open

+ +
+ +
+ +
+ + + +

+each_second() + +

+ + +
+ +

This method is called every second (on the clock), given that the thread is open

+ +
+ +
+ +
+ + + +

+each_tick() + +

+ + +
+ +

This method will be run every tick, that means every time the program has time

+ +
+ +
+ +
+ + + +

+on_start() + +

+ + +
+ +

This method will be run right after init

+ +
+ +
+ + + +
+ +
+ +

An example of the usage of the class

+
from luxcena_neo import NeoBehaviour
+
+class Main(NeoBehaviour):
+    def on_start(self):
+        strip.setPixelColor(0, "#fafafa")
+
+
+ + +
+ + + +

+ luxcena_neo.neo_behaviour.Variable + + +

+ + +
+ + +

The base class for any variable, this should probably not be used directly.

+ + + + + +
+ + + + + + + +
+ + + +

+value + + + property + writable + + +

+ + +
+ +

This is likely the property you should use to get the current value of the variable.

+
+ +
+ + + +
+ + + +

+__init__(name, default, var_type, on_change=None) + +

+ + +
+ +

The base constructor for any variable. All these parameters should likely be passed on by + the subclass inheriting this one.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name +

A string which is the name of the variable, keep in mind that this is case sensitive.

+ required +
default +

This will be set as the default value of the variable the first time the script is started.

+ required +
var_type + VariableType +

This is the enum number of the variable type, this is just a number which is used to + communicate with the frontend which value picker to show.

+ required +
on_change +

Optional callable, which will be called with the new value every time the variable is + updated (both programatically and via user input).

+ None +
+ +
+ +
+ + + +
+ +
+ +

+ + +
+ + + +

+ luxcena_neo.neo_behaviour.ColorVariable + + +

+ + +
+

+ Bases: Variable

+ + +

This is a variable storing a color value.

+ +
+ Right now, this only properly supports setting the value as a hex string. +

This will hopefully change in the future, but it is likely that the main +operation will remain as hex strings.

+
+ + + + +
+ + + + + + + + + +
+ + + +

+__init__(name, *color, **kwargs) + +

+ + +
+ +

Constructor for a color variable

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str +

Will be passed on to the parent class (Variable).

+ required +
*color +

The next positional parameters will be used as the default color. + Right now, it will just pick the first one, and interpret it as a hex color.

+ () +
**kwargs +

Keyword arguments will be passed to the parent class (Variable).

+ {} +
+ +
+ +
+ + + +
+ +
+ +

+ + +
+ + + +

+ luxcena_neo.neo_behaviour.IntegerVariable + + +

+ + +
+

+ Bases: Variable

+ + +

A variable for storing a integer value (whole number).

+ + + + + +
+ + + + + + + + + +
+ + + +

+__init__(name, default=0, min_val=0, max_val=255, **kwargs) + +

+ + +
+ +

Constructor for a integer variable

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str +

Will be passed on to the parent class (Variable).

+ required +
default + int +

A number which will be set as the default if the mode has never been run before.

+ 0 +
min_val + int +

The lowest value this variable can have (inclusive).

+ 0 +
max_val + int +

The highest value this variable can have (inclusive).

+ 255 +
**kwargs +

Keyword arguments will be passed to the parent class (Variable).

+ {} +
+ +
+ +
+ + + +
+ +
+ +

+ + +
+ + + +

+ luxcena_neo.neo_behaviour.FloatVariable + + +

+ + +
+

+ Bases: Variable

+ + +

A variable for storing a float value (decimal number).

+ + + + + +
+ + + + + + + + + +
+ + + +

+__init__(name, default=0.0, min_val=0.0, max_val=255.0, step=0.5, **kwargs) + +

+ + +
+ +

Constructor for a float variable

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str +

Will be passed on to the parent class (Variable).

+ required +
default + float +

A number which will be set as the default if the mode has never been run before.

+ 0.0 +
min_val + float +

The lowest value this variable can have (inclusive).

+ 0.0 +
max_val + float +

The highest value this variable can have (inclusive).

+ 255.0 +
step + float +

This does not affect the python code, it only affects the value picker which will be shown in the frontend.

+ 0.5 +
**kwargs +

Keyword arguments will be passed to the parent class (Variable).

+ {} +
+ +
+ +
+ + + +
+ +
+ +

+ + +
+ + + +

+ luxcena_neo.neo_behaviour.BooleanVariable + + +

+ + +
+

+ Bases: Variable

+ + +

A variable for storing a boolean value (on/off).

+ + + + + +
+ + + + + + + + + +
+ + + +

+__init__(name, default, **kwargs) + +

+ + +
+ +

Constructor for a boolean variable

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str +

Will be passed on to the parent class (Variable).

+ required +
default + bool +

A boolean which will be set as the default if the mode has never been run before.

+ required +
**kwargs +

Keyword arguments will be passed to the parent class (Variable).

+ {} +
+ +
+ +
+ + + +
+ +
+ +

+ + +
+ + + +

+ luxcena_neo.neo_behaviour.Trigger + + +

+ + +
+

+ Bases: Variable

+ + +

A trigger which can execute some function.

+

Although technically a variable, this is not intended as one. +It is intended to be used with a on_change function, such that +this action is performed when this trigger is activated.

+

It will show up as a button in the frontend, and can also be triggered by +setting the value (What you set it as will be ignored, so e.g. None.

+ + + + + +
+ + + + + + + + + +
+ + + +

+__init__(name, **kwargs) + +

+ + +
+ +

Constructor for the Trigger +It is important to set the on_change callable (see the Variable class). If you don't +this class is completely useless.

+ +

Parameters:

+ + + + + + + + + + + + + + + + + + + + + + + +
NameTypeDescriptionDefault
name + str +

The name of the trigger variable (mostly useful if you wanted to trigger it in the code).

+ required +
**kwargs +

Keyword arguments will be passed to the parent class (Variable).

+ {} +
+ +
+ +
+ + + +
+ +
+ +
+ + + + + + +
+
+ + +
+ +
+ + + +
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v1.2.3