Passed
Push — web-timed ( cfeda2...1d9e3e )
by Matt
01:11
created

tests.web   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 28
dl 0
loc 46
rs 10
c 0
b 0
f 0
1
from PyDMXControl.controllers import uDMXController as Controller
2
from PyDMXControl.effects.Intensity import Dim
3
from PyDMXControl.profiles.Eyourlife import Small_Flat_Par
4
from PyDMXControl.profiles.Stairville import LED_Par_10mm, LED_Par_36
5
6
dmx = Controller()
7
8
# Fixtures
9
dmx.add_fixture(LED_Par_10mm)
10
dmx.add_fixture(LED_Par_36)
11
dmx.add_fixture(LED_Par_36)
12
dmx.add_fixture(LED_Par_36)
13
dmx.add_fixture(LED_Par_36)
14
dmx.add_fixture(Small_Flat_Par)
15
dmx.add_fixture(Small_Flat_Par)
16
17
18
def strobe():
19
    dmx.all_off()
20
    Dim.group_apply(dmx.get_all_fixtures(), 50)
21
22
23
def clear():
24
    dmx.all_locate()
25
    dmx.clear_all_effects()
26
27
28
# Web Debug
29
dmx.web_control(
30
    callbacks={
31
        "strobe": strobe,
32
        "clear": clear
33
    },
34
    host="0.0.0.0",
35
    port=80
36
)
37
38
# Web console is now accessible at http://0.0.0.0/ and will have two custom global callbacks for testing.
39
40
# Dim all up
41
dmx.all_locate()
42
43
# Done
44
dmx.sleep_till_enter()
45
dmx.close()
46