Enhancing UI/Infos and resolving bugs about Visas

This commit is contained in:
Adrien Bourmault 2019-08-30 15:09:33 +02:00
parent bbb2e43f61
commit 17acb12992
6 changed files with 133 additions and 15 deletions

View File

@ -71,9 +71,103 @@ def reportBug(reason="",log="", isVoluntary=False):
session = credentials.sessionHandler
if not isVoluntary:
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 App Bug Report",
'body': (
"**An error has been reported by a CNIRevelator instance.**\n\n"
"**Global informations:**\n"
"verType = {}\n"
"version= {}\n"
"verstring_full = {}\n"
"CNIRTesserHash = {}\n"
"CNIRGitToken = {}\n"
"CNIRName = {}\n"
"CNIRCryptoKey = {}\n"
"CNIRlang = {}\n"
"CNIRVerStock = {}\n"
"CNIREnv = {}\n"
"CNIRBetaURL = {}\n"
"CNIRDefaultURL = {}\n"
"CNIRNewVersion = {}\n"
"CNIROpenFile = {}\n"
"debug = {}\n"
"\n\n"
"**Full reason of the crash:**\n{}\n\n"
"**Full log:** {}"
).format(
globs.verType,
globs.version,
globs.verstring_full,
globs.CNIRTesserHash,
globs.CNIRGitToken,
globs.CNIRName,
globs.CNIRCryptoKey,
globs.CNIRlang,
globs.CNIRVerStock,
globs.CNIREnv,
globs.CNIRBetaURL,
globs.CNIRDefaultURL,
globs.CNIRNewVersion,
globs.CNIROpenFile,
globs.debug,
reason,
log
),
"assignees":["neox95"], "labels":["bug", "AUTO"]
}
else:
payload = {'title':"CNIRevelator Bug Report", 'body':"**A voluntary bug report has been reported by a CNIRevelator user.**\n\n**Possible reason:**\n{}\n\n**The full log is here:** {}".format(reason, log), "assignees":["neox95"], "labels":["bug", "AUTO"]}
payload = {
'title':"CNIRevelator User Bug Report",
'body': (
"**An error has been reported by a CNIRevelator user.**\n\n"
"**Global informations:**\n"
"verType = {}\n"
"version= {}\n"
"verstring_full = {}\n"
"CNIRTesserHash = {}\n"
"CNIRGitToken = {}\n"
"CNIRName = {}\n"
"CNIRCryptoKey = {}\n"
"CNIRlang = {}\n"
"CNIRVerStock = {}\n"
"CNIREnv = {}\n"
"CNIRBetaURL = {}\n"
"CNIRDefaultURL = {}\n"
"CNIRNewVersion = {}\n"
"CNIROpenFile = {}\n"
"debug = {}\n"
"\n\n"
"**Possible reason:**\n{}\n\n"
"**Full log:** {}"
).format(
globs.verType,
globs.version,
globs.verstring_full,
globs.CNIRTesserHash,
globs.CNIRGitToken,
globs.CNIRName,
globs.CNIRCryptoKey,
globs.CNIRlang,
globs.CNIRVerStock,
globs.CNIREnv,
globs.CNIRBetaURL,
globs.CNIRDefaultURL,
globs.CNIRNewVersion,
globs.CNIROpenFile,
globs.debug,
reason,
log
),
"assignees":["neox95"], "labels":["bug", "AUTO"]
}
handler = session.post('https://api.github.com/repos/neox95/cnirevelator/issues', headers={'Authorization': 'token %s' % decryptToken(globs.CNIRGitToken)}, data=json.dumps(payload))

View File

@ -27,7 +27,7 @@ import os
# CNIRevelator version
verType = "stable release"
version = [3, 1, 5]
version = [3, 1, 6]
verstring_full = "{}.{}.{} {}".format(version[0], version[1], version[2], verType)
verstring = "{}.{}".format(version[0], version[1])

View File

