1
0
mirror of https://gitlab.os-k.eu/neox/CNIRevelator.git synced 2023-08-25 14:03:10 +02:00

Add files via upload

This commit is contained in:
Adrien Bourmault 2019-08-29 11:04:50 +02:00 committed by GitHub
parent de31c9d79c
commit 102b1d1e67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -371,9 +371,33 @@ def umain():
# Reading it
lastUpdate = datetime.datetime.strptime(configFile.read(),"%d/%m/%Y")
except Exception as e:
critical.crashCNIR()
raise IOError(str(e))
critical.crashCNIR(False)
time.sleep(3)
launcherWindow.exit()
return 1
else:
lastUpdate = datetime.datetime(1970,1,1)
if not globs.CNIRNewVersion and os.path.exists(globs.CNIRFolder + '\\Tesseract-OCR5\\') and (currentDate - lastUpdate).days < 7:
logfile.printdbg("No need to update, {} days remaining".format(7 - (currentDate - lastUpdate).days))
launcherWindow.exit()
return 0
# Update batch
try:
try:
# EXECUTING THE UPDATE BATCH
success = batch(credentials)
except Exception as e:
critical.crashCNIR(False)
launcherWindow.printmsg('ERROR : ' + str(e))
time.sleep(3)
launcherWindow.exit()
return 1
if success:
logfile.printdbg("Software is up-to-date !")
launcherWindow.printmsg('Software is up-to-date !')
# Recreating the url file
lastUpdate = currentDate
try:
@ -386,28 +410,14 @@ def umain():
# Writing it
configFile.write("{}/{}/{}".format(currentDate.day, currentDate.month, currentDate.year))
except Exception as e:
critical.crashCNIR()
raise IOError(str(e))
if not globs.CNIRNewVersion and os.path.exists(globs.CNIRFolder + '\\Tesseract-OCR5\\') and (currentDate - lastUpdate).days < 7:
critical.crashCNIR(False)
time.sleep(3)
launcherWindow.exit()
return
if UPDATE_IS_MADE:
launcherWindow.exit()
return 0
# Update batch
try:
try:
# EXECUTING THE UPDATE BATCH
success = batch(credentials)
except Exception as e:
critical.crashCNIR()
launcherWindow.printmsg('ERROR : ' + str(e))
time.sleep(3)
launcherWindow.exit()
return 1
if success:
logfile.printdbg("Software is up-to-date !")
launcherWindow.printmsg('Software is up-to-date !')
else:
logfile.printerr("An error occured. No effective update !")
launcherWindow.printmsg(lang.all[globs.CNIRlang]['An error occured. No effective update !'])
@ -415,13 +425,9 @@ def umain():
launcherWindow.exit()
return 0
if UPDATE_IS_MADE:
launcherWindow.exit()
return 0
except:
critical.crashCNIR()
critical.crashCNIR(False)
launcherWindow.exit()
sys.exit(2)
return 2
try:
@ -429,7 +435,7 @@ def umain():
# INSTALLING TESSERACT OCR
success = tessInstall(globs.CNIRFolder, credentials)
except Exception as e:
critical.crashCNIR()
critical.crashCNIR(False)
launcherWindow.printmsg('ERROR : ' + str(e))
time.sleep(3)
launcherWindow.exit()
@ -446,9 +452,8 @@ def umain():
return 0
except:
critical.crashCNIR()
critical.crashCNIR(False)
launcherWindow.exit()
exitProcess(2)
return 2
time.sleep(2)