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=='':
|
||||
return open(os.path.join(mod_globals.cliproot, filename), mode)
|
||||
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 ):
|
||||
if mod_globals.clip_arc=='':
|
||||
|
@ -827,9 +827,9 @@ class DDTLauncher():
|
||||
line = self.ecutree.item(item)['values']
|
||||
except:
|
||||
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:
|
||||
tkMessageBox.showinfo("INFO", "Please select an ECU in the buttom list")
|
||||
tkMessageBox.showinfo("INFO", "Please select an ECU in the bottom list")
|
||||
return None
|
||||
|
||||
ecu = ast.literal_eval(line[8])
|
||||
|
@ -913,26 +913,32 @@ class DDTECU():
|
||||
|
||||
return res
|
||||
|
||||
def makeConf( self, indump = False ):
|
||||
def makeConf( self, indump = False, annotate = False ):
|
||||
""" try to make config (3B,2E) from current values
|
||||
return string list"""
|
||||
|
||||
config = []
|
||||
conf_v = {}
|
||||
config_ann = []
|
||||
|
||||
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'
|
||||
or r.SentBytes[0:2].upper () == '2E') \
|
||||
or len (r.SentDI) == 0:
|
||||
continue
|
||||
|
||||
if annotate:
|
||||
config_ann.append('#'*60)
|
||||
config_ann.append('# '+r.Name)
|
||||
|
||||
#debug
|
||||
#print '\n','#'*10,r.SentBytes, r.Name
|
||||
|
||||
# update all variables from SentDI
|
||||
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
|
||||
|
||||
if indump:
|
||||
@ -954,9 +960,6 @@ class DDTECU():
|
||||
|
||||
val = self.getValueForConfig( d )
|
||||
|
||||
#debug
|
||||
#print '>', d,'=',val
|
||||
|
||||
if 'ERROR' in val:
|
||||
continue
|
||||
|
||||
@ -964,9 +967,9 @@ class DDTECU():
|
||||
sentValues[d].set(val)
|
||||
conf_v[d] = val
|
||||
|
||||
|
||||
#debug
|
||||
#print '\t', d, val
|
||||
if annotate: # and mod_globals.opt_verbose:
|
||||
val_ann = self.getValue(d)
|
||||
config_ann.append('# '+d + ' = ' + val_ann)
|
||||
|
||||
if len (sentValues) != len (r.SentDI):
|
||||
# check that there is two params and the first argument is a list
|
||||
@ -994,12 +997,18 @@ class DDTECU():
|
||||
conf_v[SDIs[1].Name] = self.getValueForConfig( fdk )
|
||||
sendCmd = self.packValues (r.Name, sentValues)
|
||||
config.append(sendCmd)
|
||||
if annotate:
|
||||
config_ann.append(sendCmd)
|
||||
config_ann.append('')
|
||||
continue
|
||||
else:
|
||||
sendCmd = self.packValues (r.Name, sentValues)
|
||||
if 'ERROR' in sendCmd:
|
||||
continue
|
||||
config.append (sendCmd)
|
||||
if annotate:
|
||||
config_ann.append(sendCmd)
|
||||
config_ann.append('')
|
||||
|
||||
sentValues.clear ()
|
||||
|
||||
@ -1009,7 +1018,10 @@ class DDTECU():
|
||||
#print conf_v
|
||||
#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):
|
||||
S1 = chr ((bt - l) % 26 + ord ('A'))
|
||||
|
@ -602,7 +602,7 @@ class DDTScreen (tk.Frame):
|
||||
saveDumpName = mod_globals.dumpName
|
||||
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
|
||||
mod_globals.dumpName = saveDumpName
|
||||
@ -1052,7 +1052,7 @@ class DDTScreen (tk.Frame):
|
||||
|
||||
self.viewmenu = tk.Menu (self.menubar, tearoff=0)
|
||||
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.toolsmenu = tk.Menu (self.menubar, tearoff=0)
|
||||
@ -1255,13 +1255,13 @@ class DDTScreen (tk.Frame):
|
||||
|
||||
# reset Expert mode with every screen changing
|
||||
# mod_globals.opt_exp = False
|
||||
self.expertmode.set(False)
|
||||
# self.expertmode.set(False)
|
||||
self.changeMode()
|
||||
|
||||
self.currentscreen = scr
|
||||
|
||||
# check if it synthetic screen
|
||||
if type(scr) is str:
|
||||
if type(scr) is str or type(scr) is unicode:
|
||||
self.loadSyntheticScreen(scr)
|
||||
return
|
||||
|
||||
|
@ -68,13 +68,13 @@ def acf_buildFull( platf ):
|
||||
return
|
||||
|
||||
mtc = {}
|
||||
mtcf = open(plDIR+'/MTC.DAT', 'rb')
|
||||
mtcf = open(plDIR+'/MTC.dat', 'rb')
|
||||
mtc_list = csv.reader(mtcf, delimiter=';')
|
||||
for i in mtc_list:
|
||||
mtc[int(i[0][:-4])] = i[1:]
|
||||
|
||||
ref = {}
|
||||
reff = open(plDIR+'/REF.DAT', 'rb')
|
||||
reff = open(plDIR+'/REF.dat', 'rb')
|
||||
ref_list = csv.reader(reff, delimiter=';')
|
||||
for i in ref_list:
|
||||
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
|
||||
|
||||
mz = open(vindir+'MTC.DAT','r')
|
||||
mz = open(vindir+'MTC.dat','r')
|
||||
mtclist = mz.read().split('\n')
|
||||
mz.close()
|
||||
for l in mtclist:
|
||||
if l.startswith(vindata.split(';')[1]):
|
||||
mtcdata = l
|
||||
|
||||
rz = open(vindir+'REF.DAT','r')
|
||||
rz = open(vindir+'REF.dat','r')
|
||||
reflist = rz.read().split('\n')
|
||||
rz.close()
|
||||
for l in reflist:
|
||||
|
@ -294,9 +294,9 @@ class ScanEcus:
|
||||
listecu.append( line )
|
||||
else:
|
||||
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:
|
||||
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:
|
||||
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():
|
||||
fmlyn = mod_globals.language_dict[families[row['idf']]]
|
||||
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:
|
||||
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:
|
||||
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:
|
||||
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( "Rescan errors" )
|
||||
|
@ -18,6 +18,7 @@ import string
|
||||
import mod_globals
|
||||
import mod_utils
|
||||
import mod_ecu
|
||||
import mod_db_manager
|
||||
from mod_utils import pyren_encode
|
||||
from mod_utils import clearScreen
|
||||
from mod_utils import ASCIITOHEX
|
||||
@ -59,7 +60,7 @@ def run( elm, ecu, command, data ):
|
||||
#
|
||||
# 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
|
||||
|
||||
ScmParams = ScmRoom.getElementsByTagName("ScmParam")
|
||||
|
Loading…
x
Reference in New Issue
Block a user