various changes, new dialogs

This commit is contained in:
WorldTeacher
2024-06-20 14:55:54 +02:00
parent 9a336e1803
commit aabc38d059
18 changed files with 935 additions and 3669 deletions

View File

@@ -34,7 +34,7 @@ class Mail_Dialog(QtWidgets.QDialog, MailPreviewDialog):
# app_subject,
# prof_name,
)
logger.log_info("Setting up mail dialog")
self.appid = app_id
self.appname = app_name
self.subject = app_subject
@@ -90,7 +90,7 @@ Tel.: 0761/682-778"""
def load_mail_templates(self):
print("loading mail templates")
logger.log_info("Loading mail templates")
mail_templates = os.listdir("mail_vorlagen")
logger.log_info(f"Mail templates: {mail_templates}")
for template in mail_templates:
@@ -109,8 +109,10 @@ Tel.: 0761/682-778"""
return f"Guten Tag {prof},"
def set_mail(self):
logger.log_info("Setting mail")
email_template = self.comboBox.currentText()
if email_template == "":
logger.log_debug("No mail template selected")
return
with open(f"mail_vorlagen/{email_template}", "r", encoding="utf-8") as f:
mail_template = f.read()
@@ -175,23 +177,6 @@ Tel.: 0761/682-778"""
# close the dialog
self.accept()
# # 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_gui(app_id="", app_name="", app_subject="", prof_name="", prof_mail=""):