threads __init__, pyside6->pyqt6

This commit is contained in:
WorldTeacher
2024-05-07 15:33:35 +02:00
parent 24eefd9473
commit e999c51863
34 changed files with 972 additions and 985 deletions

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\dialogs\edit_bookdata.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from src.logic.dataclass import BookData

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\dialogs\fileparser.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from src.logic.webrequest import BibTextTransformer, WebRequest

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file '/home/alexander/GitHub/Semesterapparate/ui/dialogs/login.ui'
#
# Created by: PySide6 UI code generator 6.5.3
# Created by: PyQt6 UI code generator 6.5.3
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
@@ -8,10 +8,11 @@
import hashlib
from PySide6 import QtCore, QtWidgets
from PyQt6 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):
@@ -66,11 +67,9 @@ class Ui_Dialog(object):
password = self.lineEdit_2.text()
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
@@ -110,3 +109,5 @@ if __name__ == "__main__":
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec())

View File

@@ -1,37 +1,42 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\dialogs\mail_preview.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# 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 PyQt6 import QtCore, QtGui, QtWidgets
config = OmegaConf.load("config.yaml")
class Ui_eMailPreview(object):
def setupUi(
self,
eMailPreview,
app_id="",
app_name="",
app_subject="",
prof_name="",
data=None,
# app_id,
# app_name,
# app_subject,
# prof_name,
# prof_mail,
):
eMailPreview.setObjectName("eMailPreview")
eMailPreview.resize(676, 676)
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 +51,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 +90,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,23 +103,23 @@ 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
self._subject = app_subject
self.prof_name.setText(prof_name)
self._mail_data = ""
self._data = data
self.load_mail_templates()
# self._appid = app_id
# self._appname = app_name
# self._subject = app_subject
# self.prof_name.setText(prof_name)
# self._mail_data = ""
# self._prof_mail = prof_mail
# self.load_mail_templates()
self.comboBox.addItem("")
self.comboBox.setCurrentText("")
self.buttonBox.accepted.connect(self.save_mail)
self.comboBox.currentIndexChanged.connect(self.set_mail)
self.gender_female.clicked.connect(self.set_mail)
self.gender_male.clicked.connect(self.set_mail)
self.gender_non.clicked.connect(self.set_mail)
# self.buttonBox.accepted.connect(self.save_mail)
# self.comboBox.currentIndexChanged.connect(self.set_mail)
# self.gender_female.clicked.connect(self.set_mail)
# self.gender_male.clicked.connect(self.set_mail)
# self.gender_non.clicked.connect(self.set_mail)
def retranslateUi(self, eMailPreview):
_translate = QtCore.QCoreApplication.translate
@@ -120,64 +134,69 @@ class Ui_eMailPreview(object):
self.gender_non.setText(_translate("eMailPreview", "Divers"))
self.label_6.setText(_translate("eMailPreview", "Geschlecht"))
def get_greeting(self):
if self.gender_male.isChecked():
return "Sehr geehrter Herr"
elif self.gender_female.isChecked():
return "Sehr geehrte Frau"
elif self.gender_non.isChecked():
return "Guten Tag"
# def get_greeting(self):
# if self.gender_male.isChecked():
# return "Sehr geehrter Herr"
# elif self.gender_female.isChecked():
# return "Sehr geehrte Frau"
# elif self.gender_non.isChecked():
# return "Guten Tag"
def set_mail(self):
email_template = self.comboBox.currentText()
if email_template == "":
return
with open(f"mail_vorlagen/{email_template}", "r", encoding="utf-8") as f:
mail_template = f.read()
header = re.findall(r"Subject: (.*)", mail_template)
if header:
email_header = header[0]
else:
email_header = email_template.split(".eml")[0]
self.mail_header.setText(email_header)
self.mail_data = mail_template.split("<html>")[0]
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()
)
# def set_mail(self):
# email_template = self.comboBox.currentText()
# if email_template == "":
# return
# with open(f"mail_vorlagen/{email_template}", "r", encoding="utf-8") as f:
# mail_template = f.read()
# header = re.findall(r"Subject: (.*)", mail_template)
# if header:
# email_header = header[0]
# else:
# email_header = email_template.split(".eml")[0]
# self.mail_header.setText(email_header)
# self.mail_data = mail_template.split("<html>")[0]
# 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(),
# )
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)
self.comboBox.addItems(mail_templates)
# 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)
# self.comboBox.addItems(mail_templates)
# def save_mail(self):
# # create a temporary file
# mail_header = self.mail_header.text()
# mail_body = self.mail_body.toHtml()
# mail = self.mail_data + mail_body
# mail = mail.replace("Subject:", f"Subject: {mail_header}")
# directory = config["database"]["tempdir"]
# directory = directory.replace("~", str(os.path.expanduser("~")))
# with tempfile.NamedTemporaryFile(
# mode="w", delete=False, suffix=".eml", encoding="utf-8", dir=directory
# ) as f:
# f.write(mail)
# self.mail_path = f.name
# print(self.mail_path)
# # open the file using thunderbird
# subprocess.Popen([f"{self.mail_path}"])
# # delete the file
# # os.remove(self.mail_path)
def save_mail(self):
# create a temporary file
mail_header = self.mail_header.text()
mail_body = self.mail_body.toHtml()
mail = self.mail_data + mail_body
mail = mail.replace("Subject:", f"Subject: {mail_header}")
directory = config["database"]["tempdir"]
directory = directory.replace("~", str(os.path.expanduser("~")))
with tempfile.NamedTemporaryFile(
mode="w", delete=False, suffix=".eml", encoding="utf-8", dir=directory
) as f:
f.write(mail)
self.mail_path = f.name
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()

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\dialogs\medianadder.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\dialogs\new_subject.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtWidgets
from PyQt6 import QtCore, QtWidgets
class Ui_Dialog(object):
@@ -22,7 +22,12 @@ class Ui_Dialog(object):
self.verticalLayout.addWidget(self.label)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
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.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
self.checkBox = QtWidgets.QCheckBox(Dialog)
self.checkBox.setObjectName("checkBox")
@@ -42,22 +47,33 @@ class Ui_Dialog(object):
self.verticalLayout_2.addWidget(self.frame)
self.buttonBox = QtWidgets.QDialogButtonBox(Dialog)
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.verticalLayout_2.addWidget(self.buttonBox)
self.frame.setVisible(False)
self.checkBox.stateChanged.connect(lambda: self.frame.setVisible(self.checkBox.isChecked()))
self.checkBox.stateChanged.connect(
lambda: self.frame.setVisible(self.checkBox.isChecked())
)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.label.setText(_translate("Dialog", "Das eingegebene Fach wurde nicht in der Datenbank gefunden. Soll es angelegt werden?"))
self.label.setText(
_translate(
"Dialog",
"Das eingegebene Fach wurde nicht in der Datenbank gefunden. Soll es angelegt werden?",
)
)
self.checkBox.setText(_translate("Dialog", "Ja"))
self.label_2.setText(_translate("Dialog", "Name des Neuen Faches:"))
def return_state(self):
return self.lineEdit.text()
return self.lineEdit.text()

View File

@@ -1,15 +1,15 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\dialogs\parsed_titles.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from src.logic import AutoAdder
from src.logic.log import MyLogger
from src.logic.threads import AutoAdder
logger = MyLogger("AutoTitleAdder")
@@ -156,3 +156,5 @@ class Ui_Form(object):
self.listWidget.takeItem(0)
# add first entry to listWidget_done
self.listWidget_done.addItem(text)

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\dialogs\reminder.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):

View File

@@ -1,13 +1,13 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\Semesterapparate\ui\dialogs\settings.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from omegaconf import OmegaConf
from PySide6 import QtCore, QtWidgets
from PyQt6 import QtCore, QtWidgets
config = OmegaConf.load("config.yaml")
@@ -127,7 +127,7 @@ class Ui_Dialog(object):
'<html><head><meta name="qrichtext" content="1" /><style type="text/css">\n'
"p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:'MS Shell Dlg 2'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
'<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Hier können Einstellungen f<EFBFBD>r bestehende Dateiformate geändert, oder neue Dateiformate eingefügt werden</p>\n'
'<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Hier können Einstellungen für bestehende Dateiformate geändert, oder neue Dateiformate eingefügt werden</p>\n'
'<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;"><br /></p></body></html>',
)
)

View File

@@ -1,14 +1,16 @@
# Form implementation generated from reading ui file 'ui\dialogs\apparat_extend.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from src.backend.semester import generateSemesterByDate
class Ui_Dialog(object):
def setupUi(self, Dialog):
Dialog.setObjectName("Dialog")
@@ -94,12 +96,14 @@ class Ui_Dialog(object):
# else:
# self.rad_winter.setChecked(True)
return {
"semester": f"SoSe {int(self.sem_year.text()[-2:])}"
if self.rad_sommer.isChecked()
else f"WiSe {int(self.sem_year.text()[-2:])}/{int(self.sem_year.text()[-2:])+1}",
"dauerapp": self.dauerapp.isChecked()
if self.dauerapp.isChecked()
else False,
"semester": (
f"SoSe {int(self.sem_year.text()[-2:])}"
if self.rad_sommer.isChecked()
else f"WiSe {int(self.sem_year.text()[-2:])}/{int(self.sem_year.text()[-2:])+1}"
),
"dauerapp": (
self.dauerapp.isChecked() if self.dauerapp.isChecked() else False
),
}
@@ -112,3 +116,4 @@ if __name__ == "__main__":
ui.setupUi(Dialog)
Dialog.show()
sys.exit(app.exec())

View File

@@ -8,21 +8,57 @@
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractButton, QApplication, QCheckBox, QDialog,
QDialogButtonBox, QFrame, QLabel, QLineEdit,
QRadioButton, QSizePolicy, QWidget)
from PyQt6.QtCore import (
QCoreApplication,
QDate,
QDateTime,
QLocale,
QMetaObject,
QObject,
QPoint,
QRect,
QSize,
Qt,
QTime,
QUrl,
)
from PyQt6.QtGui import (
QBrush,
QColor,
QConicalGradient,
QCursor,
QFont,
QFontDatabase,
QGradient,
QIcon,
QImage,
QKeySequence,
QLinearGradient,
QPainter,
QPalette,
QPixmap,
QRadialGradient,
QTransform,
)
from PyQt6.QtWidgets import (
QAbstractButton,
QApplication,
QCheckBox,
QDialog,
QDialogButtonBox,
QFrame,
QLabel,
QLineEdit,
QRadioButton,
QSizePolicy,
QWidget,
)
class Ui_Dialog(object):
def setupUi(self, Dialog):
if not Dialog.objectName():
Dialog.setObjectName(u"Dialog")
Dialog.setObjectName("Dialog")
Dialog.resize(388, 103)
sizePolicy = QSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed)
sizePolicy.setHorizontalStretch(0)
@@ -32,37 +68,39 @@ class Ui_Dialog(object):
Dialog.setMinimumSize(QSize(388, 103))
Dialog.setMaximumSize(QSize(388, 103))
self.buttonBox = QDialogButtonBox(Dialog)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setObjectName("buttonBox")
self.buttonBox.setGeometry(QRect(290, 30, 81, 241))
self.buttonBox.setOrientation(Qt.Vertical)
self.buttonBox.setStandardButtons(QDialogButtonBox.Abort|QDialogButtonBox.Save)
self.buttonBox.setStandardButtons(
QDialogButtonBox.Abort | QDialogButtonBox.Save
)
self.label = QLabel(Dialog)
self.label.setObjectName(u"label")
self.label.setObjectName("label")
self.label.setGeometry(QRect(10, 0, 281, 31))
font = QFont()
font.setPointSize(10)
self.label.setFont(font)
self.frame = QFrame(Dialog)
self.frame.setObjectName(u"frame")
self.frame.setObjectName("frame")
self.frame.setGeometry(QRect(10, 30, 241, 41))
self.frame.setFrameShape(QFrame.StyledPanel)
self.frame.setFrameShadow(QFrame.Raised)
self.line = QFrame(self.frame)
self.line.setObjectName(u"line")
self.line.setObjectName("line")
self.line.setGeometry(QRect(120, 0, 3, 61))
self.line.setFrameShape(QFrame.VLine)
self.line.setFrameShadow(QFrame.Sunken)
self.rad_sommer = QRadioButton(self.frame)
self.rad_sommer.setObjectName(u"rad_sommer")
self.rad_sommer.setObjectName("rad_sommer")
self.rad_sommer.setGeometry(QRect(10, 10, 82, 21))
self.rad_winter = QRadioButton(self.frame)
self.rad_winter.setObjectName(u"rad_winter")
self.rad_winter.setObjectName("rad_winter")
self.rad_winter.setGeometry(QRect(140, 10, 82, 21))
self.sem_year = QLineEdit(Dialog)
self.sem_year.setObjectName(u"sem_year")
self.sem_year.setObjectName("sem_year")
self.sem_year.setGeometry(QRect(10, 70, 121, 20))
self.checkBox = QCheckBox(Dialog)
self.checkBox.setObjectName(u"checkBox")
self.checkBox.setObjectName("checkBox")
self.checkBox.setGeometry(QRect(150, 70, 91, 21))
self.retranslateUi(Dialog)
@@ -70,14 +108,25 @@ class Ui_Dialog(object):
self.buttonBox.rejected.connect(Dialog.reject)
QMetaObject.connectSlotsByName(Dialog)
# setupUi
def retranslateUi(self, Dialog):
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", u"Dialog", None))
self.label.setText(QCoreApplication.translate("Dialog", u"Bis wann soll der Apparat verl\u00e4ngert werden?", None))
self.rad_sommer.setText(QCoreApplication.translate("Dialog", u"Sommer", None))
self.rad_winter.setText(QCoreApplication.translate("Dialog", u"Winter", None))
self.sem_year.setPlaceholderText(QCoreApplication.translate("Dialog", u"2023", None))
self.checkBox.setText(QCoreApplication.translate("Dialog", u"Dauerapparat", None))
Dialog.setWindowTitle(QCoreApplication.translate("Dialog", "Dialog", None))
self.label.setText(
QCoreApplication.translate(
"Dialog", "Bis wann soll der Apparat verl\u00e4ngert werden?", None
)
)
self.rad_sommer.setText(QCoreApplication.translate("Dialog", "Sommer", None))
self.rad_winter.setText(QCoreApplication.translate("Dialog", "Winter", None))
self.sem_year.setPlaceholderText(
QCoreApplication.translate("Dialog", "2023", None)
)
self.checkBox.setText(
QCoreApplication.translate("Dialog", "Dauerapparat", None)
)
# retranslateUi

View File

@@ -8,28 +8,61 @@
## WARNING! All changes made in this file will be lost when recompiling UI file!
################################################################################
from PySide6.QtCore import (QCoreApplication, QDate, QDateTime, QLocale,
QMetaObject, QObject, QPoint, QRect,
QSize, QTime, QUrl, Qt)
from PySide6.QtGui import (QBrush, QColor, QConicalGradient, QCursor,
QFont, QFontDatabase, QGradient, QIcon,
QImage, QKeySequence, QLinearGradient, QPainter,
QPalette, QPixmap, QRadialGradient, QTransform)
from PySide6.QtWidgets import (QAbstractButton, QApplication, QDialog, QDialogButtonBox,
QSizePolicy, QTextEdit, QWidget)
from PyQt6.QtCore import (
QCoreApplication,
QDate,
QDateTime,
QLocale,
QMetaObject,
QObject,
QPoint,
QRect,
QSize,
Qt,
QTime,
QUrl,
)
from PyQt6.QtGui import (
QBrush,
QColor,
QConicalGradient,
QCursor,
QFont,
QFontDatabase,
QGradient,
QIcon,
QImage,
QKeySequence,
QLinearGradient,
QPainter,
QPalette,
QPixmap,
QRadialGradient,
QTransform,
)
from PyQt6.QtWidgets import (
QAbstractButton,
QApplication,
QDialog,
QDialogButtonBox,
QSizePolicy,
QTextEdit,
QWidget,
)
class Ui_extend_confirm(object):
def setupUi(self, extend_confirm):
if not extend_confirm.objectName():
extend_confirm.setObjectName(u"extend_confirm")
extend_confirm.setObjectName("extend_confirm")
extend_confirm.resize(380, 97)
self.buttonBox = QDialogButtonBox(extend_confirm)
self.buttonBox.setObjectName(u"buttonBox")
self.buttonBox.setObjectName("buttonBox")
self.buttonBox.setGeometry(QRect(290, 20, 81, 241))
self.buttonBox.setOrientation(Qt.Vertical)
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel|QDialogButtonBox.Ok)
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok)
self.textEdit = QTextEdit(extend_confirm)
self.textEdit.setObjectName(u"textEdit")
self.textEdit.setObjectName("textEdit")
self.textEdit.setGeometry(QRect(10, 10, 271, 81))
self.retranslateUi(extend_confirm)
@@ -37,9 +70,14 @@ class Ui_extend_confirm(object):
self.buttonBox.rejected.connect(extend_confirm.reject)
QMetaObject.connectSlotsByName(extend_confirm)
# setupUi
def retranslateUi(self, extend_confirm):
extend_confirm.setWindowTitle(QCoreApplication.translate("extend_confirm", u"Dialog", None))
extend_confirm.setWindowTitle(
QCoreApplication.translate("extend_confirm", "Dialog", None)
)
# retranslateUi

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'ui/dialogs/extend_apparat.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Frame(object):
@@ -18,7 +18,10 @@ class Ui_Frame(object):
self.label.setObjectName("label")
self.buttonBox = QtWidgets.QDialogButtonBox(Frame)
self.buttonBox.setGeometry(QtCore.QRect(90, 90, 156, 23))
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.sem_winter = QtWidgets.QRadioButton(Frame)
self.sem_winter.setGeometry(QtCore.QRect(60, 40, 82, 17))
@@ -36,16 +39,20 @@ class Ui_Frame(object):
def retranslateUi(self, Frame):
_translate = QtCore.QCoreApplication.translate
Frame.setWindowTitle(_translate("Frame", "Frame"))
self.label.setText(_translate("Frame", "Bis wann soll der Apparat verlängert werden?"))
self.label.setText(
_translate("Frame", "Bis wann soll der Apparat verlängert werden?")
)
self.sem_winter.setText(_translate("Frame", "Winter"))
self.sem_sommer.setText(_translate("Frame", "Sommer"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Frame = QtWidgets.QFrame()
ui = Ui_Frame()
ui.setupUi(Frame)
Frame.show()
sys.exit(app.exec())

View File

@@ -2,7 +2,7 @@ import os
import sys
from omegaconf import OmegaConf
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from src.ui.dialogs.Ui_mail_preview import Ui_eMailPreview as Ui_Dialog
@@ -38,13 +38,23 @@ class Mail_Dialog(QtWidgets.QDialog, Ui_Dialog):
self.prof_name.setText(prof_name)
self.mail_name.setText(self.prof_mail)
self.load_mail_templates()
# if default_mail is not None:
# # get the nearest match to the default mail
# for i in range(self.comboBox.count()):
# if default_mail in self.comboBox.itemText(i):
# default_mail = self.comboBox.itemText(i)
# break
# self.comboBox.setCurrentText(default_mail)
# if none of the radio buttons is checked, disable the accept button of the dialog
if (
self.gender_female.isChecked()
or self.gender_male.isChecked()
or self.gender_male.isChecked()
):
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True)
else:
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(False)
if default_mail is not None:
# get the nearest match to the default mail
for i in range(self.comboBox.count()):
if default_mail in self.comboBox.itemText(i):
default_mail = self.comboBox.itemText(i)
break
self.comboBox.setCurrentText(default_mail)
self.gender_female.clicked.connect(self.set_mail)
self.gender_male.clicked.connect(self.set_mail)
@@ -66,12 +76,13 @@ class Mail_Dialog(QtWidgets.QDialog, Ui_Dialog):
self.comboBox.addItem(template)
def get_greeting(self):
prof = self.profname
if self.gender_male.isChecked():
return "Sehr geehrter Herr"
return f"Sehr geehrter Herr {prof.split(' ')[-1]},"
elif self.gender_female.isChecked():
return "Sehr geehrte Frau"
return f"Sehr geehrte Frau {prof.split(' ')[-1]},"
elif self.gender_non.isChecked():
return "Guten Tag"
return f"Guten Tag {prof},"
def set_mail(self):
email_template = self.comboBox.currentText()
@@ -97,6 +108,7 @@ class Mail_Dialog(QtWidgets.QDialog, Ui_Dialog):
)
self.mail_body.setHtml(mail_html)
self.buttonBox.button(QtWidgets.QDialogButtonBox.Ok).setEnabled(True)
def createAndSendMail(self):
import smtplib
@@ -176,3 +188,10 @@ if __name__ == "__main__":

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'ui\dialogs\mail_preview.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):

View File

@@ -1,4 +1,4 @@
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
from .Ui_medianadder import Ui_Dialog

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file '/home/alexander/GitHub/Semesterapparate/ui/dialogs/new_subject.ui'
#
# Created by: PySide6 UI code generator 6.5.3
# Created by: PyQt6 UI code generator 6.5.3
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
@@ -22,7 +22,12 @@ class Ui_Dialog(object):
self.verticalLayout.addWidget(self.label)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
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.gridLayout.addItem(spacerItem, 0, 1, 1, 1)
self.checkBox = QtWidgets.QCheckBox(parent=Dialog)
self.checkBox.setObjectName("checkBox")
@@ -42,18 +47,27 @@ class Ui_Dialog(object):
self.verticalLayout_2.addWidget(self.frame)
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Dialog)
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.verticalLayout_2.addWidget(self.buttonBox)
self.retranslateUi(Dialog)
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
self.buttonBox.accepted.connect(Dialog.accept) # type: ignore
self.buttonBox.rejected.connect(Dialog.reject) # type: ignore
QtCore.QMetaObject.connectSlotsByName(Dialog)
def retranslateUi(self, Dialog):
_translate = QtCore.QCoreApplication.translate
Dialog.setWindowTitle(_translate("Dialog", "Dialog"))
self.label.setText(_translate("Dialog", "Das eingegebene Fach wurde nicht in der Datenbank gefunden. Soll es angelegt werden?"))
self.label.setText(
_translate(
"Dialog",
"Das eingegebene Fach wurde nicht in der Datenbank gefunden. Soll es angelegt werden?",
)
)
self.checkBox.setText(_translate("Dialog", "Ja"))
self.label_2.setText(_translate("Dialog", "Name des Neuen Faches:"))

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file '/home/alexander/GitHub/Semesterapparate/ui/dialogs/parsed_titles.ui'
#
# Created by: PySide6 UI code generator 6.5.3
# Created by: PyQt6 UI code generator 6.5.3
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
@@ -38,7 +38,12 @@ class Ui_Form(object):
self.label_2 = QtWidgets.QLabel(parent=self.horizontalLayoutWidget)
self.label_2.setObjectName("label_2")
self.horizontalLayout.addWidget(self.label_2)
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.addItem(spacerItem)
self.frame_2 = QtWidgets.QFrame(parent=Form)
self.frame_2.setGeometry(QtCore.QRect(10, 80, 381, 201))
@@ -54,7 +59,9 @@ class Ui_Form(object):
self.listWidget = QtWidgets.QListWidget(parent=self.horizontalLayoutWidget_2)
self.listWidget.setObjectName("listWidget")
self.horizontalLayout_2.addWidget(self.listWidget)
self.listWidget_done = QtWidgets.QListWidget(parent=self.horizontalLayoutWidget_2)
self.listWidget_done = QtWidgets.QListWidget(
parent=self.horizontalLayoutWidget_2
)
self.listWidget_done.setObjectName("listWidget_done")
self.horizontalLayout_2.addWidget(self.listWidget_done)
self.progressBar = QtWidgets.QProgressBar(parent=Form)
@@ -63,7 +70,10 @@ class Ui_Form(object):
self.progressBar.setObjectName("progressBar")
self.buttonBox = QtWidgets.QDialogButtonBox(parent=Form)
self.buttonBox.setGeometry(QtCore.QRect(230, 290, 156, 23))
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.toolButton = QtWidgets.QToolButton(parent=Form)
self.toolButton.setGeometry(QtCore.QRect(20, 290, 25, 19))
@@ -79,3 +89,4 @@ class Ui_Form(object):
self.count.setText(_translate("Form", "0"))
self.label_2.setText(_translate("Form", "Signaturen gefunden."))
self.toolButton.setText(_translate("Form", "..."))

View File

@@ -1,12 +1,12 @@
# Form implementation generated from reading ui file 'ui\dialogs\confirm_extend.ui'
#
# Created by: PySide6 UI code generator 6.3.1
# Created by: PyQt6 UI code generator 6.3.1
#
# WARNING: Any manual changes made to this file will be lost when pyuic6 is
# run again. Do not edit this file unless you know what you are doing.
from PySide6 import QtCore, QtGui, QtWidgets
from PyQt6 import QtCore, QtGui, QtWidgets
class Ui_extend_confirm(object):

View File

@@ -1,5 +1,5 @@
from omegaconf import OmegaConf
from PySide6 import QtWidgets
from PyQt6 import QtWidgets
from src.ui.dialogs.Ui_settings import Ui_Dialog as _settings