Add files via upload
This commit is contained in:
parent
de31c9d79c
commit
102b1d1e67
|
@ -371,25 +371,15 @@ def umain():
|
||||||
# Reading it
|
# Reading it
|
||||||
lastUpdate = datetime.datetime.strptime(configFile.read(),"%d/%m/%Y")
|
lastUpdate = datetime.datetime.strptime(configFile.read(),"%d/%m/%Y")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
critical.crashCNIR()
|
critical.crashCNIR(False)
|
||||||
raise IOError(str(e))
|
time.sleep(3)
|
||||||
|
launcherWindow.exit()
|
||||||
|
return 1
|
||||||
else:
|
else:
|
||||||
# Recreating the url file
|
lastUpdate = datetime.datetime(1970,1,1)
|
||||||
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))
|
|
||||||
|
|
||||||
if not globs.CNIRNewVersion and os.path.exists(globs.CNIRFolder + '\\Tesseract-OCR5\\') and (currentDate - lastUpdate).days < 7:
|
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()
|
launcherWindow.exit()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
@ -399,7 +389,7 @@ def umain():
|
||||||
# EXECUTING THE UPDATE BATCH
|
# EXECUTING THE UPDATE BATCH
|
||||||
success = batch(credentials)
|
success = batch(credentials)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
critical.crashCNIR()
|
critical.crashCNIR(False)
|
||||||
launcherWindow.printmsg('ERROR : ' + str(e))
|
launcherWindow.printmsg('ERROR : ' + str(e))
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
launcherWindow.exit()
|
launcherWindow.exit()
|
||||||
|
@ -408,20 +398,36 @@ def umain():
|
||||||
if success:
|
if success:
|
||||||
logfile.printdbg("Software is up-to-date !")
|
logfile.printdbg("Software is up-to-date !")
|
||||||
launcherWindow.printmsg('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:
|
else:
|
||||||
logfile.printerr("An error occured. No effective update !")
|
logfile.printerr("An error occured. No effective update !")
|
||||||
launcherWindow.printmsg(lang.all[globs.CNIRlang]['An error occured. No effective update !'])
|
launcherWindow.printmsg(lang.all[globs.CNIRlang]['An error occured. No effective update !'])
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
launcherWindow.exit()
|
launcherWindow.exit()
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
if UPDATE_IS_MADE:
|
|
||||||
launcherWindow.exit()
|
|
||||||
return 0
|
|
||||||
except:
|
except:
|
||||||
critical.crashCNIR()
|
critical.crashCNIR(False)
|
||||||
launcherWindow.exit()
|
launcherWindow.exit()
|
||||||
sys.exit(2)
|
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -429,7 +435,7 @@ def umain():
|
||||||
# INSTALLING TESSERACT OCR
|
# INSTALLING TESSERACT OCR
|
||||||
success = tessInstall(globs.CNIRFolder, credentials)
|
success = tessInstall(globs.CNIRFolder, credentials)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
critical.crashCNIR()
|
critical.crashCNIR(False)
|
||||||
launcherWindow.printmsg('ERROR : ' + str(e))
|
launcherWindow.printmsg('ERROR : ' + str(e))
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
launcherWindow.exit()
|
launcherWindow.exit()
|
||||||
|
@ -446,9 +452,8 @@ def umain():
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
except:
|
except:
|
||||||
critical.crashCNIR()
|
critical.crashCNIR(False)
|
||||||
launcherWindow.exit()
|
launcherWindow.exit()
|
||||||
exitProcess(2)
|
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
|
Loading…
Reference in New Issue