9q fix#30
This commit is contained in:
parent
5e38d8705a
commit
dd157be34b
@ -151,7 +151,16 @@ def get_file_from_clip( filename ):
|
|||||||
if mod_globals.clip_arc=='':
|
if mod_globals.clip_arc=='':
|
||||||
return open(os.path.join(mod_globals.cliproot, filename), mode)
|
return open(os.path.join(mod_globals.cliproot, filename), mode)
|
||||||
else:
|
else:
|
||||||
return mod_globals.clip_arc.open(filename, mode)
|
if filename.startswith('../'):
|
||||||
|
filename = filename[3:]
|
||||||
|
try:
|
||||||
|
f = mod_globals.clip_arc.open(filename, mode)
|
||||||
|
return f
|
||||||
|
except:
|
||||||
|
fn = filename.split('/')[-1]
|
||||||
|
lfn = fn.lower()
|
||||||
|
filename = filename.replace(fn,lfn)
|
||||||
|
return mod_globals.clip_arc.open(filename, mode)
|
||||||
|
|
||||||
def file_in_clip( pattern ):
|
def file_in_clip( pattern ):
|
||||||
if mod_globals.clip_arc=='':
|
if mod_globals.clip_arc=='':
|
||||||
|
@ -827,9 +827,9 @@ class DDTLauncher():
|
|||||||
line = self.ecutree.item(item)['values']
|
line = self.ecutree.item(item)['values']
|
||||||
except:
|
except:
|
||||||
if len(self.ecutree.get_children(""))==0:
|
if len(self.ecutree.get_children(""))==0:
|
||||||
tkMessageBox.showinfo("INFO", "Please select the project in the left list and then ECU in the buttom")
|
tkMessageBox.showinfo("INFO", "Please select the project in the left list and then ECU in the bottom")
|
||||||
else:
|
else:
|
||||||
tkMessageBox.showinfo("INFO", "Please select an ECU in the buttom list")
|
tkMessageBox.showinfo("INFO", "Please select an ECU in the bottom list")
|
||||||
return None
|
return None
|
||||||
|
|
||||||
ecu = ast.literal_eval(line[8])
|
ecu = ast.literal_eval(line[8])
|
||||||
|
@ -913,26 +913,32 @@ class DDTECU():
|
|||||||
|
|
||||||
return res
|
return res
|
||||||
|
|
||||||
def makeConf( self, indump = False ):
|
def makeConf( self, indump = False, annotate = False ):
|
||||||
""" try to make config (3B,2E) from current values
|
""" try to make config (3B,2E) from current values
|
||||||
return string list"""
|
return string list"""
|
||||||
|
|
||||||
config = []
|
config = []
|
||||||
conf_v = {}
|
conf_v = {}
|
||||||
|
config_ann = []
|
||||||
|
|
||||||
sentValues = {}
|
sentValues = {}
|
||||||
for r in self.requests.values ():
|
#for r in self.requests.values ():
|
||||||
|
for r in sorted( self.requests.values(), key = lambda x: x.SentBytes):
|
||||||
if not (r.SentBytes[0:2].upper () == '3B'
|
if not (r.SentBytes[0:2].upper () == '3B'
|
||||||
or r.SentBytes[0:2].upper () == '2E') \
|
or r.SentBytes[0:2].upper () == '2E') \
|
||||||
or len (r.SentDI) == 0:
|
or len (r.SentDI) == 0:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
if annotate:
|
||||||
|
config_ann.append('#'*60)
|
||||||
|
config_ann.append('# '+r.Name)
|
||||||
|
|
||||||
#debug
|
#debug
|
||||||
#print '\n','#'*10,r.SentBytes, r.Name
|
#print '\n','#'*10,r.SentBytes, r.Name
|
||||||
|
|
||||||
# update all variables from SentDI
|
# update all variables from SentDI
|
||||||
sentValues.clear ()
|
sentValues.clear ()
|
||||||
for di in r.SentDI.values ():
|
for di in sorted(r.SentDI.values(), key = lambda x: x.FirstByte*8+x.BitOffset):
|
||||||
d = di.Name
|
d = di.Name
|
||||||
|
|
||||||
if indump:
|
if indump:
|
||||||
@ -954,9 +960,6 @@ class DDTECU():
|
|||||||
|
|
||||||
val = self.getValueForConfig( d )
|
val = self.getValueForConfig( d )
|
||||||
|
|
||||||
#debug
|
|
||||||
#print '>', d,'=',val
|
|
||||||
|
|
||||||
if 'ERROR' in val:
|
if 'ERROR' in val:
|
||||||
continue
|
continue
|
||||||
|
|
||||||
@ -964,10 +967,10 @@ class DDTECU():
|
|||||||
sentValues[d].set(val)
|
sentValues[d].set(val)
|
||||||
conf_v[d] = val
|
conf_v[d] = val
|
||||||
|
|
||||||
|
if annotate: # and mod_globals.opt_verbose:
|
||||||
#debug
|
val_ann = self.getValue(d)
|
||||||
#print '\t', d, val
|
config_ann.append('# '+d + ' = ' + val_ann)
|
||||||
|
|
||||||
if len (sentValues) != len (r.SentDI):
|
if len (sentValues) != len (r.SentDI):
|
||||||
# check that there is two params and the first argument is a list
|
# check that there is two params and the first argument is a list
|
||||||
if len (r.SentDI) == 2 and r.SentBytes[0:2].upper () == '3B':
|
if len (r.SentDI) == 2 and r.SentBytes[0:2].upper () == '3B':
|
||||||
@ -994,12 +997,18 @@ class DDTECU():
|
|||||||
conf_v[SDIs[1].Name] = self.getValueForConfig( fdk )
|
conf_v[SDIs[1].Name] = self.getValueForConfig( fdk )
|
||||||
sendCmd = self.packValues (r.Name, sentValues)
|
sendCmd = self.packValues (r.Name, sentValues)
|
||||||
config.append(sendCmd)
|
config.append(sendCmd)
|
||||||
|
if annotate:
|
||||||
|
config_ann.append(sendCmd)
|
||||||
|
config_ann.append('')
|
||||||
continue
|
continue
|
||||||
else:
|
else:
|
||||||
sendCmd = self.packValues (r.Name, sentValues)
|
sendCmd = self.packValues (r.Name, sentValues)
|
||||||
if 'ERROR' in sendCmd:
|
if 'ERROR' in sendCmd:
|
||||||
continue
|
continue
|
||||||
config.append (sendCmd)
|
config.append (sendCmd)
|
||||||
|
if annotate:
|
||||||
|
config_ann.append(sendCmd)
|
||||||
|
config_ann.append('')
|
||||||
|
|
||||||
sentValues.clear ()
|
sentValues.clear ()
|
||||||
|
|
||||||
@ -1009,7 +1018,10 @@ class DDTECU():
|
|||||||
#print conf_v
|
#print conf_v
|
||||||
#print '*'*50
|
#print '*'*50
|
||||||
|
|
||||||
return config, conf_v
|
if annotate:
|
||||||
|
return config_ann, conf_v
|
||||||
|
else:
|
||||||
|
return config, conf_v
|
||||||
|
|
||||||
def bukva( self, bt, l, sign=False):
|
def bukva( self, bt, l, sign=False):
|
||||||
S1 = chr ((bt - l) % 26 + ord ('A'))
|
S1 = chr ((bt - l) % 26 + ord ('A'))
|
||||||
|
@ -602,7 +602,7 @@ class DDTScreen (tk.Frame):
|
|||||||
saveDumpName = mod_globals.dumpName
|
saveDumpName = mod_globals.dumpName
|
||||||
self.decu.loadDump(fname)
|
self.decu.loadDump(fname)
|
||||||
|
|
||||||
(conf_1, cv_1) = self.decu.makeConf(indump=True)
|
(conf_1, cv_1) = self.decu.makeConf(indump=True, annotate=True)
|
||||||
|
|
||||||
#restore state
|
#restore state
|
||||||
mod_globals.dumpName = saveDumpName
|
mod_globals.dumpName = saveDumpName
|
||||||
@ -1052,7 +1052,7 @@ class DDTScreen (tk.Frame):
|
|||||||
|
|
||||||
self.viewmenu = tk.Menu (self.menubar, tearoff=0)
|
self.viewmenu = tk.Menu (self.menubar, tearoff=0)
|
||||||
self.viewmenu.add_command (label="Font Increse (+)", command=self.fontUp)
|
self.viewmenu.add_command (label="Font Increse (+)", command=self.fontUp)
|
||||||
self.viewmenu.add_command (label="Font Decrease (-)", command=self.fontDown)
|
self.viewmenu.add_command (label="Font Decrease (_)", command=self.fontDown)
|
||||||
self.menubar.add_cascade (label="View", menu=self.viewmenu)
|
self.menubar.add_cascade (label="View", menu=self.viewmenu)
|
||||||
|
|
||||||
self.toolsmenu = tk.Menu (self.menubar, tearoff=0)
|
self.toolsmenu = tk.Menu (self.menubar, tearoff=0)
|
||||||
@ -1255,13 +1255,13 @@ class DDTScreen (tk.Frame):
|
|||||||
|
|
||||||
# reset Expert mode with every screen changing
|
# reset Expert mode with every screen changing
|
||||||
# mod_globals.opt_exp = False
|
# mod_globals.opt_exp = False
|
||||||
self.expertmode.set(False)
|
# self.expertmode.set(False)
|
||||||
self.changeMode()
|
self.changeMode()
|
||||||
|
|
||||||
self.currentscreen = scr
|
self.currentscreen = scr
|
||||||
|
|
||||||
# check if it synthetic screen
|
# check if it synthetic screen
|
||||||
if type(scr) is str:
|
if type(scr) is str or type(scr) is unicode:
|
||||||
self.loadSyntheticScreen(scr)
|
self.loadSyntheticScreen(scr)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@ -68,13 +68,13 @@ def acf_buildFull( platf ):
|
|||||||
return
|
return
|
||||||
|
|
||||||
mtc = {}
|
mtc = {}
|
||||||
mtcf = open(plDIR+'/MTC.DAT', 'rb')
|
mtcf = open(plDIR+'/MTC.dat', 'rb')
|
||||||
mtc_list = csv.reader(mtcf, delimiter=';')
|
mtc_list = csv.reader(mtcf, delimiter=';')
|
||||||
for i in mtc_list:
|
for i in mtc_list:
|
||||||
mtc[int(i[0][:-4])] = i[1:]
|
mtc[int(i[0][:-4])] = i[1:]
|
||||||
|
|
||||||
ref = {}
|
ref = {}
|
||||||
reff = open(plDIR+'/REF.DAT', 'rb')
|
reff = open(plDIR+'/REF.dat', 'rb')
|
||||||
ref_list = csv.reader(reff, delimiter=';')
|
ref_list = csv.reader(reff, delimiter=';')
|
||||||
for i in ref_list:
|
for i in ref_list:
|
||||||
ref[int(i[0][:10])] = [i[0][11:]] + i[1:]
|
ref[int(i[0][:10])] = [i[0][11:]] + i[1:]
|
||||||
@ -198,14 +198,14 @@ def acf_getMTC( VIN, preferFile=False ):
|
|||||||
|
|
||||||
#check if there is an mtc file
|
#check if there is an mtc file
|
||||||
|
|
||||||
mz = open(vindir+'MTC.DAT','r')
|
mz = open(vindir+'MTC.dat','r')
|
||||||
mtclist = mz.read().split('\n')
|
mtclist = mz.read().split('\n')
|
||||||
mz.close()
|
mz.close()
|
||||||
for l in mtclist:
|
for l in mtclist:
|
||||||
if l.startswith(vindata.split(';')[1]):
|
if l.startswith(vindata.split(';')[1]):
|
||||||
mtcdata = l
|
mtcdata = l
|
||||||
|
|
||||||
rz = open(vindir+'REF.DAT','r')
|
rz = open(vindir+'REF.dat','r')
|
||||||
reflist = rz.read().split('\n')
|
reflist = rz.read().split('\n')
|
||||||
rz.close()
|
rz.close()
|
||||||
for l in reflist:
|
for l in reflist:
|
||||||
|
@ -294,9 +294,9 @@ class ScanEcus:
|
|||||||
listecu.append( line )
|
listecu.append( line )
|
||||||
else:
|
else:
|
||||||
if mod_globals.opt_scan:
|
if mod_globals.opt_scan:
|
||||||
print pyren_encode( "\n %-12s %-6s %-5s %-40s %s" % ("Addr","Family","Index","Name","Warn") )
|
print pyren_encode( "\n %-7s %-6s %-5s %-40s %s" % ("Addr","Family","Index","Name","Warn") )
|
||||||
else:
|
else:
|
||||||
print pyren_encode( "\n %-12s %-6s %-5s %-40s %s" % ("Addr","Family","Index","Name","Type") )
|
print pyren_encode( "\n %-7s %-6s %-5s %-40s %s" % ("Addr","Family","Index","Name","Type") )
|
||||||
|
|
||||||
for row in self.detectedEcus:
|
for row in self.detectedEcus:
|
||||||
if 'idf' not in row.keys():
|
if 'idf' not in row.keys():
|
||||||
@ -307,14 +307,14 @@ class ScanEcus:
|
|||||||
if row['idf'] in families.keys() and families[row['idf']] in mod_globals.language_dict.keys():
|
if row['idf'] in families.keys() and families[row['idf']] in mod_globals.language_dict.keys():
|
||||||
fmlyn = mod_globals.language_dict[families[row['idf']]]
|
fmlyn = mod_globals.language_dict[families[row['idf']]]
|
||||||
if mod_globals.opt_scan:
|
if mod_globals.opt_scan:
|
||||||
line = "%-2s(%8s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],fmlyn,row['rerr'])
|
line = "%-2s(%3s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],fmlyn,row['rerr'])
|
||||||
else:
|
else:
|
||||||
line = "%-2s(%8s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],fmlyn,row['stdType'])
|
line = "%-2s(%3s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],fmlyn,row['stdType'])
|
||||||
else:
|
else:
|
||||||
if mod_globals.opt_scan:
|
if mod_globals.opt_scan:
|
||||||
line = "%-2s(%8s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],row['doc'].strip(),row['rerr'])
|
line = "%-2s(%3s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],row['doc'].strip(),row['rerr'])
|
||||||
else:
|
else:
|
||||||
line = "%-2s(%8s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],row['doc'].strip(),row['stdType'])
|
line = "%-2s(%3s) %-6s %-5s %-40s %s" % (row['dst'], m_elm.dnat[row['dst']], row['idf'],row['ecuname'],row['doc'].strip(),row['stdType'])
|
||||||
listecu.append( line )
|
listecu.append( line )
|
||||||
|
|
||||||
listecu.append( "Rescan errors" )
|
listecu.append( "Rescan errors" )
|
||||||
|
@ -18,6 +18,7 @@ import string
|
|||||||
import mod_globals
|
import mod_globals
|
||||||
import mod_utils
|
import mod_utils
|
||||||
import mod_ecu
|
import mod_ecu
|
||||||
|
import mod_db_manager
|
||||||
from mod_utils import pyren_encode
|
from mod_utils import pyren_encode
|
||||||
from mod_utils import clearScreen
|
from mod_utils import clearScreen
|
||||||
from mod_utils import ASCIITOHEX
|
from mod_utils import ASCIITOHEX
|
||||||
@ -59,7 +60,7 @@ def run( elm, ecu, command, data ):
|
|||||||
#
|
#
|
||||||
# Data file parsing
|
# Data file parsing
|
||||||
#
|
#
|
||||||
DOMTree = xml.dom.minidom.parse(data)
|
DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data))
|
||||||
ScmRoom = DOMTree.documentElement
|
ScmRoom = DOMTree.documentElement
|
||||||
|
|
||||||
ScmParams = ScmRoom.getElementsByTagName("ScmParam")
|
ScmParams = ScmRoom.getElementsByTagName("ScmParam")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user