Merge branch 'py3_others' into 'pyren3'
fix ddt settings.p to settings3.p optimise environement (venv) See merge request py_ren/pyren!24
This commit is contained in:
commit
5131ca9a41
6
.gitignore
vendored
6
.gitignore
vendored
@ -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
|
||||
|
||||
|
@ -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
|
BIN
icons/obd.png
Normal file
BIN
icons/obd.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 55 KiB |
BIN
icons/splash_pyren3.png
Normal file
BIN
icons/splash_pyren3.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
34
main.py
34
main.py
@ -6,12 +6,20 @@
|
||||
##################################
|
||||
# #
|
||||
# #
|
||||
# Version: 3.0 (1-Aug-2022) #
|
||||
# Version: 3.0 (1-Aug-2022) #
|
||||
# Author: Shr-Lnm #
|
||||
# #
|
||||
# #
|
||||
##################################
|
||||
|
||||
__author__ = "Shr-Lnm"
|
||||
__copyright__ = "Copyright 2018-2022"
|
||||
__credits__ = []
|
||||
# __license__ = "GNU" # Unknown licence!
|
||||
__version__ = "3.0.0" # python3 maybe ?
|
||||
__maintainer__ = "Shr-Lnm"
|
||||
__email__ = "mshkn@inbox.ru"
|
||||
__status__ = "Beta"
|
||||
|
||||
import os
|
||||
import shutil
|
||||
@ -33,9 +41,8 @@ currenPath = os.path.dirname(os.path.abspath(__file__))
|
||||
|
||||
for f in listdir('.'):
|
||||
if isdir('./' + f) and f.lower().startswith('pyren3') and isdir('./' + f + '/serial'):
|
||||
sys.path.append(os.path.join(currenPath,f))
|
||||
sys.path.append(os.path.join(currenPath,f,"serial"))
|
||||
|
||||
sys.path.append(os.path.join(currenPath, f))
|
||||
sys.path.append(os.path.join(currenPath, f, "serial"))
|
||||
|
||||
if osname == 'nt':
|
||||
import pip
|
||||
@ -81,6 +88,7 @@ if osname == 'android':
|
||||
print("Error while using jnius")
|
||||
sys.exit()
|
||||
|
||||
|
||||
def update_from_gitlab():
|
||||
try:
|
||||
import os
|
||||
@ -103,7 +111,7 @@ def update_from_gitlab():
|
||||
|
||||
h_user_agent = {'User-Agent': 'Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2228.0 Safari/537.3'}
|
||||
req = urllib.request.Request('https://gitlab.com/py_ren/pyren/-/archive/pyren3/pyren-pyren3.zip', headers=h_user_agent)
|
||||
filedata = urllib.request.urlopen(req, context=ctx, timeout = 10)
|
||||
filedata = urllib.request.urlopen(req, context=ctx, timeout=10)
|
||||
datatowrite = filedata.read()
|
||||
|
||||
with open('./pyren-pyren3.zip', 'wb') as f:
|
||||
@ -121,14 +129,14 @@ def update_from_gitlab():
|
||||
if os.path.altsep:
|
||||
arcname = arcname.replace(os.path.altsep, os.path.sep)
|
||||
arcname = os.path.splitdrive(arcname)[1].split(os.path.sep)[0]
|
||||
rootDirLen = len(arcname)+1
|
||||
rootDirLen = len(arcname) + 1
|
||||
dst = src[rootDirLen:]
|
||||
filename = os.path.basename(src)
|
||||
if not filename:
|
||||
if dst and not os.path.exists(dst):
|
||||
os.makedirs(dst)
|
||||
continue
|
||||
|
||||
|
||||
source = zip_file.open(src)
|
||||
target = open(dst, "wb")
|
||||
with source, target:
|
||||
@ -141,6 +149,7 @@ def update_from_gitlab():
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
def getPathList():
|
||||
return ['./' + f for f in listdir('.') if isdir('./' + f) \
|
||||
and f.lower().startswith('pyren') \
|
||||
@ -148,10 +157,11 @@ def getPathList():
|
||||
|
||||
|
||||
def getLangList():
|
||||
#if not os.path.exists('./Location'):
|
||||
# if not os.path.exists('./Location'):
|
||||
# return []
|
||||
#return [f[10:-4] for f in listdir('./Location') if f.lower().startswith('diagoncan_')]
|
||||
return ['AL','CNT','CO','CR','CZ','DK','EL','FI','FR','GB','HG','IT','JP','NG','NL','PL','PO','RO','RU','SD','SL','SP','TR']
|
||||
# return [f[10:-4] for f in listdir('./Location') if f.lower().startswith('diagoncan_')]
|
||||
return ['AL', 'CNT', 'CO', 'CR', 'CZ', 'DK', 'EL', 'FI', 'FR', 'GB', 'HG', 'IT', 'JP', 'NG', 'NL', 'PL', 'PO', 'RO', 'RU', 'SD', 'SL', 'SP', 'TR']
|
||||
|
||||
|
||||
def getPortList():
|
||||
ret = []
|
||||
@ -263,7 +273,7 @@ def run(s, cmd):
|
||||
sys.argv = sys.argv + s.options.split()
|
||||
if cmd == 'term':
|
||||
sys.argv.append('--dialog')
|
||||
#sys.argv.append('--demo')
|
||||
# sys.argv.append('--demo')
|
||||
if cmd == 'ddt':
|
||||
sys.argv.append('--demo')
|
||||
os.chdir(s.path)
|
||||
@ -532,7 +542,7 @@ if osname != 'android':
|
||||
self.lCSV.configure(highlightbackground="#d9d9d9")
|
||||
self.lCSV.configure(highlightcolor="black")
|
||||
self.lCSV.configure(width=240)
|
||||
|
||||
|
||||
self.lKWP = tk.LabelFrame(self.root)
|
||||
self.lKWP.place(relx=0.5, rely=0.43, relheight=0.125, relwidth=0.48)
|
||||
self.lKWP.configure(relief=tk.GROOVE)
|
||||
|
4
pyren.sh
4
pyren.sh
@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
#chmod +x ./venv/bin/activate
|
||||
#chmod +x ./_pyren_launcher.py
|
||||
#chmod +x ./_pyren3_launcher.py
|
||||
## Linux ubuntu fixes uncomment next lines
|
||||
#printf "Install new venv ...\n"
|
||||
#Install venv if not present
|
||||
@ -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
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys, os
|
||||
import mod_globals
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys, os
|
||||
#import serial
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys, os
|
||||
import serial
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
import os
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -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")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import sys, os
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import gc
|
||||
|
@ -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()
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from xml.dom.minidom import parse
|
||||
import xml.dom.minidom
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_utils import Choice
|
||||
from mod_utils import ChoiceFromDict
|
||||
|
@ -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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_ecu_mnemonic import *
|
||||
from mod_ecu_screen import *
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_ecu_mnemonic import *
|
||||
from mod_utils import Choice
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_ecu_service import *
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_ecu_mnemonic import *
|
||||
from mod_utils import Choice
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import os
|
||||
import re
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_utils import Choice
|
||||
from xml.dom.minidom import parse
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_utils import Choice
|
||||
from mod_utils import pyren_encode
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
from mod_ecu_mnemonic import *
|
||||
from mod_utils import Choice
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
module contains class for working with ELM327
|
||||
version: 180408
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
opt_debug = False
|
||||
debug_file = None
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import csv
|
||||
import os
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
import sys
|
||||
sys.path.insert(0,"../..")
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
|
||||
'''
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
|
||||
Version: 180402
|
||||
|
@ -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? <yes/no> ')
|
||||
while (ch.upper() != 'YES') and (ch.upper()!= 'NO'):
|
||||
ch = input('Do you want to continue? <yes/no> ')
|
||||
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? <yes/no> ')
|
||||
while (ch.upper() != 'YES') and (ch.upper() != 'NO'):
|
||||
ch = input('Do you want to continue? <yes/no> ')
|
||||
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
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
'''
|
||||
Scenarium usage example
|
||||
|
||||
|
0
i12comp.exe → tools_and_confs/i12comp.exe
Executable file → Normal file
0
i12comp.exe → tools_and_confs/i12comp.exe
Executable file → Normal file
Loading…
x
Reference in New Issue
Block a user