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
1 changed files with 31 additions and 26 deletions

View File

@ -371,25 +371,15 @@ 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:
# Recreating the url file
lastUpdate = currentDate
try:
os.mkdir(globs.CNIRFolder + '\\config')
except:
pass
with open(globs.CNIRLastUpdate, 'w') as (configFile):
try:
# Writing it
configFile.write("{}/{}/{}".format(currentDate.day, currentDate.month, currentDate.year))
except Exception as e:
critical.crashCNIR()
raise IOError(str(e))
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
@ -399,7 +389,7 @@ def umain():
# EXECUTING THE UPDATE BATCH
success = batch(credentials)
except Exception as e:
critical.crashCNIR()
critical.crashCNIR(False)
launcherWindow.printmsg('ERROR : ' + str(e))
time.sleep(3)
launcherWindow.exit()
@ -408,20 +398,36 @@ def umain():
if success:
logfile.printdbg("Software is up-to-date !")
launcherWindow.printmsg('Software is up-to-date !')
# Recreating the url file
lastUpdate = currentDate
try:
os.mkdir(globs.CNIRFolder + '\\config')
except:
pass
with open(globs.CNIRLastUpdate, 'w') as (configFile):
try:
# Writing it
configFile.write("{}/{}/{}".format(currentDate.day, currentDate.month, currentDate.year))
except Exception as e:
critical.crashCNIR(False)
time.sleep(3)
launcherWindow.exit()
return
if UPDATE_IS_MADE:
launcherWindow.exit()
return 0
else:
logfile.printerr("An error occured. No effective update !")
launcherWindow.printmsg(lang.all[globs.CNIRlang]['An error occured. No effective update !'])
time.sleep(2)
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)