files: reorganize imports, remove print lines
This commit is contained in:
@@ -10,8 +10,9 @@ import hashlib
|
||||
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
from src.backend.database import Database
|
||||
from src.backend.admin_console import AdminCommands
|
||||
from src.backend.database import Database
|
||||
|
||||
|
||||
class Ui_Dialog(object):
|
||||
def setupUi(self, Dialog):
|
||||
@@ -64,13 +65,11 @@ class Ui_Dialog(object):
|
||||
def login(self):
|
||||
username = self.lineEdit.text()
|
||||
password = self.lineEdit_2.text()
|
||||
print(type(username), password)
|
||||
# print(type(username), password)
|
||||
# Assuming 'Database' is a class to interact with your database
|
||||
db = Database()
|
||||
db = Database()
|
||||
|
||||
hashed_password = hashlib.sha256(
|
||||
password.encode()
|
||||
).hexdigest()
|
||||
hashed_password = hashlib.sha256(password.encode()).hexdigest()
|
||||
if len(db.getUsers()) == 0:
|
||||
AdminCommands().create_admin()
|
||||
self.lresult = 1 # Indicate successful login
|
||||
|
||||
@@ -6,17 +6,18 @@
|
||||
# run again. Do not edit this file unless you know what you are doing.
|
||||
|
||||
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
import subprocess
|
||||
import tempfile
|
||||
import os
|
||||
import re
|
||||
import subprocess
|
||||
import tempfile
|
||||
|
||||
from omegaconf import OmegaConf
|
||||
from PySide6 import QtCore, QtWidgets
|
||||
|
||||
config = OmegaConf.load("config.yaml")
|
||||
|
||||
class Ui_eMailPreview(object):
|
||||
|
||||
class Ui_eMailPreview(object):
|
||||
def setupUi(
|
||||
self,
|
||||
eMailPreview,
|
||||
@@ -31,7 +32,10 @@ class Ui_eMailPreview(object):
|
||||
self.buttonBox = QtWidgets.QDialogButtonBox(eMailPreview)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(310, 630, 341, 32))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Orientation.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.StandardButton.Cancel|QtWidgets.QDialogButtonBox.StandardButton.Ok)
|
||||
self.buttonBox.setStandardButtons(
|
||||
QtWidgets.QDialogButtonBox.StandardButton.Cancel
|
||||
| QtWidgets.QDialogButtonBox.StandardButton.Ok
|
||||
)
|
||||
self.buttonBox.setObjectName("buttonBox")
|
||||
self.gridLayoutWidget = QtWidgets.QWidget(eMailPreview)
|
||||
self.gridLayoutWidget.setGeometry(QtCore.QRect(10, 10, 661, 621))
|
||||
@@ -46,7 +50,11 @@ class Ui_eMailPreview(object):
|
||||
self.prof_name.setObjectName("prof_name")
|
||||
self.gridLayout.addWidget(self.prof_name, 2, 2, 1, 1)
|
||||
self.label_3 = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||
self.label_3.setAlignment(QtCore.Qt.AlignmentFlag.AlignLeading|QtCore.Qt.AlignmentFlag.AlignLeft|QtCore.Qt.AlignmentFlag.AlignTop)
|
||||
self.label_3.setAlignment(
|
||||
QtCore.Qt.AlignmentFlag.AlignLeading
|
||||
| QtCore.Qt.AlignmentFlag.AlignLeft
|
||||
| QtCore.Qt.AlignmentFlag.AlignTop
|
||||
)
|
||||
self.label_3.setObjectName("label_3")
|
||||
self.gridLayout.addWidget(self.label_3, 5, 0, 1, 1)
|
||||
self.mail_name = QtWidgets.QLineEdit(self.gridLayoutWidget)
|
||||
@@ -81,7 +89,12 @@ class Ui_eMailPreview(object):
|
||||
self.gender_non = QtWidgets.QRadioButton(self.gridLayoutWidget)
|
||||
self.gender_non.setObjectName("gender_non")
|
||||
self.horizontalLayout_3.addWidget(self.gender_non)
|
||||
spacerItem = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
|
||||
spacerItem = QtWidgets.QSpacerItem(
|
||||
40,
|
||||
20,
|
||||
QtWidgets.QSizePolicy.Policy.Expanding,
|
||||
QtWidgets.QSizePolicy.Policy.Minimum,
|
||||
)
|
||||
self.horizontalLayout_3.addItem(spacerItem)
|
||||
self.gridLayout.addLayout(self.horizontalLayout_3, 4, 2, 1, 1)
|
||||
self.label_6 = QtWidgets.QLabel(self.gridLayoutWidget)
|
||||
@@ -89,8 +102,8 @@ class Ui_eMailPreview(object):
|
||||
self.gridLayout.addWidget(self.label_6, 4, 0, 1, 1)
|
||||
|
||||
self.retranslateUi(eMailPreview)
|
||||
self.buttonBox.accepted.connect(eMailPreview.accept) # type: ignore
|
||||
self.buttonBox.rejected.connect(eMailPreview.reject) # type: ignore
|
||||
self.buttonBox.accepted.connect(eMailPreview.accept) # type: ignore
|
||||
self.buttonBox.rejected.connect(eMailPreview.reject) # type: ignore
|
||||
QtCore.QMetaObject.connectSlotsByName(eMailPreview)
|
||||
self._appid = app_id
|
||||
self._appname = app_name
|
||||
@@ -127,7 +140,6 @@ class Ui_eMailPreview(object):
|
||||
return "Sehr geehrte Frau"
|
||||
elif self.gender_non.isChecked():
|
||||
return "Guten Tag"
|
||||
|
||||
|
||||
def set_mail(self):
|
||||
email_template = self.comboBox.currentText()
|
||||
@@ -145,14 +157,19 @@ class Ui_eMailPreview(object):
|
||||
mail_html = mail_template.split("<html>")[1]
|
||||
mail_html = "<html>" + mail_html
|
||||
mail_html = mail_html.format(
|
||||
Profname=self.prof_name.text().split(" ")[1], Appname=self._appname, AppNr=self._appid, AppSubject = self._subject,greeting = self.get_greeting()
|
||||
Profname=self.prof_name.text().split(" ")[1],
|
||||
Appname=self._appname,
|
||||
AppNr=self._appid,
|
||||
AppSubject=self._subject,
|
||||
greeting=self.get_greeting(),
|
||||
)
|
||||
|
||||
self.mail_body.setHtml(mail_html)
|
||||
|
||||
def load_mail_templates(self):
|
||||
mail_templates = os.listdir("mail_vorlagen")
|
||||
mail_templates = [f for f in mail_templates if f.endswith(".eml")]
|
||||
print(mail_templates)
|
||||
# print(mail_templates)
|
||||
self.comboBox.addItems(mail_templates)
|
||||
|
||||
def save_mail(self):
|
||||
@@ -168,16 +185,17 @@ class Ui_eMailPreview(object):
|
||||
) as f:
|
||||
f.write(mail)
|
||||
self.mail_path = f.name
|
||||
print(self.mail_path)
|
||||
# print(self.mail_path)
|
||||
# open the file using thunderbird
|
||||
subprocess.Popen([f"{self.mail_path}"])
|
||||
# delete the file
|
||||
# os.remove(self.mail_path)
|
||||
|
||||
|
||||
def launch():
|
||||
app = QtWidgets.QApplication([])
|
||||
eMailPreview = QtWidgets.QDialog()
|
||||
ui = Ui_eMailPreview()
|
||||
ui.setupUi(eMailPreview, "1","Test","Biologie","Kirchner, Alexander")
|
||||
ui.setupUi(eMailPreview, "1", "Test", "Biologie", "Kirchner, Alexander")
|
||||
eMailPreview.show()
|
||||
app.exec()
|
||||
app.exec()
|
||||
|
||||
@@ -110,7 +110,7 @@ class Ui_Form(object):
|
||||
self.progressBar.setValue(value)
|
||||
|
||||
def thread_quit(self):
|
||||
print("Terminating thread")
|
||||
# print("Terminating thread")
|
||||
self.thread.terminate()
|
||||
self.thread.quit()
|
||||
self.thread.deleteLater()
|
||||
@@ -144,7 +144,7 @@ class Ui_Form(object):
|
||||
def determine_progress(self, signal):
|
||||
# check length of listWidget
|
||||
length = self.listWidget.count()
|
||||
print(f"Length of listWidget: {length}")
|
||||
# print(f"Length of listWidget: {length}")
|
||||
if length == 0:
|
||||
logger.log_info("AutoAdder finished")
|
||||
self.buttonBox.accepted.emit()
|
||||
|
||||
@@ -169,7 +169,7 @@ class Ui_Dialog(object):
|
||||
name = application.application
|
||||
file_type = application.extensions
|
||||
display_name = application.name
|
||||
print(name, file_type, display_name) #
|
||||
# print(name, file_type, display_name) #
|
||||
# create new item
|
||||
item = QtWidgets.QTreeWidgetItem(self.treeWidget)
|
||||
item.setText(0, display_name)
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from .dialog_sources.Ui_about import Ui_about
|
||||
from PySide6 import QtWidgets
|
||||
import PySide6
|
||||
from src import Icon, __version__, __author__
|
||||
from PySide6 import QtWidgets
|
||||
|
||||
from src import Icon, __author__, __version__
|
||||
|
||||
from .dialog_sources.about_ui import Ui_about
|
||||
|
||||
|
||||
class About(QtWidgets.QDialog, Ui_about):
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
from PySide6 import QtWidgets
|
||||
from .dialog_sources.Ui_apparat_extend import Ui_Dialog
|
||||
|
||||
from src import Icon
|
||||
|
||||
from .dialog_sources.apparat_extend_ui import Ui_Dialog
|
||||
|
||||
|
||||
class ApparatExtendDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
def __init__(
|
||||
|
||||
@@ -2,7 +2,7 @@ from PySide6 import QtWidgets
|
||||
|
||||
from src.logic.dataclass import BookData
|
||||
|
||||
from .dialog_sources.Ui_edit_bookdata import Ui_Dialog
|
||||
from .dialog_sources.edit_bookdata_ui import Ui_Dialog
|
||||
|
||||
|
||||
class BookDataUI(QtWidgets.QDialog, Ui_Dialog):
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
from .dialog_sources.documentprint_ui import Ui_Dialog
|
||||
from PySide6 import QtWidgets, QtCore
|
||||
from src import Icon
|
||||
|
||||
from src.utils.richtext import SemapSchilder, SemesterDocument
|
||||
from src.backend import Semester, Database
|
||||
from natsort import natsorted
|
||||
from PySide6 import QtWidgets
|
||||
|
||||
from src import Icon
|
||||
from src.backend import Database, Semester
|
||||
from src.utils.richtext import SemapSchilder, SemesterDocument
|
||||
|
||||
from .dialog_sources.documentprint_ui import Ui_Dialog
|
||||
|
||||
|
||||
class DocumentPrintDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
@@ -23,25 +24,25 @@ class DocumentPrintDialog(QtWidgets.QDialog, Ui_Dialog):
|
||||
# Ensure the signal is connected only once
|
||||
try:
|
||||
self.pushButton_2.clicked.disconnect()
|
||||
except TypeError:
|
||||
except (TypeError, RuntimeWarning):
|
||||
pass # Signal was not connected before
|
||||
self.pushButton_2.clicked.connect(self.on_pushButton_2_clicked)
|
||||
|
||||
try:
|
||||
self.pushButton.clicked.disconnect()
|
||||
except TypeError:
|
||||
except (TypeError, RuntimeWarning):
|
||||
pass
|
||||
self.pushButton.clicked.connect(self.on_pushButton_clicked)
|
||||
|
||||
try:
|
||||
self.btn_load_current_apparats.clicked.disconnect()
|
||||
except TypeError:
|
||||
except (TypeError, RuntimeWarning):
|
||||
pass
|
||||
self.btn_load_current_apparats.clicked.connect(self.load_current_clicked)
|
||||
|
||||
try:
|
||||
self.manualCheck.clicked.disconnect()
|
||||
except TypeError:
|
||||
except (TypeError, RuntimeWarning):
|
||||
pass
|
||||
self.manualCheck.clicked.connect(self.manual_request)
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
from .dialog_sources.Ui_elsa_add_table_entry import Ui_Dialog
|
||||
from src.logic.webrequest import WebRequest, BibTextTransformer
|
||||
from src import Icon
|
||||
from PySide6 import QtWidgets
|
||||
from src.transformers.transformers import DictToTable
|
||||
|
||||
from src import Icon
|
||||
from src.logic.webrequest import BibTextTransformer, WebRequest
|
||||
from src.logic.zotero import ZoteroController
|
||||
from src.transformers.transformers import DictToTable
|
||||
|
||||
from .dialog_sources.elsa_add_table_entry_ui import Ui_Dialog
|
||||
|
||||
zot = ZoteroController()
|
||||
dtt = DictToTable()
|
||||
@@ -174,7 +176,7 @@ class ElsaAddEntry(QtWidgets.QDialog, Ui_Dialog):
|
||||
self.stackedWidget.setCurrentIndex(3)
|
||||
|
||||
def search(self, pages=None):
|
||||
print("searching")
|
||||
# #print("searching")
|
||||
param = self.searchIdent.text()
|
||||
web = WebRequest()
|
||||
web.get_ppn(param)
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
from .dialog_sources.Ui_elsa_generator_confirm import Ui_Dialog
|
||||
from PySide6 import QtWidgets
|
||||
|
||||
from .dialog_sources.elsa_generator_confirm_ui import Ui_Dialog
|
||||
|
||||
|
||||
class ElsaGenConfirm(QtWidgets.QDialog, Ui_Dialog):
|
||||
def __init__(self, parent=None, data=None):
|
||||
|
||||
@@ -70,7 +70,7 @@ class LoginDialog(Ui_Dialog):
|
||||
def login(self):
|
||||
username = self.lineEdit.text()
|
||||
password = self.lineEdit_2.text()
|
||||
# print(type(username), password)
|
||||
# #print(type(username), password)
|
||||
# Assuming 'Database' is a class to interact with your database
|
||||
|
||||
hashed_password = hashlib.sha256(password.encode()).hexdigest()
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from .dialog_sources.medianadder_ui import Ui_Dialog
|
||||
from src import Icon
|
||||
|
||||
from .dialog_sources.medianadder_ui import Ui_Dialog
|
||||
|
||||
|
||||
class MedienAdder(QtWidgets.QDialog, Ui_Dialog):
|
||||
def __init__(self, parent=None):
|
||||
@@ -78,4 +79,4 @@ def launch_gui():
|
||||
dialog = MedienAdder()
|
||||
dialog.show()
|
||||
app.exec()
|
||||
# print(dialog.mode, dialog.data, dialog.result())
|
||||
# #print(dialog.mode, dialog.data, dialog.result())
|
||||
|
||||
@@ -1,17 +1,19 @@
|
||||
import sys
|
||||
|
||||
import loguru
|
||||
from PySide6 import QtWidgets
|
||||
|
||||
from src import LOG_DIR
|
||||
from src.backend import AutoAdder
|
||||
|
||||
|
||||
from .dialog_sources.parsed_titles_ui import Ui_Form
|
||||
import loguru
|
||||
import sys
|
||||
from src import LOG_DIR
|
||||
|
||||
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 ParsedTitles(QtWidgets.QWidget, Ui_Form):
|
||||
def __init__(self, parent=None):
|
||||
super().__init__(parent)
|
||||
@@ -32,7 +34,7 @@ class ParsedTitles(QtWidgets.QWidget, Ui_Form):
|
||||
self.progressBar.setValue(value)
|
||||
|
||||
def worker_quit(self):
|
||||
# print("Terminating worker")
|
||||
# #print("Terminating worker")
|
||||
self.worker.terminate()
|
||||
self.worker.quit()
|
||||
self.worker.deleteLater()
|
||||
@@ -66,7 +68,7 @@ class ParsedTitles(QtWidgets.QWidget, Ui_Form):
|
||||
def determine_progress(self, signal):
|
||||
# check length of listWidget
|
||||
length = self.listWidget.count()
|
||||
# print(f"Length of listWidget: {length}")
|
||||
# #print(f"Length of listWidget: {length}")
|
||||
if length == 0:
|
||||
log.info("AutoAdder finished")
|
||||
self.buttonBox.accepted.emit()
|
||||
|
||||
@@ -10,7 +10,7 @@ from PySide6 import QtWidgets
|
||||
|
||||
from src import Icon
|
||||
|
||||
from .dialog_sources.Ui_confirm_extend import Ui_extend_confirm
|
||||
from .dialog_sources.confirm_extend_ui import Ui_extend_confirm
|
||||
|
||||
|
||||
class ConfirmDialog(QtWidgets.QDialog, Ui_extend_confirm):
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
from src import Icon, settings
|
||||
from .dialog_sources.settings_ui import Ui_Dialog as _settings
|
||||
from src.ui.widgets.iconLine import IconWidget
|
||||
import loguru
|
||||
import sys
|
||||
from src import LOG_DIR
|
||||
|
||||
import loguru
|
||||
from PySide6 import QtCore, QtGui, QtWidgets
|
||||
|
||||
from src import LOG_DIR, Icon, settings
|
||||
from src.ui.widgets.iconLine import IconWidget
|
||||
|
||||
from .dialog_sources.settings_ui import Ui_Dialog as _settings
|
||||
|
||||
log = loguru.logger
|
||||
log.remove()
|
||||
@@ -12,7 +14,6 @@ log.add(sys.stdout, level="INFO")
|
||||
log.add(f"{LOG_DIR}/application.log", rotation="1 MB", retention="10 days")
|
||||
|
||||
|
||||
|
||||
base = """'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
|
||||
|
||||
<html><head><meta name="qrichtext" content="1" /><meta charset="utf-8" /><style
|
||||
@@ -220,7 +221,7 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
|
||||
for color in self.get_colors():
|
||||
settings.icons.colors[color] = self.get_colors()[color]
|
||||
# print(color)
|
||||
# #print(color)
|
||||
for icon in self.get_icons():
|
||||
settings.icons.icons[icon] = self.get_icons()[icon]
|
||||
|
||||
@@ -245,7 +246,7 @@ class Settings(QtWidgets.QDialog, _settings):
|
||||
|
||||
def save(self):
|
||||
config = self.return_data()
|
||||
# #print(config)
|
||||
# ##print(config)
|
||||
|
||||
config.save()
|
||||
self.accept()
|
||||
|
||||
Reference in New Issue
Block a user