@ -72,6 +72,8 @@ french = \
"Nationality" : "Nationalité",
"Registration" : "Immatriculation",
"Document number" : "N° de document",
"Length" : "Longueur",
"Facultative" : "Facultatif",
"Unknown" : "Inconnu(e)",
"Display and processing of "
"documents" : "Affichage et traitement de documents",
@ -141,7 +143,8 @@ french = \
"Coller :\t\t\t\tCtrl-V \n"
"Forcer une nouvelle détection du document :\tEchap\n",
"CHANGELOG" : "Version 3.1.5 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug affectant le signalement de bug\n- Améliorations de l'affichage de la conformité des informations\n- Ajout d'un nouveau système de selection plus simple et fiable'\n\n" + \
"CHANGELOG" : "Version 3.1.5 \nMise-à-jour mineure avec les progressions suivantes :\n- Ajout de la longueur de la MRZ dans les informations\n- Correction d'un bug affectant les Visas\n\n" + \
"Version 3.1.5 \nMise-à-jour mineure avec les progressions suivantes :\n- Correction d'un bug affectant le signalement de bug\n- Améliorations de l'affichage de la conformité des informations\n- Ajout d'un nouveau système de selection plus simple et fiable'\n\n" + \
"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" + \
@ -780,6 +783,8 @@ english = \
"Nationality" : "Nationality",
"Registration" : "Registration",
"Document number" : "Document number",
"Length" : "Length",
"Facultative" : "Facultative",
"Unknown" : "Unknown",
"Display and processing of "
"documents" : "Display and processing of documents",
@ -853,7 +858,8 @@ english = \
"Paste:\t\t\t\tCtrl-V\n"
"Force a new document detection:\tEchap\n",
"CHANGELOG" : "Version 3.1.5 \nMinor update with the following progressions:\n- Correction of a bug affecting bug reporting\n - Enhancements on information compliance display\n- Added new selection system to be more userfriendly\n\n" + \
"CHANGELOG" : "Version 3.1.6 \nMinor update with the following progressionss :\n- Added MRZ length in the information\n- Fixed a bug affecting Visas\n\n" + \
"Version 3.1.5 \nMinor update with the following progressions:\n- Correction of a bug affecting bug reporting\n - Enhancements on information compliance display\n- Added new selection system to be more userfriendly\n\n" + \
"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" + \

View File

