/
switch.py
61 lines (46 loc) · 1.34 KB
/
switch.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# error disable
from epyk.core.Page import Report
page = Report()
page.headers.dev()
# Console component
c = page.ui.rich.console("* This is a log section for all the events in the different buttons *", options={"timestamp": True})
s1 = page.ui.buttons.toggle({'on': "true", 'off': 'false'})
#
# wih an event
s2 = page.ui.buttons.toggle({'on': "true", 'off': 'false'})
s2.click([
page.js.alert("Go to True")
],
[
c.dom.write("S2 => Back to false")
]
)
# In Sync with S2 changes
s3 = page.ui.buttons.toggle({'on': "true", 'off': 'false'}, color='red')
#s3.switch_label.style.css.width = 100
# Label is changing
s4 = page.ui.buttons.toggle({'on': "true", 'off': 'false'})
# Different CSS Style
s5 = page.ui.buttons.toggle({'on': "true", 'off': 'false'})
#s5.switch_label.style.css.width = 40
# Click even
page.ui.button("click").click([
c.dom.write(s1.dom.content),
# Change the label without changing the state of the component
s4.dom.set_text("Correct"),
s4.dom.set_text("Wrong", False)
])
# Rebuild S4 with new underlying values
page.ui.button("Build S4").click([
s4.build({'on': "Yes", 'off': 'No'})
])
# Toggle the state of the component
page.ui.button("Force Selection").click([
s4.js.toggle()
])
# Rebuild S4 and set it to True
page.ui.button("Disable").click([
s4.build({'on': "Yes", 'off': 'No'}),
s4.js.true()
])
c.move()