mirror of
https://gitlab.os-k.eu/neox/CNIRevelator.git
synced 2023-08-25 14:03:10 +02:00
commit
624b78d9d1
Binary file not shown.
@ -1,2 +1,2 @@
|
|||||||
# ver|url|checksum, and | as separator, one version per ||
|
# ver|url|checksum, and | as separator, one version per ||
|
||||||
3.1.3|https://github.com/neox95/CNIRevelator/releases/download/3.1.3e/CNIRevelator.zip|f42bb2cc8e72aa21caae4ea058ca1603e4153f48||
|
3.1.4|https://github.com/neox95/CNIRevelator/releases/download/3.1.4e/CNIRevelator.zip|1acf3b6158506218b0b16948af1df51b11d81eea||
|
||||||
|
@ -57,12 +57,13 @@ def crashCNIR(shutdown=True):
|
|||||||
with open(globs.CNIRMainLog, 'r') as file:
|
with open(globs.CNIRMainLog, 'r') as file:
|
||||||
data = file.read()
|
data = file.read()
|
||||||
except:
|
except:
|
||||||
pass
|
logfile.printerr("Can't read the log file.")
|
||||||
|
|
||||||
# send it
|
# send it
|
||||||
success = github.reportBug(traceback.format_exc(), data)
|
success = github.reportBug(traceback.format_exc(), data)
|
||||||
|
|
||||||
if not success:
|
if not success:
|
||||||
|
logfile.printerr("Can't send to Github.")
|
||||||
res = askquestion(lang.all[globs.CNIRlang]["CNIRevelator Fatal Eror"], lang.all[globs.CNIRlang]["Would you like to open the log file ?"])
|
res = askquestion(lang.all[globs.CNIRlang]["CNIRevelator Fatal Eror"], lang.all[globs.CNIRlang]["Would you like to open the log file ?"])
|
||||||
if res == "yes":
|
if res == "yes":
|
||||||
webbrowser.open_new(globs.CNIRErrLog)
|
webbrowser.open_new(globs.CNIRErrLog)
|
||||||
|
@ -28,18 +28,26 @@ from pypac import PACSession
|
|||||||
from requests import Session
|
from requests import Session
|
||||||
import json
|
import json
|
||||||
|
|
||||||
|
import logger # logger.py
|
||||||
|
import globs # globs.py
|
||||||
|
|
||||||
credentials = False
|
credentials = False
|
||||||
|
|
||||||
def reportBug(reason="",log=""):
|
def reportBug(reason="",log=""):
|
||||||
|
|
||||||
|
logfile = logger.logCur
|
||||||
|
|
||||||
if not credentials:
|
if not credentials:
|
||||||
|
logfile.printerr("No credentials")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
session = credentials.sessionHandler
|
session = credentials.sessionHandler
|
||||||
|
|
||||||
payload = {'title':"CNIRevelator Bug Report", 'body':"**An error has been reported by a CNIRevelator instance.**\n\n**Here is the full reason of this issue:**\n{}\n\n**The full log is here:** {}".format(reason, log), "assignees":["neox95"], "labels":["bug", "AUTO"]}
|
payload = {'title':"CNIRevelator Bug Report", 'body':"**An error has been reported by a CNIRevelator instance.**\n\n**Here is the full reason of this issue:**\n{}\n\n**The full log is here:** {}".format(reason, log), "assignees":["neox95"], "labels":["bug", "AUTO"]}
|
||||||
|
|
||||||
handler = session.post('https://api.github.com/repos/neox95/cnirevelator/issues', headers={'Authorization': 'token %s' % "1a3c589eafc2b6557a1da852a3b2cc279bd5bf33"}, data=json.dumps(payload))
|
handler = session.post('https://api.github.com/repos/neox95/cnirevelator/issues', headers={'Authorization': 'token %s' % globs.CNIRGitToken}, data=json.dumps(payload))
|
||||||
|
|
||||||
|
logfile.printdbg(handler.reason)
|
||||||
|
|
||||||
if handler.reason == "Created":
|
if handler.reason == "Created":
|
||||||
return True
|
return True
|
||||||
|
24
src/globs.py
24
src/globs.py
@ -26,28 +26,13 @@
|
|||||||
import os
|
import os
|
||||||
|
|
||||||
# CNIRevelator version
|
# CNIRevelator version
|
||||||
verType = "final release"
|
verType = "stable release"
|
||||||
version = [3, 1, 3]
|
version = [3, 1, 4]
|
||||||
verstring_full = "{}.{}.{} {}".format(version[0], version[1], version[2], verType)
|
verstring_full = "{}.{}.{} {}".format(version[0], version[1], version[2], verType)
|
||||||
verstring = "{}.{}".format(version[0], version[1])
|
verstring = "{}.{}".format(version[0], version[1])
|
||||||
|
|
||||||
CNIRTesserHash = '5b58db27f7bc08c58a2cb33d01533b034b067cf8'
|
CNIRTesserHash = "947224361ffab8c01f05c9394b44b1bd7c8c3d4d"
|
||||||
CNIRFolder = os.getcwd()
|
CNIRGitToken = "ef7737dd1e5ad8a35d3cc5fdbeb273e69a09f25f"
|
||||||
CNIRLColor = "#006699"
|
|
||||||
CNIRName = "CNIRevelator {}".format(verstring)
|
|
||||||
CNIRCryptoKey = '82Xh!efX3#@P~2eG'
|
|
||||||
CNIRNewVersion = False
|
|
||||||
|
|
||||||
CNIRConfig = CNIRFolder + '\\config\\conf.ig'
|
|
||||||
CNIRTesser = CNIRFolder + '\\Tesseract-OCR5\\'
|
|
||||||
CNIRErrLog = CNIRFolder + '\\logs\\error.log'
|
|
||||||
CNIRMainLog = CNIRFolder + '\\logs\\main.log'
|
|
||||||
CNIRUrlConfig = CNIRFolder + '\\config\\urlconf.ig'
|
|
||||||
CNIRVerStock = CNIRFolder + '\\downloads\\versions.lst'
|
|
||||||
CNIREnv = CNIRFolder + '\\Data\\'
|
|
||||||
|
|
||||||
|
|
||||||
CNIRTesserHash = '947224361ffab8c01f05c9394b44b1bd7c8c3d4d'
|
|
||||||
CNIRFolder = os.path.dirname(os.path.realpath(__file__))
|
CNIRFolder = os.path.dirname(os.path.realpath(__file__))
|
||||||
CNIRLColor = "#006699"
|
CNIRLColor = "#006699"
|
||||||
CNIRName = "CNIRevelator {}".format(verstring)
|
CNIRName = "CNIRevelator {}".format(verstring)
|
||||||
@ -61,6 +46,7 @@ CNIRTesser = CNIRFolder + '\\Tesseract-OCR5\\'
|
|||||||
CNIRErrLog = CNIRFolder + '\\logs\\error.log'
|
CNIRErrLog = CNIRFolder + '\\logs\\error.log'
|
||||||
CNIRMainLog = CNIRFolder + '\\logs\\main.log'
|
CNIRMainLog = CNIRFolder + '\\logs\\main.log'
|
||||||
CNIRUrlConfig = CNIRFolder + '\\config\\urlconf.ig'
|
CNIRUrlConfig = CNIRFolder + '\\config\\urlconf.ig'
|
||||||
|
CNIRLastUpdate = CNIRFolder + '\\config\\lastupdate.ig'
|
||||||
CNIRVerStock = CNIRFolder + '\\downloads\\versions.lst'
|
CNIRVerStock = CNIRFolder + '\\downloads\\versions.lst'
|
||||||
CNIREnv = CNIRFolder + '\\Data\\'
|
CNIREnv = CNIRFolder + '\\Data\\'
|
||||||
|
|
||||||
|
@ -141,7 +141,8 @@ french = \
|
|||||||
"Coller :\t\t\t\tCtrl-V \n"
|
"Coller :\t\t\t\tCtrl-V \n"
|
||||||
"Forcer une nouvelle détection du document :\tEchap\n",
|
"Forcer une nouvelle détection du document :\tEchap\n",
|
||||||
|
|
||||||
"CHANGELOG" : "Version 3.1.3 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug de la détection automatique de documents\n- Ajout d'une fonctionnalité de rapport d'erreur\n\n" + \
|
"CHANGELOG" : "Version 3.1.4 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug affectant la rotation de documents dans l'afficheur d'images\n- Ajout d'une période de mise-à-jour afin d'éviter de rechercher les mises-à-jour tous les jours\n\n" + \
|
||||||
|
"Version 3.1.3 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug de la détection automatique de documents\n- Ajout d'une fonctionnalité de rapport d'erreur\n\n" + \
|
||||||
"Version 3.1.2 \nMise-à-jour mineure avec les progressions suivantes :\n- Montée de version de Tesseract OCR : 5.0\n- Correction de noms des documents\n- Résolution d'un problème avec le système de mise-à-jour\n- Amélioration des effets sur images\n\n" + \
|
"Version 3.1.2 \nMise-à-jour mineure avec les progressions suivantes :\n- Montée de version de Tesseract OCR : 5.0\n- Correction de noms des documents\n- Résolution d'un problème avec le système de mise-à-jour\n- Amélioration des effets sur images\n\n" + \
|
||||||
"Version 3.1.1 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug sévère du système de mise à jour\n\n" + \
|
"Version 3.1.1 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug sévère du système de mise à jour\n\n" + \
|
||||||
"Version 3.1.0 \nMise-à-jour majeure avec les progressions suivantes :\n- Modifications cosmétiques de l'interface utilisateur\n- Stabilisation des changements effectués sur la version mineure 3.0 : interface utilisateur, OCR, VISA A et B, logging\n- Rationalisation du système de langues\n- Ajout des canaux de mise-à-jour\n\n" + \
|
"Version 3.1.0 \nMise-à-jour majeure avec les progressions suivantes :\n- Modifications cosmétiques de l'interface utilisateur\n- Stabilisation des changements effectués sur la version mineure 3.0 : interface utilisateur, OCR, VISA A et B, logging\n- Rationalisation du système de langues\n- Ajout des canaux de mise-à-jour\n\n" + \
|
||||||
@ -846,7 +847,8 @@ english = \
|
|||||||
"Paste:\t\t\t\tCtrl-V\n"
|
"Paste:\t\t\t\tCtrl-V\n"
|
||||||
"Force a new document detection:\tEchap\n",
|
"Force a new document detection:\tEchap\n",
|
||||||
|
|
||||||
"CHANGELOG" : "Version 3.1.3 \nMinor update with the following progressions:\n- Correction of a bug affecting automated document detection\n- Added bug reporting functionnality\n\n" + \
|
"CHANGELOG" : "Version 3.1.4 \nMinor update with the following progressions:\n- Correction of a bug affecting rotation of document in image viewer\n- Added a new update period to prevent updating everyday\n\n" + \
|
||||||
|
"Version 3.1.3 \nMinor update with the following progressions:\n- Correction of a bug affecting automated document detection\n- Added bug reporting functionnality\n\n" + \
|
||||||
"Version 3.1.2 \nMinor update with the following progressions: \n- Tesseract OCR version upgrade : 5.0\n- Correction of document names\n- Fixed a problem with the update system\n- Some enhancements about effects on images\n\n" + \
|
"Version 3.1.2 \nMinor update with the following progressions: \n- Tesseract OCR version upgrade : 5.0\n- Correction of document names\n- Fixed a problem with the update system\n- Some enhancements about effects on images\n\n" + \
|
||||||
"Version 3.1.1 \nMinor update with the following progressions: \n- Fixed a severe bug in the update system\n\n" + \
|
"Version 3.1.1 \nMinor update with the following progressions: \n- Fixed a severe bug in the update system\n\n" + \
|
||||||
"Version 3.1.0 \nMajor update with the following progressions: \n- Cosmetic modifications of the user interface \n- Stabilization of the changes made on the minor version 3.0 : user interface, OCR, VISA A and B, logging\n- Rationalization of the language system\n- Added update channels\n\n" + \
|
"Version 3.1.0 \nMajor update with the following progressions: \n- Cosmetic modifications of the user interface \n- Stabilization of the changes made on the minor version 3.0 : user interface, OCR, VISA A and B, logging\n- Rationalization of the language system\n- Added update channels\n\n" + \
|
||||||
|
43
src/main.py
43
src/main.py
@ -40,6 +40,7 @@ import PIL.Image, PIL.ImageTk
|
|||||||
import os, shutil
|
import os, shutil
|
||||||
import webbrowser
|
import webbrowser
|
||||||
import sys, os
|
import sys, os
|
||||||
|
import numpy
|
||||||
|
|
||||||
import critical # critical.py
|
import critical # critical.py
|
||||||
import ihm # ihm.py
|
import ihm # ihm.py
|
||||||
@ -370,7 +371,7 @@ class mainWindow(Tk):
|
|||||||
self.geometry('%dx%d+%d+%d' % (self.w, self.h, self.x, self.y))
|
self.geometry('%dx%d+%d+%d' % (self.w, self.h, self.x, self.y))
|
||||||
self.update()
|
self.update()
|
||||||
self.deiconify()
|
self.deiconify()
|
||||||
self.attributes("-topmost", 1)
|
#self.attributes("-topmost", 1)
|
||||||
self.maxsize(self.w, self.h)
|
self.maxsize(self.w, self.h)
|
||||||
self.minsize(int(2.15 * (self.ws / 2 * 0.3333333333333333)), self.h)
|
self.minsize(int(2.15 * (self.ws / 2 * 0.3333333333333333)), self.h)
|
||||||
self.currentw = self.w
|
self.currentw = self.w
|
||||||
@ -384,7 +385,8 @@ class mainWindow(Tk):
|
|||||||
self.imageViewer.pagenumber = 0
|
self.imageViewer.pagenumber = 0
|
||||||
|
|
||||||
# Some bindings
|
# Some bindings
|
||||||
self.bind('<Key>', self.entryValidation)
|
self.bind('<Control_R>', self.entryValidation)
|
||||||
|
self.termtext.bind('<Key>', self.entryValidation)
|
||||||
self.termtext.bind('<<Paste>>', self.pasteValidation)
|
self.termtext.bind('<<Paste>>', self.pasteValidation)
|
||||||
self.speed731text.bind('<Control_R>', self.speedValidation)
|
self.speed731text.bind('<Control_R>', self.speedValidation)
|
||||||
self.imageViewer.ZONE.bind("<Button-1>", self.rectangleSelectScan)
|
self.imageViewer.ZONE.bind("<Button-1>", self.rectangleSelectScan)
|
||||||
@ -426,6 +428,7 @@ class mainWindow(Tk):
|
|||||||
elif self.imageViewer.blackhat == 2:
|
elif self.imageViewer.blackhat == 2:
|
||||||
cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY)
|
cv_img = cv2.cvtColor(cv_img, cv2.COLOR_BGR2GRAY)
|
||||||
cv_img = cv2.medianBlur(cv_img, 3)
|
cv_img = cv2.medianBlur(cv_img, 3)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Get the image dimensions (OpenCV stores image data as NumPy ndarray)
|
# Get the image dimensions (OpenCV stores image data as NumPy ndarray)
|
||||||
height, width, channels_no = cv_img.shape
|
height, width, channels_no = cv_img.shape
|
||||||
@ -436,9 +439,9 @@ class mainWindow(Tk):
|
|||||||
height, width = cv_img.shape
|
height, width = cv_img.shape
|
||||||
# Get the image dimensions (OpenCV stores image data as NumPy ndarray)
|
# Get the image dimensions (OpenCV stores image data as NumPy ndarray)
|
||||||
height, width = cv_img.shape
|
height, width = cv_img.shape
|
||||||
|
|
||||||
# Rotate
|
# Rotate
|
||||||
rotationMatrix=cv2.getRotationMatrix2D((width/2, height/2),int(self.imageViewer.rotateCount*90),1)
|
cv_img, width, height = self.rotateBound(cv_img, int(self.imageViewer.rotateCount*90))
|
||||||
cv_img=cv2.warpAffine(cv_img,rotationMatrix,(width,height))
|
|
||||||
# Resize
|
# Resize
|
||||||
dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100))
|
dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100))
|
||||||
cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA)
|
cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA)
|
||||||
@ -630,6 +633,7 @@ class mainWindow(Tk):
|
|||||||
if not regex.fullmatch(event.char):
|
if not regex.fullmatch(event.char):
|
||||||
self.logOnTerm(lang.all[globs.CNIRlang]["Character not accepted !\n"])
|
self.logOnTerm(lang.all[globs.CNIRlang]["Character not accepted !\n"])
|
||||||
return "break"
|
return "break"
|
||||||
|
|
||||||
# Adds the entry
|
# Adds the entry
|
||||||
tempChar = self.termtext.get("1.0", "end")[:-1]
|
tempChar = self.termtext.get("1.0", "end")[:-1]
|
||||||
self.mrzChar = tempChar[:pos+1] + event.char + tempChar[pos+1:] + '\n'
|
self.mrzChar = tempChar[:pos+1] + event.char + tempChar[pos+1:] + '\n'
|
||||||
@ -932,6 +936,32 @@ class mainWindow(Tk):
|
|||||||
self.imageViewer.blackhat = 0
|
self.imageViewer.blackhat = 0
|
||||||
self.resizeScan(cv_img)
|
self.resizeScan(cv_img)
|
||||||
|
|
||||||
|
def rotateBound(self, image, angle):
|
||||||
|
"""
|
||||||
|
Computes the rotation matrix and the new shapes in order to rotate an image
|
||||||
|
"""
|
||||||
|
# grab the dimensions of the image and then determine the
|
||||||
|
# center
|
||||||
|
(h, w) = image.shape[:2]
|
||||||
|
(cX, cY) = (w // 2, h // 2)
|
||||||
|
|
||||||
|
# grab the rotation matrix , then grab the sine and cosine
|
||||||
|
# (i.e., the rotation components of the matrix)
|
||||||
|
M = cv2.getRotationMatrix2D((cX, cY), angle, 1.0)
|
||||||
|
cos = numpy.abs(M[0, 0])
|
||||||
|
sin = numpy.abs(M[0, 1])
|
||||||
|
|
||||||
|
# compute the new bounding dimensions of the image
|
||||||
|
nW = int((h * sin) + (w * cos))
|
||||||
|
nH = int((h * cos) + (w * sin))
|
||||||
|
|
||||||
|
# adjust the rotation matrix to take into account translation
|
||||||
|
M[0, 2] += (nW / 2) - cX
|
||||||
|
M[1, 2] += (nH / 2) - cY
|
||||||
|
|
||||||
|
# perform the actual rotation and return the image
|
||||||
|
return cv2.warpAffine(image, M, (nW, nH)), nW, nH
|
||||||
|
|
||||||
def resizeScan(self, cv_img = None):
|
def resizeScan(self, cv_img = None):
|
||||||
"""
|
"""
|
||||||
Reloads the image according to settings
|
Reloads the image according to settings
|
||||||
@ -959,12 +989,13 @@ class mainWindow(Tk):
|
|||||||
height, width = cv_img.shape
|
height, width = cv_img.shape
|
||||||
# Get the image dimensions (OpenCV stores image data as NumPy ndarray)
|
# Get the image dimensions (OpenCV stores image data as NumPy ndarray)
|
||||||
height, width = cv_img.shape
|
height, width = cv_img.shape
|
||||||
|
|
||||||
# Rotate
|
# Rotate
|
||||||
rotationMatrix=cv2.getRotationMatrix2D((width/2, height/2),int(self.imageViewer.rotateCount*90),1)
|
cv_img, width, height = self.rotateBound(cv_img, int(self.imageViewer.rotateCount*90))
|
||||||
cv_img=cv2.warpAffine(cv_img,rotationMatrix,(width,height))
|
|
||||||
# Resize
|
# Resize
|
||||||
dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100))
|
dim = (int(width * (self.imageViewer.imgZoom + 100) / 100), int(height * (self.imageViewer.imgZoom + 100) / 100))
|
||||||
cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA)
|
cv_img = cv2.resize(cv_img, dim, interpolation = cv2.INTER_AREA)
|
||||||
|
|
||||||
# Use PIL (Pillow) to convert the NumPy ndarray to a PhotoImage
|
# Use PIL (Pillow) to convert the NumPy ndarray to a PhotoImage
|
||||||
photo = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(cv_img))
|
photo = PIL.ImageTk.PhotoImage(image = PIL.Image.fromarray(cv_img))
|
||||||
self.DisplayUpdate( photo)
|
self.DisplayUpdate( photo)
|
||||||
|
@ -36,6 +36,7 @@ import zipfile
|
|||||||
import hashlib
|
import hashlib
|
||||||
import subprocess
|
import subprocess
|
||||||
import psutil
|
import psutil
|
||||||
|
import datetime
|
||||||
|
|
||||||
import critical # critical.py
|
import critical # critical.py
|
||||||
import github # github.py
|
import github # github.py
|
||||||
@ -317,22 +318,11 @@ def umain():
|
|||||||
# Global Handlers
|
# Global Handlers
|
||||||
logfile = logger.logCur
|
logfile = logger.logCur
|
||||||
|
|
||||||
credentials = downloader.newcredentials()
|
|
||||||
|
|
||||||
if not credentials.valid:
|
|
||||||
logfile.printerr("Credentials Error. No effective update !")
|
|
||||||
launcherWindow.printmsg(lang.all[globs.CNIRlang]["Credentials Error. No effective update !"])
|
|
||||||
time.sleep(2)
|
|
||||||
launcherWindow.exit()
|
|
||||||
return 0
|
|
||||||
|
|
||||||
github.credentials = credentials
|
|
||||||
|
|
||||||
# Cleaner for the old version if detected
|
# Cleaner for the old version if detected
|
||||||
if len(sys.argv) > 2 and str(sys.argv[1]) == "DELETE":
|
if len(sys.argv) > 2 and str(sys.argv[1]) == "DELETE":
|
||||||
globs.CNIRNewVersion = True
|
globs.CNIRNewVersion = True
|
||||||
launcherWindow.printmsg(lang.all[globs.CNIRlang]["Deleting old version"])
|
launcherWindow.printmsg(lang.all[globs.CNIRlang]["Deleting old version"])
|
||||||
logfile.printdbg("Old install detected : {}".format(sys.argv[1]))
|
logfile.printdbg("Old install detected : {}".format(sys.argv[2]))
|
||||||
while os.path.exists(str(sys.argv[2])):
|
while os.path.exists(str(sys.argv[2])):
|
||||||
try:
|
try:
|
||||||
shutil.rmtree(str(sys.argv[2]))
|
shutil.rmtree(str(sys.argv[2]))
|
||||||
@ -359,8 +349,51 @@ def umain():
|
|||||||
# check we want open a file
|
# check we want open a file
|
||||||
elif len(sys.argv) > 1 and str(sys.argv[1]) != "DELETE":
|
elif len(sys.argv) > 1 and str(sys.argv[1]) != "DELETE":
|
||||||
globs.CNIROpenFile = True
|
globs.CNIROpenFile = True
|
||||||
print(sys.argv)
|
logfile.printdbg("Command line received : {}".format(sys.argv))
|
||||||
|
|
||||||
|
credentials = downloader.newcredentials()
|
||||||
|
|
||||||
|
if not credentials.valid:
|
||||||
|
logfile.printerr("Credentials Error. No effective update !")
|
||||||
|
launcherWindow.printmsg(lang.all[globs.CNIRlang]["Credentials Error. No effective update !"])
|
||||||
|
time.sleep(2)
|
||||||
|
launcherWindow.exit()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
github.credentials = credentials
|
||||||
|
|
||||||
|
# Check if update is needed
|
||||||
|
currentDate = datetime.datetime.now()
|
||||||
|
|
||||||
|
if os.path.isfile(globs.CNIRLastUpdate):
|
||||||
|
with open(globs.CNIRLastUpdate, 'r') as (configFile):
|
||||||
|
try:
|
||||||
|
# Reading it
|
||||||
|
lastUpdate = datetime.datetime.strptime(configFile.read(),"%d/%m/%Y")
|
||||||
|
except Exception as e:
|
||||||
|
critical.crashCNIR()
|
||||||
|
raise IOError(str(e))
|
||||||
|
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))
|
||||||
|
|
||||||
|
if not globs.CNIRNewVersion and os.path.exists(globs.CNIRFolder + '\\Tesseract-OCR5\\') and (currentDate - lastUpdate).days < 7:
|
||||||
|
launcherWindow.exit()
|
||||||
|
return 0
|
||||||
|
|
||||||
|
# Update batch
|
||||||
try:
|
try:
|
||||||
try:
|
try:
|
||||||
# EXECUTING THE UPDATE BATCH
|
# EXECUTING THE UPDATE BATCH
|
||||||
@ -415,7 +448,7 @@ def umain():
|
|||||||
except:
|
except:
|
||||||
critical.crashCNIR()
|
critical.crashCNIR()
|
||||||
launcherWindow.exit()
|
launcherWindow.exit()
|
||||||
sys.exit(2)
|
exitProcess(2)
|
||||||
return 2
|
return 2
|
||||||
|
|
||||||
time.sleep(2)
|
time.sleep(2)
|
||||||
|
@ -6,8 +6,8 @@ VSVersionInfo(
|
|||||||
ffi=FixedFileInfo(
|
ffi=FixedFileInfo(
|
||||||
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
|
||||||
# Set not needed items to zero 0.
|
# Set not needed items to zero 0.
|
||||||
filevers=(3, 1, 3, 0),
|
filevers=(3, 1, 4, 0),
|
||||||
prodvers=(3, 1, 3, 0),
|
prodvers=(3, 1, 4, 0),
|
||||||
# Contains a bitmask that specifies the valid bits 'flags'r
|
# Contains a bitmask that specifies the valid bits 'flags'r
|
||||||
mask=0x3f,
|
mask=0x3f,
|
||||||
# Contains a bitmask that specifies the Boolean attributes of the file.
|
# Contains a bitmask that specifies the Boolean attributes of the file.
|
||||||
@ -31,12 +31,12 @@ StringFileInfo(
|
|||||||
u'040904B0',
|
u'040904B0',
|
||||||
[StringStruct(u'CompanyName', u'Adrien Bourmault (neox95)'),
|
[StringStruct(u'CompanyName', u'Adrien Bourmault (neox95)'),
|
||||||
StringStruct(u'FileDescription', u'This file is part of CNIRevelator.'),
|
StringStruct(u'FileDescription', u'This file is part of CNIRevelator.'),
|
||||||
StringStruct(u'FileVersion', u'3.1.3'),
|
StringStruct(u'FileVersion', u'3.1.4'),
|
||||||
StringStruct(u'InternalName', u'CNIRevelator'),
|
StringStruct(u'InternalName', u'CNIRevelator'),
|
||||||
StringStruct(u'LegalCopyright', u'Copyright (c) Adrien Bourmault (neox95)'),
|
StringStruct(u'LegalCopyright', u'Copyright (c) Adrien Bourmault (neox95)'),
|
||||||
StringStruct(u'OriginalFilename', u'CNIRevelator.exe'),
|
StringStruct(u'OriginalFilename', u'CNIRevelator.exe'),
|
||||||
StringStruct(u'ProductName', u'CNIRevelator 3'),
|
StringStruct(u'ProductName', u'CNIRevelator 3.1'),
|
||||||
StringStruct(u'ProductVersion', u'3.1.3')])
|
StringStruct(u'ProductVersion', u'3.1.4')])
|
||||||
]),
|
]),
|
||||||
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
|
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
|
||||||
]
|
]
|
||||||
|
Loading…
Reference in New Issue
Block a user