-
Notifications
You must be signed in to change notification settings - Fork 10
/
scada.rb
107 lines (101 loc) · 2.86 KB
/
scada.rb
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
##########################################################################
# SCADA.RB : test supervision charge point
##########################################################################
require 'Ruiby'
require_relative 'client'
require 'time'
require 'open3'
$BG="#003030"
class Object
def puts(*t) $app.instance_eval { logg(" >",*t) } end
end
Ruiby.app width: 600, height: 300, title: "Tes supervsion bornes" do
@borne="TOTO"
@lconnector=%w{1 2}
stack do
notebook do
page("Parc") do
stack do end
end
page("Bornes") do
separator
flow do
stacki do
@wbornes=grid(%w{name id state},130)
@wbornes.set_data([%w{TOTO 01},%w{TITI 02}])
buttoni "Exit" do exit(0) end
end
stack do
labeli "Borne #{@borne}",{name: "title"}
flowi do
button "Reset Hard"
button "Reset Soft"
button "getListVersion"
button "clearCache"
button "getDiagnostics"
end
space
separator
space
flow do
@lconnector.each do |id|
separator
stack do
labeli "Connector #{id}",{name: "title"}
flowi { table(0,0) do
row do
cell_right(label "etat :") ; cell_left(label "en prise") ; next_row
cell_right(label "energie max:") ; cell_left(label "12 KW") ; next_row
cell_right(label "energie delovré:") ; cell_left(label "0 KW") ; next_row
cell_right(label "badge :") ; cell_left(label "965958979876") ; next_row
cell_right(label "Alarme :") ; cell_left(label "none") ; next_row
end
end }
stack {}
stacki do
flow do
regular
button "Availability:Oper"
button "Availability:Inop"
button "Reserve"
end
flow do
button "CancelReserv"
button "UpdateFirmware"
end
flow do
regular
button "Unlock"
button "RemoteStart"
button "RemoteStop"
end
end
end
end
end
end
end
end
end
end
def_style <<EEND
.button {
background-image: none;
font: Sans bold 12px;
color: #A99;
border-radius: 8px;
padding: 3px 7px 2px 5px;
border-width: 3px;
-GtkButton-shadow-type:none;
-GtkWidget-focus-line-width: 4;
}
GtkSeparator { padding: 20px 0px 10px 0px;}
GtkLabel { font: Sans 10px;}
GtkLabel #title { background: #044; font: Sans 14px;}
GtkEntry { font: Sans bold 10px;}
GtkGrid { font: Sans bold 10px;}
GtkProgressBar {
background-image: -gtk-gradient (linear,left bottom, right top, from(#EEF), to(#00F));
}
EEND
end