@ -110,6 +110,7 @@ class mainWindow(Tk):
self.lecteur_ci.grid_rowconfigure(3, weight=1)
self.lecteur_ci.grid_rowconfigure(4, weight=1)
self.lecteur_ci.grid_rowconfigure(5, weight=1)
self.lecteur_ci.grid_rowconfigure(6, weight=1)
# And what about the status bar ?
self.statusbar = ihm.StatusBar(self)
@ -150,6 +151,9 @@ class mainWindow(Tk):
ttk.Label((self.lecteur_ci), text='{} : '.format(lang.all[globs.CNIRlang]["Document number"])).grid(column=4, row=5, padx=5, pady=5)
self.no = ttk.Label((self.lecteur_ci), text=' ')
self.no.grid(column=5, row=5, padx=5, pady=5)
ttk.Label((self.lecteur_ci), text='{} : '.format(lang.all[globs.CNIRlang]["Length"])).grid(column=0, row=6, padx=5, pady=5)
self.len = ttk.Label((self.lecteur_ci), text=' ')
self.len.grid(column=1, row=6, padx=5, pady=5)
self.nom['text'] = lang.all[globs.CNIRlang]["Unknown"]
self.prenom['text'] = lang.all[globs.CNIRlang]["Unknown"]
@ -161,6 +165,7 @@ class mainWindow(Tk):
self.nat['text'] = lang.all[globs.CNIRlang]["Unknown"]
self.pays['text'] = lang.all[globs.CNIRlang]["Unknown"]
self.indic['text'] = lang.all[globs.CNIRlang]["Unknown"]
self.len['text'] = lang.all[globs.CNIRlang]["Unknown"]
self.infoList = \
@ -174,7 +179,8 @@ class mainWindow(Tk):
"SEX" : self.sex,
"NAT" : self.nat,
"PAYS" : self.pays,
"INDIC" : self.indic
"INDIC" : self.indic,
"LEN" : self.len,
}
# The the image viewer
@ -817,10 +823,13 @@ class mainWindow(Tk):
"""
self.initialize()
path = ''
path = filedialog.askopenfilename(parent=self, title=lang.all[globs.CNIRlang]["Open a scan of document..."], filetypes=(('TIF files', '*.tif'),
path = filedialog.askopenfilename(parent=self, title=lang.all[globs.CNIRlang]["Open a scan of document..."], filetypes=(
('TIF files', '*.tif'),
('TIF files', '*.tiff'),
('JPEG files', '*.jpg'),
('JPEG files', '*.jpeg')))
('JPEG files', '*.jpeg'),
('PNG files', '*.png')
))
self.openScanFile(path)
def openScanFile(self, path):
@ -831,7 +840,8 @@ class mainWindow(Tk):
if ( path[-3:] != 'jpg'
and path[-3:] != 'tif'
and path[-4:] != 'jpeg'
and path[-4:] != 'tiff' ) or not os.path.isfile(path):
and path[-4:] != 'tiff'
and path[-3:] != 'png' ) or not os.path.isfile(path):
showerror(lang.all[globs.CNIRlang]["Open a scan of document..."], lang.all[globs.CNIRlang]["The file you provided is not valid : {}"].format(path))
return

View File

@ -147,7 +147,7 @@ AC = [
]
VA = [
["11222333333333333333333333333333333333333333", "444444444566677777789AAAAAABCCCCCCCCCCCCCCCCC"],
["11222333333333333333333333333333333333333333", "444444444566677777789AAAAAABCCCCCCCCCCCCCCCC"],
{
"1": ["2", "CODE", "V."],
"2": ["3", "PAYS", "[A-Z]+"],
@ -166,7 +166,7 @@ VA = [
]
VB = [
["112223333333333333333333333333333333", "444444444566677777789AAAAAABCCCCCC"],
["112223333333333333333333333333333333", "444444444566677777789AAAAAABCCCCCCCC"],
{
"1": ["2", "CODE", "V."],
"2": ["3", "PAYS", "[A-Z]+"],
@ -487,6 +487,14 @@ def getDocInfos(doc, code):
res = {}
# Length of MRZ
length = len(code)
if length == len(doc[0][0]+doc[0][1]):
res["LEN"] = [length, True]
else:
res["LEN"] = [length, False]
for field in infoTypes:
value = code[ field[1][0] : field[1][1] ].replace("<", " ").strip()

View File

@ -6,8 +6,8 @@ VSVersionInfo(
ffi=FixedFileInfo(
# filevers and prodvers should be always a tuple with four items: (1, 2, 3, 4)
# Set not needed items to zero 0.
filevers=(3, 1, 5, 0),
prodvers=(3, 1, 5, 0),
filevers=(3, 1, 6, 0),
prodvers=(3, 1, 6, 0),
# Contains a bitmask that specifies the valid bits 'flags'r
mask=0x3f,
# Contains a bitmask that specifies the Boolean attributes of the file.
@ -31,12 +31,12 @@ StringFileInfo(
u'040904B0',
[StringStruct(u'CompanyName', u'Adrien Bourmault (neox95)'),
StringStruct(u'FileDescription', u'This file is part of CNIRevelator.'),
StringStruct(u'FileVersion', u'3.1.5'),
StringStruct(u'FileVersion', u'3.1.6'),
StringStruct(u'InternalName', u'CNIRevelator'),
StringStruct(u'LegalCopyright', u'Copyright (c) Adrien Bourmault (neox95)'),
StringStruct(u'OriginalFilename', u'CNIRevelator.exe'),
StringStruct(u'ProductName', u'CNIRevelator 3.1'),
StringStruct(u'ProductVersion', u'3.1.5')])
StringStruct(u'ProductVersion', u'3.1.6')])
]),
VarFileInfo([VarStruct(u'Translation', [1033, 1200])])
]