diff --git a/.gitignore b/.gitignore index 1da736e..290d015 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,4 @@ /.idea/ -/.DS_Store /EcuDacia/ /EcuRsm/ /Output/ @@ -22,6 +21,9 @@ MTCSAVE/ NML/ Params/ Python27/ +/build/ +/.intino/ +/venv/ *.pyc *.p *.zip @@ -29,9 +31,9 @@ Python27/ *.acf *.tdv *.bin +*.DS_Store pyren3/history.txt pyren3/parser.out pyren3/parsetab.py pyren3/scen_appr_4valves.py pyren3/scen_ecri_fap2.py - diff --git a/PYREN.BAT b/PYREN.BAT index 84253ac..b793856 100644 --- a/PYREN.BAT +++ b/PYREN.BAT @@ -1,4 +1,5 @@ @echo off echo Run's app ... -python27\python.exe _pyren_launcher.py +rem uses python3 +python3.exe _pyren3_launcher.py pause \ No newline at end of file diff --git a/pyren.sh b/pyren.sh index c93e7e3..93198b0 100644 --- a/pyren.sh +++ b/pyren.sh @@ -12,6 +12,6 @@ #./venv/bin/activate printf "Runs app ...\n" #./venv/bin/python ./_pyren_launcher.py -python ./_pyren_launcher.py +python3 ./_pyren3_launcher.py #printf "Deactivate venv ..." #./venv/bin/deactivate \ No newline at end of file diff --git a/pyren3/cmdr_10742_rep.py b/pyren3/cmdr_10742_rep.py index d518489..a28f733 100755 --- a/pyren3/cmdr_10742_rep.py +++ b/pyren3/cmdr_10742_rep.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os import mod_globals diff --git a/pyren3/cmdr_chkelm.py b/pyren3/cmdr_chkelm.py index c4da949..164be6d 100755 --- a/pyren3/cmdr_chkelm.py +++ b/pyren3/cmdr_chkelm.py @@ -1,10 +1,10 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os import time import mod_globals -import pyren +import pyren3 cmdb = ''' #v1.0 ;AC P; ATZ ; Z ; reset all diff --git a/pyren3/cmdr_example.py b/pyren3/cmdr_example.py index 0b1b20d..67bb894 100755 --- a/pyren3/cmdr_example.py +++ b/pyren3/cmdr_example.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # ______ ___ ___ ___ ___ ___ ______ __ _______ # | ___| \ \ / / / \ | \/ | | _ \ | | | ____| @@ -13,7 +13,7 @@ import time import mod_globals import mod_ecu -import pyren +import pyren3 os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) diff --git a/pyren3/cmdr_odometr.py b/pyren3/cmdr_odometr.py index 06af9fc..05267a2 100755 --- a/pyren3/cmdr_odometr.py +++ b/pyren3/cmdr_odometr.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os import time @@ -7,7 +7,7 @@ import mod_db_manager import mod_globals import mod_ecu -import pyren +import pyren3 os.chdir(os.path.dirname(os.path.realpath(sys.argv[0]))) diff --git a/pyren3/cmdr_simple.py b/pyren3/cmdr_simple.py index aa259f5..9fc9bab 100755 --- a/pyren3/cmdr_simple.py +++ b/pyren3/cmdr_simple.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os #import serial diff --git a/pyren3/cmdr_simple_iso.py b/pyren3/cmdr_simple_iso.py index 7459927..0afcbbc 100755 --- a/pyren3/cmdr_simple_iso.py +++ b/pyren3/cmdr_simple_iso.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys, os import serial diff --git a/pyren3/mod_acf_func.py b/pyren3/mod_acf_func.py index e6d635e..c01a120 100644 --- a/pyren3/mod_acf_func.py +++ b/pyren3/mod_acf_func.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import os diff --git a/pyren3/mod_acf_proc.py b/pyren3/mod_acf_proc.py index b3af32b..bc79bc2 100644 --- a/pyren3/mod_acf_proc.py +++ b/pyren3/mod_acf_proc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import os diff --git a/pyren3/mod_db_manager.py b/pyren3/mod_db_manager.py index d21bb49..9fba4d7 100644 --- a/pyren3/mod_db_manager.py +++ b/pyren3/mod_db_manager.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import re diff --git a/pyren3/mod_ddt.py b/pyren3/mod_ddt.py index 716cc4f..0371860 100755 --- a/pyren3/mod_ddt.py +++ b/pyren3/mod_ddt.py @@ -631,7 +631,7 @@ class DDTLauncher(): ecu['xml'], ecu['dump'], ecu['ses']] - fout.write(str(';'.join(e)).encode("ascii", "ignore") + '\n') + fout.write(';'.join(e) + '\n') fout.close() copyfile(filename, "./savedCAR_prev.csv") diff --git a/pyren3/mod_ddt_config.py b/pyren3/mod_ddt_config.py index 40617f1..f10ba67 100755 --- a/pyren3/mod_ddt_config.py +++ b/pyren3/mod_ddt_config.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- diff --git a/pyren3/mod_ddt_data.py b/pyren3/mod_ddt_data.py index b2e0bbb..cc71e5a 100755 --- a/pyren3/mod_ddt_data.py +++ b/pyren3/mod_ddt_data.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- diff --git a/pyren3/mod_ddt_ecu.py b/pyren3/mod_ddt_ecu.py index 0090c18..b9fd80b 100755 --- a/pyren3/mod_ddt_ecu.py +++ b/pyren3/mod_ddt_ecu.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- import sys, os diff --git a/pyren3/mod_ddt_request.py b/pyren3/mod_ddt_request.py index 315fdb8..2cbd90e 100755 --- a/pyren3/mod_ddt_request.py +++ b/pyren3/mod_ddt_request.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- diff --git a/pyren3/mod_ddt_screen.py b/pyren3/mod_ddt_screen.py index 26e6ea1..d8ec8f8 100755 --- a/pyren3/mod_ddt_screen.py +++ b/pyren3/mod_ddt_screen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # -*- coding: utf-8 -*- import gc diff --git a/pyren3/mod_ddt_utils.py b/pyren3/mod_ddt_utils.py index 53fba11..20937ee 100755 --- a/pyren3/mod_ddt_utils.py +++ b/pyren3/mod_ddt_utils.py @@ -44,16 +44,16 @@ class settings(): pass def load(self): - if not os.path.isfile("../settings.p"): + if not os.path.isfile("../settings3.p"): self.save() - f = open('../settings.p', 'rb') + f = open('../settings3.p', 'rb') tmp_dict = pickle.load(f) f.close() self.__dict__.update(tmp_dict) def save(self): - f = open('../settings.p', 'wb') + f = open('../settings3.p', 'wb') pickle.dump(self.__dict__, f) f.close() diff --git a/pyren3/mod_dfg.py b/pyren3/mod_dfg.py index e206194..9e69097 100755 --- a/pyren3/mod_dfg.py +++ b/pyren3/mod_dfg.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from xml.dom.minidom import parse import xml.dom.minidom diff --git a/pyren3/mod_ecu_command.py b/pyren3/mod_ecu_command.py index be6ce86..9c12993 100755 --- a/pyren3/mod_ecu_command.py +++ b/pyren3/mod_ecu_command.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_utils import Choice from mod_utils import ChoiceFromDict diff --git a/pyren3/mod_ecu_dataids.py b/pyren3/mod_ecu_dataids.py index b0180a8..94f336e 100755 --- a/pyren3/mod_ecu_dataids.py +++ b/pyren3/mod_ecu_dataids.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_ecu_service import ecu_mnemolocation from mod_utils import pyren_encode diff --git a/pyren3/mod_ecu_default.py b/pyren3/mod_ecu_default.py index d2ec206..52fb628 100755 --- a/pyren3/mod_ecu_default.py +++ b/pyren3/mod_ecu_default.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_ecu_mnemonic import * from mod_ecu_screen import * diff --git a/pyren3/mod_ecu_identification.py b/pyren3/mod_ecu_identification.py index 2995ff6..b91bd4d 100755 --- a/pyren3/mod_ecu_identification.py +++ b/pyren3/mod_ecu_identification.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_ecu_mnemonic import * from mod_utils import Choice diff --git a/pyren3/mod_ecu_mnemonic.py b/pyren3/mod_ecu_mnemonic.py index 3ac0d8a..c7a5eb0 100755 --- a/pyren3/mod_ecu_mnemonic.py +++ b/pyren3/mod_ecu_mnemonic.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_ecu_service import * diff --git a/pyren3/mod_ecu_parameter.py b/pyren3/mod_ecu_parameter.py index d4f997c..e89e9ca 100755 --- a/pyren3/mod_ecu_parameter.py +++ b/pyren3/mod_ecu_parameter.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_ecu_mnemonic import * from mod_utils import Choice diff --git a/pyren3/mod_ecu_scenario.py b/pyren3/mod_ecu_scenario.py index 8975f68..e97c192 100755 --- a/pyren3/mod_ecu_scenario.py +++ b/pyren3/mod_ecu_scenario.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import re diff --git a/pyren3/mod_ecu_screen.py b/pyren3/mod_ecu_screen.py index ade4496..05051b2 100755 --- a/pyren3/mod_ecu_screen.py +++ b/pyren3/mod_ecu_screen.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_utils import Choice from xml.dom.minidom import parse diff --git a/pyren3/mod_ecu_service.py b/pyren3/mod_ecu_service.py index 2273448..19992a0 100755 --- a/pyren3/mod_ecu_service.py +++ b/pyren3/mod_ecu_service.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_utils import Choice from mod_utils import pyren_encode diff --git a/pyren3/mod_ecu_state.py b/pyren3/mod_ecu_state.py index 76fea38..6f06533 100755 --- a/pyren3/mod_ecu_state.py +++ b/pyren3/mod_ecu_state.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 from mod_ecu_mnemonic import * from mod_utils import Choice diff --git a/pyren3/mod_elm.py b/pyren3/mod_elm.py index d1dbdea..29da11b 100644 --- a/pyren3/mod_elm.py +++ b/pyren3/mod_elm.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 """ module contains class for working with ELM327 version: 180408 diff --git a/pyren3/mod_globals.py b/pyren3/mod_globals.py index 5ae8f21..911f8f8 100755 --- a/pyren3/mod_globals.py +++ b/pyren3/mod_globals.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 opt_debug = False debug_file = None diff --git a/pyren3/mod_mtc.py b/pyren3/mod_mtc.py index 0bd9db8..aa3b186 100755 --- a/pyren3/mod_mtc.py +++ b/pyren3/mod_mtc.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import csv import os diff --git a/pyren3/mod_ply.py b/pyren3/mod_ply.py index 6ac1840..a726dcf 100755 --- a/pyren3/mod_ply.py +++ b/pyren3/mod_ply.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys sys.path.insert(0,"../..") diff --git a/pyren3/mod_utils.py b/pyren3/mod_utils.py index c076916..a1e7574 100755 --- a/pyren3/mod_utils.py +++ b/pyren3/mod_utils.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' This program is free software: you can redistribute it and/or modify diff --git a/pyren3/scen_ecri_calinj1.py b/pyren3/scen_ecri_calinj1.py index f784e88..2f584b9 100755 --- a/pyren3/scen_ecri_calinj1.py +++ b/pyren3/scen_ecri_calinj1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_ecri_codevin.py b/pyren3/scen_ecri_codevin.py index 349240f..6fdce3f 100755 --- a/pyren3/scen_ecri_codevin.py +++ b/pyren3/scen_ecri_codevin.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_ecri_counter2.py b/pyren3/scen_ecri_counter2.py index b21f96b..7d62f7f 100755 --- a/pyren3/scen_ecri_counter2.py +++ b/pyren3/scen_ecri_counter2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_ecri_fap5.py b/pyren3/scen_ecri_fap5.py index 06303e0..f8a0052 100755 --- a/pyren3/scen_ecri_fap5.py +++ b/pyren3/scen_ecri_fap5.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_ecri_generique2.py b/pyren3/scen_ecri_generique2.py index 819d845..f6d5ff5 100755 --- a/pyren3/scen_ecri_generique2.py +++ b/pyren3/scen_ecri_generique2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Version: 180402 diff --git a/pyren3/scen_ecri_initpente.py b/pyren3/scen_ecri_initpente.py index a085d65..6f28f48 100755 --- a/pyren3/scen_ecri_initpente.py +++ b/pyren3/scen_ecri_initpente.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import os import sys @@ -14,75 +14,74 @@ from mod_utils import pyren_encode from mod_utils import KBHit import xml.dom.minidom -def run( elm, ecu, command, data ): - clearScreen() - header = '['+command.codeMR+'] '+command.label - - ScmSet = {} - ScmParam = {} +def run(elm, ecu, command, data): + clearScreen() + header = '[' + command.codeMR + '] ' + command.label - def get_message( msg ): - if msg in list(ScmParam.keys()): - value = ScmParam[msg] - else: - value = msg - if value.isdigit() and value in list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[value] ) - return value + ScmSet = {} + ScmParam = {} - def get_message_by_id( id ): - if id.isdigit() and id in list(mod_globals.language_dict.keys()): - value = pyren_encode( mod_globals.language_dict[id] ) - return value + def get_message(msg): + if msg in list(ScmParam.keys()): + value = ScmParam[msg] + else: + value = msg + if value.isdigit() and value in list(mod_globals.language_dict.keys()): + value = pyren_encode(mod_globals.language_dict[value]) + return value + def get_message_by_id(id): + if id.isdigit() and id in list(mod_globals.language_dict.keys()): + value = pyren_encode(mod_globals.language_dict[id]) + return value - DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data)) - ScmRoom = DOMTree.documentElement - - ScmParams = ScmRoom.getElementsByTagName("ScmParam") - - for Param in ScmParams: - name = pyren_encode( Param.getAttribute("name") ) - value = pyren_encode( Param.getAttribute("value") ) - - ScmParam[name] = value - - kb = KBHit() - - mainText = get_message('TexteTitre') - important = get_message('TexteConsigne') - tilt = get_message('TexteValeurInclinaison') - degreeSymbol = get_message('TexteDegre') - value2, datastr2 = ecu.get_pr(ScmParam['ParametreInclinaison']) + DOMTree = xml.dom.minidom.parse(mod_db_manager.get_file_from_clip(data)) + ScmRoom = DOMTree.documentElement - clearScreen() - print(pyren_encode(header)) - print(mainText) - print('*'*80) - print() - print(important) - print() + ScmParams = ScmRoom.getElementsByTagName("ScmParam") - ch = input('Do you want to continue? ') - while (ch.upper() != 'YES') and (ch.upper()!= 'NO'): - ch = input('Do you want to continue? ') - if ch.upper() != 'YES': - return - - clearScreen() - cmd = ecu.get_ref_cmd(get_message('Commande1')) - resVal = ScmParam['ParametreCommande1'] - print('*'*80) - responce = ecu.run_cmd(ScmParam['Commande1'], resVal) - print('*'*80) - if 'NR' in responce: - print(get_message('TexteProcedureInterompue')) - else: - print(get_message('TexteInitialisationEffectuee')) - print() - print(tilt, pyren_encode(':'), value2, degreeSymbol) - print() + for Param in ScmParams: + name = pyren_encode(Param.getAttribute("name")) + value = pyren_encode(Param.getAttribute("value")) - ch = input('Press ENTER to exit') - return + ScmParam[name] = value + + kb = KBHit() + + mainText = get_message('TexteTitre') + important = get_message('TexteConsigne') + tilt = get_message('TexteValeurInclinaison') + degreeSymbol = get_message('TexteDegre') + value2, datastr2 = ecu.get_pr(ScmParam['ParametreInclinaison']) + + clearScreen() + print(pyren_encode(header)) + print(mainText) + print('*' * 80) + print() + print(important) + print() + + ch = input('Do you want to continue? ') + while (ch.upper() != 'YES') and (ch.upper() != 'NO'): + ch = input('Do you want to continue? ') + if ch.upper() != 'YES': + return + + clearScreen() + cmd = ecu.get_ref_cmd(get_message('Commande1')) + resVal = ScmParam['ParametreCommande1'] + print('*' * 80) + responce = ecu.run_cmd(ScmParam['Commande1'], resVal) + print('*' * 80) + if 'NR' in responce: + print(get_message('TexteProcedureInterompue')) + else: + print(get_message('TexteInitialisationEffectuee')) + print() + print(tilt, pyren_encode(':'), value2, degreeSymbol) + print() + + ch = input('Press ENTER to exit') + return diff --git a/pyren3/scen_ecri_paraminj1.py b/pyren3/scen_ecri_paraminj1.py index 78c936b..f0c8cff 100755 --- a/pyren3/scen_ecri_paraminj1.py +++ b/pyren3/scen_ecri_paraminj1.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_ecri_paraminj2.py b/pyren3/scen_ecri_paraminj2.py index defa3c7..32602a2 100755 --- a/pyren3/scen_ecri_paraminj2.py +++ b/pyren3/scen_ecri_paraminj2.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_ecri_paraminj4.py b/pyren3/scen_ecri_paraminj4.py index 606e89c..87ab32c 100755 --- a/pyren3/scen_ecri_paraminj4.py +++ b/pyren3/scen_ecri_paraminj4.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_lect_sondeO21.py b/pyren3/scen_lect_sondeO21.py index 098761a..592fd96 100755 --- a/pyren3/scen_lect_sondeO21.py +++ b/pyren3/scen_lect_sondeO21.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example diff --git a/pyren3/scen_lect_ssppx91.py b/pyren3/scen_lect_ssppx91.py index fc9764a..3830416 100755 --- a/pyren3/scen_lect_ssppx91.py +++ b/pyren3/scen_lect_ssppx91.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 ''' Scenarium usage example