Minor updating system enhancements

This commit is contained in:
Adrien Bourmault 2019-07-10 10:12:54 +02:00 committed by GitHub
parent 84a74f804d
commit a6762755a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 7 deletions

View File

@ -40,7 +40,7 @@ launcherWindow = ihm.launcherWindowCur
## MAIN FUNCTION OF CNIREVELATOR
def main():
import CNI_pytesseract as pytesseract
try:
os.environ['PATH'] = CST_FOLDER + 'Tesseract-OCR4\\'
@ -52,7 +52,7 @@ def main():
text = 'Tesseract version ' + str(tesser_version) + ' Licensed Apache 2004 successfully initiated\n'
main_w.montext(text)
main_w.montext('\n\nEntrez la première ligne de MRZ svp \n')
if CST_CHANGELOG.isOn:
showinfo('Changelog : résumé de mise à jour', ('Version du logiciel : ' + CST_VER + ' ' + CST_TYPE + ' Revision ' + CST_REV + '\n\n' + CST_CHANGELOG.text), parent=main_w)
logger.info('main() : **** Launching App_main() ****')

View File

@ -131,7 +131,8 @@ def batch():
getTheUpdate = downloader.newdownload(credentials, finalurl, globs.CNIRFolder + '\\..\\CNIPackage.zip').download()
# BUF_SIZE is totally arbitrary, change for your app!
launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Verifying download...'))
BUF_SIZE = 65536 # lets read stuff in 64kb chunks!
sha1 = hashlib.sha1()
@ -151,17 +152,35 @@ def batch():
return False
# And now unzip and launch
logfile.printdbg("Make place")
launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Preparing installation...'))
try:
shutil.rmtree(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + 'temp')
shutil.rmtree(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full))
except:
pass
logfile.printdbg("Unzipping the package")
launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Installing the updates'))
zip_ref = zipfile.ZipFile(globs.CNIRFolder + '\\..\\CNIPackage.zip', 'r')
zip_ref.extractall(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full))
zip_ref.extractall(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + 'temp')
zip_ref.close()
logfile.printdbg(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + '\\CNIRevelator.exe')
shutil.copytree(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + 'temp\\CNIRevelator', globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full))
shutil.rmtree(globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + 'temp')
logfile.printdbg('Extracted :' + globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + '\\CNIRevelator.exe')
launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Success !'))
args = [globs.CNIRFolder + '\\..\\CNIRevelator' + str(globs.verstring_full) + '\\CNIRevelator.exe', globs.CNIRFolder]
subprocess.run(args)
return True
launcherWindow.mainCanvas.itemconfigure(launcherWindow.msg, text=('Launched the new process.'))
launcherWindow.destroy()
sys.exit(0)
return
## Main Function
def umain():