more AI optimizations, reworked logger
This commit is contained in:
@@ -1,25 +1,19 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
import loguru
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
from PySide6.QtCore import QDate
|
||||
from PySide6.QtGui import QRegularExpressionValidator
|
||||
|
||||
from src import LOG_DIR, Icon
|
||||
from src import Icon
|
||||
from src.backend import Database, recreateElsaFile
|
||||
from src.logic import Prof, Semester, elsa_word_to_csv
|
||||
from src.shared.logging import log
|
||||
from src.ui.dialogs import ElsaAddEntry, popus_confirm
|
||||
from src.ui.widgets.filepicker import FilePicker
|
||||
from src.ui.widgets.graph import DataQtGraph
|
||||
|
||||
from .widget_sources.elsa_maindialog_ui import Ui_Dialog
|
||||
|
||||
log = loguru.logger
|
||||
log.remove()
|
||||
log.add(sys.stdout, level="INFO")
|
||||
log.add(f"{LOG_DIR}/application.log", rotation="1 MB", retention="10 days")
|
||||
|
||||
|
||||
class ElsaDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
def __init__(self):
|
||||
@@ -399,6 +393,7 @@ class ElsaDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
# get the file path of the selected file based on it's row
|
||||
row = self.dokument_list_elsa.currentRow()
|
||||
file = self.dokument_list_elsa.item(row, 3).text()
|
||||
file_location = file
|
||||
if file == "Database":
|
||||
filename = self.dokument_list_elsa.item(row, 0).text()
|
||||
filetype = self.dokument_list_elsa.item(row, 1).text()
|
||||
@@ -415,16 +410,17 @@ class ElsaDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
log.debug(
|
||||
f"elsa_id: {elsa_id}, prof: {self.elsa_prof.currentText()}, semester: {self.elsa_semester.text()}, date: {self.elsa_date.text()}"
|
||||
)
|
||||
self.db.insertElsaFile(
|
||||
[
|
||||
{
|
||||
"name": file.split("/")[-1],
|
||||
"path": file,
|
||||
"type": file.split(".")[-1],
|
||||
}
|
||||
],
|
||||
elsa_id,
|
||||
)
|
||||
if file_location != "Database":
|
||||
self.db.insertElsaFile(
|
||||
[
|
||||
{
|
||||
"name": file.split("/")[-1],
|
||||
"path": file,
|
||||
"type": file.split(".")[-1],
|
||||
}
|
||||
],
|
||||
elsa_id,
|
||||
)
|
||||
for row in data:
|
||||
if self.seperateEntries.isChecked():
|
||||
if ";" in row["pages"]:
|
||||
|
||||
Reference in New Issue
Block a user