add basic vars info

This commit is contained in:
--=FurtiF™=-- 2022-08-21 18:16:48 +02:00
parent 7be0248dcc
commit e80c9bda6e

View File

@ -6,12 +6,20 @@
################################## ##################################
# # # #
# # # #
# Version: 3.0 (1-Aug-2022) # # Version: 3.0 (1-Aug-2022) #
# Author: Shr-Lnm # # 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 os
import shutil import shutil
@ -33,9 +41,8 @@ currenPath = os.path.dirname(os.path.abspath(__file__))
for f in listdir('.'): for f in listdir('.'):
if isdir('./' + f) and f.lower().startswith('pyren3') and isdir('./' + f + '/serial'): 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))
sys.path.append(os.path.join(currenPath,f,"serial")) sys.path.append(os.path.join(currenPath, f, "serial"))
if osname == 'nt': if osname == 'nt':
import pip import pip
@ -81,6 +88,7 @@ if osname == 'android':
print("Error while using jnius") print("Error while using jnius")
sys.exit() sys.exit()
def update_from_gitlab(): def update_from_gitlab():
try: try:
import os 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'} 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) 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() datatowrite = filedata.read()
with open('./pyren-pyren3.zip', 'wb') as f: with open('./pyren-pyren3.zip', 'wb') as f:
@ -121,14 +129,14 @@ def update_from_gitlab():
if os.path.altsep: if os.path.altsep:
arcname = arcname.replace(os.path.altsep, os.path.sep) arcname = arcname.replace(os.path.altsep, os.path.sep)
arcname = os.path.splitdrive(arcname)[1].split(os.path.sep)[0] arcname = os.path.splitdrive(arcname)[1].split(os.path.sep)[0]
rootDirLen = len(arcname)+1 rootDirLen = len(arcname) + 1
dst = src[rootDirLen:] dst = src[rootDirLen:]
filename = os.path.basename(src) filename = os.path.basename(src)
if not filename: if not filename:
if dst and not os.path.exists(dst): if dst and not os.path.exists(dst):
os.makedirs(dst) os.makedirs(dst)
continue continue
source = zip_file.open(src) source = zip_file.open(src)
target = open(dst, "wb") target = open(dst, "wb")
with source, target: with source, target:
@ -141,6 +149,7 @@ def update_from_gitlab():
return 0 return 0
def getPathList(): def getPathList():
return ['./' + f for f in listdir('.') if isdir('./' + f) \ return ['./' + f for f in listdir('.') if isdir('./' + f) \
and f.lower().startswith('pyren') \ and f.lower().startswith('pyren') \
@ -148,10 +157,11 @@ def getPathList():
def getLangList(): def getLangList():
#if not os.path.exists('./Location'): # if not os.path.exists('./Location'):
# return [] # return []
#return [f[10:-4] for f in listdir('./Location') if f.lower().startswith('diagoncan_')] # 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 ['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(): def getPortList():
ret = [] ret = []
@ -263,7 +273,7 @@ def run(s, cmd):
sys.argv = sys.argv + s.options.split() sys.argv = sys.argv + s.options.split()
if cmd == 'term': if cmd == 'term':
sys.argv.append('--dialog') sys.argv.append('--dialog')
#sys.argv.append('--demo') # sys.argv.append('--demo')
if cmd == 'ddt': if cmd == 'ddt':
sys.argv.append('--demo') sys.argv.append('--demo')
os.chdir(s.path) os.chdir(s.path)
@ -532,7 +542,7 @@ if osname != 'android':
self.lCSV.configure(highlightbackground="#d9d9d9") self.lCSV.configure(highlightbackground="#d9d9d9")
self.lCSV.configure(highlightcolor="black") self.lCSV.configure(highlightcolor="black")
self.lCSV.configure(width=240) self.lCSV.configure(width=240)
self.lKWP = tk.LabelFrame(self.root) self.lKWP = tk.LabelFrame(self.root)
self.lKWP.place(relx=0.5, rely=0.43, relheight=0.125, relwidth=0.48) self.lKWP.place(relx=0.5, rely=0.43, relheight=0.125, relwidth=0.48)
self.lKWP.configure(relief=tk.GROOVE) self.lKWP.configure(relief=tk.GROOVE)