|
|
|
|
@ -2,20 +2,25 @@ from ui_ile_main_window import Ui_MainWindow |
|
|
|
|
import sys |
|
|
|
|
import os |
|
|
|
|
import pandas as pd |
|
|
|
|
import json |
|
|
|
|
from PyQt5 import QtWidgets |
|
|
|
|
from datetime import datetime as dt |
|
|
|
|
import il_reports as ilx #TODO redo aliasing |
|
|
|
|
from logging import debug, DEBUG, basicConfig, exception |
|
|
|
|
from logging import debug, DEBUG, basicConfig, exception, warn |
|
|
|
|
from tomllib import load |
|
|
|
|
from tomli_w import dump |
|
|
|
|
from shutil import copyfile |
|
|
|
|
from pathlib import Path |
|
|
|
|
from getpass import getuser |
|
|
|
|
|
|
|
|
|
with open("settings.toml", mode='rb') as s: |
|
|
|
|
settings = load(s) |
|
|
|
|
#if settings["debug"]: |
|
|
|
|
basicConfig(filename='debug.log', mode='w', encoding='utf-8', level=DEBUG) |
|
|
|
|
basicConfig(filename='debug.log', mode='w', encoding='utf-8', |
|
|
|
|
level=DEBUG, |
|
|
|
|
format="%(asctime)s %(message)s", |
|
|
|
|
) |
|
|
|
|
|
|
|
|
|
debug("\n\n\n########################### VERSION = 3.3 ###########################\n\n\n") |
|
|
|
|
debug("\n\n\n########################### VERSION = 3.4 ###########################\n\n\n") |
|
|
|
|
debug("Running main.py...") |
|
|
|
|
class MainWindow(QtWidgets.QMainWindow, Ui_MainWindow): |
|
|
|
|
""" |
|
|
|
|
@ -307,3 +312,21 @@ if __name__ == "__main__": |
|
|
|
|
app.exec() |
|
|
|
|
except Exception as e: |
|
|
|
|
exception(f"HIGH LEVEL EXECPTION: {e}") |
|
|
|
|
finally: |
|
|
|
|
log_path = Path(os.curdir,'debug.log') |
|
|
|
|
|
|
|
|
|
remote_log_folder = Path( |
|
|
|
|
r"\\leafnow.com\public\Business Solutions\Apps\AppSources\Logging\ILE", |
|
|
|
|
) |
|
|
|
|
if not remote_log_folder.exists: |
|
|
|
|
os.mkdir(remote_log_folder) |
|
|
|
|
|
|
|
|
|
rlog_file = f"{getuser()}_ile.log" |
|
|
|
|
|
|
|
|
|
try: |
|
|
|
|
copyfile( |
|
|
|
|
log_path, |
|
|
|
|
Path(remote_log_folder, rlog_file) |
|
|
|
|
) |
|
|
|
|
except Exception as e: |
|
|
|
|
warn(f"Failed to save remote log: {remote_log_folder}/{rlog_file}!") |
|
|
|
|
|