Correction of a bug in bug reporting system

This commit is contained in:
Adrien Bourmault 2019-08-27 13:24:12 +02:00 committed by GitHub
parent a7a22be152
commit 072f1a2510
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 5 deletions

View File

@ -57,12 +57,13 @@ def crashCNIR(shutdown=True):
with open(globs.CNIRMainLog, 'r') as file:
data = file.read()
except:
pass
logfile.printerr("Can't read the log file.")
# send it
success = github.reportBug(traceback.format_exc(), data)
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 ?"])
if res == "yes":
webbrowser.open_new(globs.CNIRErrLog)

View File

@ -28,18 +28,26 @@ from pypac import PACSession
from requests import Session
import json
import logger # logger.py
import globs # globs.py
credentials = False
def reportBug(reason="",log=""):
logfile = logger.logCur
if not credentials:
logfile.printerr("No credentials")
return False
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"]}
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":
return True

View File

@ -26,12 +26,13 @@
import os
# CNIRevelator version
verType = "final release"
verType = "stable release"
version = [3, 1, 4]
verstring_full = "{}.{}.{} {}".format(version[0], version[1], version[2], verType)
verstring = "{}.{}".format(version[0], version[1])
CNIRTesserHash = '947224361ffab8c01f05c9394b44b1bd7c8c3d4d'
CNIRTesserHash = "947224361ffab8c01f05c9394b44b1bd7c8c3d4d"
CNIRGitToken = "23027ea52a48016d56f4ef759b8609981d564a46"
CNIRFolder = os.path.dirname(os.path.realpath(__file__))
CNIRLColor = "#006699"
CNIRName = "CNIRevelator {}".format(verstring)

View File

@ -385,7 +385,8 @@ class mainWindow(Tk):
self.imageViewer.pagenumber = 0
# 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.speed731text.bind('<Control_R>', self.speedValidation)
self.imageViewer.ZONE.bind("<Button-1>", self.rectangleSelectScan)
@ -632,6 +633,7 @@ class mainWindow(Tk):
if not regex.fullmatch(event.char):
self.logOnTerm(lang.all[globs.CNIRlang]["Character not accepted !\n"])
return "break"
# Adds the entry
tempChar = self.termtext.get("1.0", "end")[:-1]
self.mrzChar = tempChar[:pos+1] + event.char + tempChar[pos+1:] + '\n'