1
0
mirror of https://gitlab.os-k.eu/neox/CNIRevelator.git synced 2023-08-25 14:03:10 +02:00

Bug with open file

This commit is contained in:
Adrien Bourmault 2019-08-12 18:11:56 +02:00 committed by GitHub
parent 67b5c903d2
commit b9a24fca1e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 64 additions and 11 deletions

View File

@ -23,22 +23,30 @@
* along with CNIRevelator. If not, see <https:*www.gnu.org/licenses/>. * * along with CNIRevelator. If not, see <https:*www.gnu.org/licenses/>. *
******************************************************************************** ********************************************************************************
""" """
# Import critical files
import sys import sys
import os import os
import subprocess import subprocess
import threading import threading
import psutil import psutil
from tkinter import * import traceback
from tkinter.messagebox import *
import launcher # launcher.py"
import updater # updater.py
import globs # globs.py
import pytesseract # pytesseract.py
import logger # logger.py
import lang # lang.py import lang # lang.py
import ihm # ihm.py import logger # logger.py
import globs # globs.py
import critical # critical.py
# Import all other files
try:
import launcher # launcher.py"
import updater # updater.py
import pytesseract # pytesseract.py
import ihm # ihm.py
from tkinter.messagebox import *
from tkinter import *
except:
critical.LASTCHANCECRASH()
from main import * # main.py from main import * # main.py
@ -78,7 +86,6 @@ def main():
## BOOTSTRAP OF CNIREVELATOR ## BOOTSTRAP OF CNIREVELATOR
try: try:
# LANGUAGE # LANGUAGE
if os.path.isfile(globs.CNIRLangFile): if os.path.isfile(globs.CNIRLangFile):

45
src/critical.py Normal file
View File

@ -0,0 +1,45 @@
"""
********************************************************************************
* CNIRevelator *
* *
* Desc: Critical Stuff for CNIRevelator *
* *
* Copyright © 2018-2019 Adrien Bourmault (neox95) *
* *
* This file is part of CNIRevelator. *
* *
* CNIRevelator is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *
* any later version. *
* *
* CNIRevelator is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY*without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with CNIRevelator. If not, see <https:*www.gnu.org/licenses/>. *
********************************************************************************
"""
from tkinter.messagebox import *
from tkinter import *
import lang # lang.py
import logger # logger.py
def LASTCHANCECRASH():
root = Tk()
root.withdraw()
logfile = logger.logCur
logfile.printerr("FATAL ERROR : see traceback below.\n{}".format(traceback.format_exc()))
showerror(lang.all[globs.CNIRlang]["CNIRevelator Fatal Eror"], lang.all[globs.CNIRlang]["CNIRevelator crashed because a fatal error occured. View log for more infos and please open an issue on Github"])
res = askquestion(lang.all[globs.CNIRlang]["CNIRevelator Fatal Eror"], lang.all[globs.CNIRlang]["Would you like to open an issue on Github to report this bug ?"])
if res == "yes":
webbrowser.open_new("https://github.com/neox95/CNIRevelator/issues")
root.destroy()
# Quit totally without remain in memory
for process in psutil.process_iter():
if process.pid == os.getpid():
process.terminate()
sys.exit(arg)

View File

@ -34,7 +34,7 @@ debug = True
changelog = "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" changelog = "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"
CNIRTesserHash = '5b58db27f7bc08c58a2cb33d01533b034b067cf8' CNIRTesserHash = '5b58db27f7bc08c58a2cb33d01533b034b067cf8'
CNIRFolder = os.getcwd() CNIRFolder = os.path.dirname(os.path.realpath(__file__))
CNIRLColor = "#006699" CNIRLColor = "#006699"
CNIRName = "CNIRevelator {}".format(verstring) CNIRName = "CNIRevelator {}".format(verstring)
CNIRCryptoKey = '82Xh!efX3#@P~2eG' CNIRCryptoKey = '82Xh!efX3#@P~2eG'

View File

@ -336,6 +336,7 @@ 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)
try: try:
try: try: