-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmod_ecu_screen.py
124 lines (106 loc) · 3.57 KB
/
mod_ecu_screen.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
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#Embedded file name: /build/PyCLIP/android/app/mod_ecu_screen.py
class ecu_screen_dataref:
name = ''
type = ''
def __init__(self, dr, n = '', t = ''):
if len(n):
self.name = n
self.type = t
return
self.name = dr.getAttribute('name')
self.type = dr.getAttribute('type')
class ecu_own_screen:
datarefs = []
functions = []
name = ''
def __init__(self, n):
self.name = n
class ecu_screen_subfunction:
datarefs = []
name = ''
text = ''
def __init__(self, sfu, tran):
self.name = sfu.getAttribute('name')
codetext = sfu.getAttribute('codetext')
defaultText = sfu.getAttribute('defaultText')
self.text = ''
if codetext:
if codetext in tran.keys():
self.text = tran[codetext]
elif defaultText:
self.text = defaultText
DataRefs = sfu.getElementsByTagName('DataRef')
if DataRefs:
self.datarefs = []
for dr in DataRefs:
dataref = ecu_screen_dataref(dr)
self.datarefs.append(dataref)
class ecu_screen_function:
subfunctions = []
datarefs = []
name = ''
text = ''
def __init__(self, fu, tran):
self.name = fu.getAttribute('name')
codetext = fu.getAttribute('codetext')
defaultText = fu.getAttribute('defaultText')
self.text = ''
if codetext:
if codetext in tran.keys():
self.text = tran[codetext]
elif defaultText:
self.text = defaultText
SubFunctions = fu.getElementsByTagName('SubFunction')
if SubFunctions:
self.subfunctions = []
for sfu in SubFunctions:
subfunction = ecu_screen_subfunction(sfu, tran)
self.subfunctions.append(subfunction)
return
DataRefs = fu.getElementsByTagName('DataRef')
if DataRefs:
self.datarefs = []
for dr in DataRefs:
dataref = ecu_screen_dataref(dr)
self.datarefs.append(dataref)
class ecu_screen:
functions = []
datarefs = []
name = ''
text = ''
def __init__(self, sc, tran = None):
if tran is None:
self.name = sc
return
self.name = sc.getAttribute('name')
codetext = sc.getAttribute('codetext')
defaultText = sc.getAttribute('defaultText')
self.text = ''
if codetext:
if codetext in tran.keys():
self.text = tran[codetext]
elif defaultText:
self.text = defaultText
Functions = sc.getElementsByTagName('Function')
if Functions:
self.functions = []
for fu in Functions:
function = ecu_screen_function(fu, tran)
self.functions.append(function)
return
DataRefs = sc.getElementsByTagName('DataRef')
if DataRefs:
self.datarefs = []
for dr in DataRefs:
dataref = ecu_screen_dataref(dr)
self.datarefs.append(dataref)
class ecu_screens:
def __init__(self, screen_list, mdoc, tran):
Screens = mdoc.getElementsByTagName('Screens').item(0)
if Screens:
Screen = Screens.getElementsByTagName('Screen')
if Screen:
for sc in Screen:
screen = ecu_screen(sc, tran)
if len(screen.functions) > 0 or len(screen.datarefs) > 0:
screen_list.append(screen)