bump files

This commit is contained in:
WorldTeacher
2024-11-05 16:22:56 +01:00
parent f3eed7486d
commit c3ff63ac70
12 changed files with 155 additions and 55 deletions

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\semesterapparat_ui.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.
@@ -160,6 +160,9 @@ class Ui_MainWindow(object):
self.avail_status = QtWidgets.QLabel(parent=self.gridLayoutWidget_2)
self.avail_status.setObjectName("avail_status")
self.horizontalLayout_5.addWidget(self.avail_status)
self.automation_add_selected_books = QtWidgets.QPushButton(parent=self.gridLayoutWidget_2)
self.automation_add_selected_books.setObjectName("automation_add_selected_books")
self.horizontalLayout_5.addWidget(self.automation_add_selected_books)
spacerItem5 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.horizontalLayout_5.addItem(spacerItem5)
self.gridLayout_2.addLayout(self.horizontalLayout_5, 4, 0, 1, 1)
@@ -581,6 +584,13 @@ class Ui_MainWindow(object):
self.valid_check_telnr.setText("")
self.valid_check_telnr.setAutoRaise(True)
self.valid_check_telnr.setObjectName("valid_check_telnr")
self.pushButton = QtWidgets.QPushButton(parent=self.app_group_box)
self.pushButton.setGeometry(QtCore.QRect(270, 180, 161, 24))
font = QtGui.QFont()
font.setPointSize(9)
font.setBold(False)
self.pushButton.setFont(font)
self.pushButton.setObjectName("pushButton")
self.gridLayout_2.addWidget(self.app_group_box, 1, 0, 1, 1)
self.add_medium = QtWidgets.QPushButton(parent=self.createApparat)
self.add_medium.setGeometry(QtCore.QRect(3, 695, 121, 20))
@@ -805,6 +815,8 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.btn_reserve, self.select_action_box)
MainWindow.setTabOrder(self.select_action_box, self.prof_id_adis)
MainWindow.setTabOrder(self.prof_id_adis, self.apparat_id_adis)
MainWindow.setTabOrder(self.apparat_id_adis, self.automation_add_selected_books)
MainWindow.setTabOrder(self.automation_add_selected_books, self.pushButton)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
@@ -832,6 +844,7 @@ class Ui_MainWindow(object):
self.progress_label.setText(_translate("MainWindow", "Medium x/y"))
self.label_20.setText(_translate("MainWindow", "Medien werden geprüft"))
self.avail_status.setText(_translate("MainWindow", "TextLabel"))
self.automation_add_selected_books.setText(_translate("MainWindow", "Ausgewählte als verfügbar markieren"))
self.tableWidget_apparat_media.setSortingEnabled(True)
item = self.tableWidget_apparat_media.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Buchtitel"))
@@ -891,6 +904,7 @@ class Ui_MainWindow(object):
self.label_6.setText(_translate("MainWindow", "Semester"))
self.valid_check_profname.setStatusTip(_translate("MainWindow", "Format: Nachname, Vorname"))
self.valid_check_mail.setStatusTip(_translate("MainWindow", "mail@irgendwas.wasanderes"))
self.pushButton.setText(_translate("MainWindow", "Speichern und anlegen"))
self.add_medium.setText(_translate("MainWindow", "Medien hinzufügen"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.createApparat), _translate("MainWindow", "Anlegen"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.search_statistics), _translate("MainWindow", "Suchen / Statistik"))

50
src/ui/Ui_switchtest.py Normal file
View File

@@ -0,0 +1,50 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\switchtest.ui'
#
# Created by: PyQt6 UI code generator 6.6.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 PyQt6 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.setWindowModality(QtCore.Qt.WindowModality.WindowModal)
MainWindow.resize(800, 600)
self.centralwidget = QtWidgets.QWidget(parent=MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.select_action_box = QtWidgets.QComboBox(parent=self.centralwidget)
self.select_action_box.setFocusPolicy(QtCore.Qt.FocusPolicy.NoFocus)
self.select_action_box.setObjectName("select_action_box")
self.select_action_box.addItem("")
self.select_action_box.addItem("")
self.select_action_box.addItem("")
self.select_action_box.addItem("")
self.verticalLayout.addWidget(self.select_action_box)
self.localwidget = QtWidgets.QWidget(parent=self.centralwidget)
self.localwidget.setObjectName("localwidget")
self.verticalLayout.addWidget(self.localwidget)
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(parent=MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 800, 22))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(parent=MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.select_action_box.setItemText(0, _translate("MainWindow", "Aktion auswählen"))
self.select_action_box.setItemText(1, _translate("MainWindow", "edit_prof"))
self.select_action_box.setItemText(2, _translate("MainWindow", "add_user"))
self.select_action_box.setItemText(3, _translate("MainWindow", "edit_user"))

View File

@@ -1,19 +1,36 @@
import os
import sys
from omegaconf import OmegaConf
from PyQt6 import QtCore, QtGui, QtWidgets
from src import Icon
from src import Icon, settings as config
from src.logic.log import MyLogger
from .dialog_sources.Ui_mail_preview import Ui_eMailPreview as MailPreviewDialog
from .mailTemplate import MailTemplateDialog
config = OmegaConf.load("config.yaml")
logger = MyLogger("Mail")
empty_signature = """<!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
type="text/css">
p, li { white-space: pre-wrap; }
hr { height: 1px; border-width: 0; }
li.unchecked::marker { content: "\2610"; }
li.checked::marker { content: "\2612"; }
</style></head><body style=" font-family:''Segoe UI''; font-size:9pt; font-weight:400;
font-style:normal;">
<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>
"""
class Mail_Dialog(QtWidgets.QDialog, MailPreviewDialog):
def __init__(
@@ -73,11 +90,11 @@ class Mail_Dialog(QtWidgets.QDialog, MailPreviewDialog):
pass
def determine_signature(self):
if config.mail.signature is None:
if config.mail.signature is empty_signature or config.mail.signature == "":
return """Mit freundlichen Grüßen
Ihr Semesterapparatsteam
Mail: semesterapparate@ph-freiburg.de
Tel.: 0761/682-778"""
Tel.: 0761/682-778 | 07617682-545"""
else:
return config.mail.signature
@@ -140,10 +157,10 @@ Tel.: 0761/682-778"""
tolist = [self.prof_mail, "semesterapparate@ph-freiburg.de"]
self.btn_okay.setText("Mail wird gesendet")
smtp_server = config["mail"]["smtp_server"]
port: int = config["mail"]["port"]
sender_email = config["mail"]["sender"]
password = config["mail"]["password"]
smtp_server = config.mail.smtp_server
port: int = config.mail.port
sender_email = config.mail.sender
password = config.mail.password
message = MIMEMultipart()
message["From"] = sender_email
message["To"] = self.prof_mail
@@ -155,18 +172,21 @@ Tel.: 0761/682-778"""
message.attach(MIMEText(mail_body, "html"))
mail = message.as_string()
server = smtplib.SMTP_SSL(smtp_server, port)
# server.starttls()
with smtplib.SMTP_SSL(smtp_server, port) as server:
server.connect(smtp_server, port)
# server.connect(smtp_server, port)
# server.auth(mechanism="PLAIN")
if config["mail"]["use_user_name"] is True:
# print(config["mail"]["user_name"])
server.login(config["mail"]["user_name"], password)
else:
server.login(sender_email, password)
server.sendmail(sender_email, tolist, mail)
if config.mail.use_user_name is True:
# print(config["mail"]["user_name"])
server.login(config.mail.user_name, password)
else:
server.login(sender_email, password)
server.sendmail(sender_email, tolist, mail)
# print("Mail sent")
# end active process
server.quit()
server.quit()
logger.log_info("Mail sent, closing connection to server and dialog")
# close the dialog

View File

@@ -201,7 +201,7 @@ Content-Transfer-Encoding: 8bit
# warning dialog
Icon("template_fail", self.testTemplate)
dialog = QtWidgets.QMessageBox()
dialog.setIcon(Icon("warning").icon)
Icon("warning", dialog)
dialog.setText("Folgende Platzhalter fehlen im Template:")

View File

@@ -74,7 +74,7 @@
<enum>Qt::NoFocus</enum>
</property>
<property name="currentIndex">
<number>2</number>
<number>0</number>
</property>
<widget class="QWidget" name="createApparat">
<property name="sizePolicy">
@@ -362,6 +362,13 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="automation_add_selected_books">
<property name="text">
<string>Ausgewählte als verfügbar markieren</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
@@ -1477,6 +1484,25 @@
<bool>true</bool>
</property>
</widget>
<widget class="QPushButton" name="pushButton">
<property name="geometry">
<rect>
<x>270</x>
<y>180</y>
<width>161</width>
<height>24</height>
</rect>
</property>
<property name="font">
<font>
<pointsize>9</pointsize>
<bold>false</bold>
</font>
</property>
<property name="text">
<string>Speichern und anlegen</string>
</property>
</widget>
</widget>
</item>
</layout>
@@ -1951,6 +1977,8 @@
<tabstop>select_action_box</tabstop>
<tabstop>prof_id_adis</tabstop>
<tabstop>apparat_id_adis</tabstop>
<tabstop>automation_add_selected_books</tabstop>
<tabstop>pushButton</tabstop>
</tabstops>
<resources>
<include location="../../resources.qrc"/>

View File

@@ -4,23 +4,19 @@ import os
import sys
import tempfile
import time
import webbrowser
from pathlib import Path
import threading
from icecream import ic
from natsort import natsorted
from omegaconf import OmegaConf
from PyQt6 import QtCore, QtGui, QtWidgets
from PyQt6.QtCore import QDate, QThread
from PyQt6.QtCore import QThread
from PyQt6.QtGui import QRegularExpressionValidator
from src import Icon
from src import Icon, settings
from src.backend import (
Database,
generateSemesterByDate,
recreateFile,
tempdelete,
)
@@ -57,7 +53,6 @@ from src.ui import (
EditProf
)
config = OmegaConf.load("config.yaml")
valid_input = (0, 0, 0, 0, 0, 0)
@@ -634,8 +629,10 @@ class Ui(Ui_Semesterapparat):
self.dokument_list.setItem(0, 1, QtWidgets.QTableWidgetItem(file[1]))
self.dokument_list.setItem(0, 2, QtWidgets.QTableWidgetItem(""))
self.dokument_list.setItem(0, 3, QtWidgets.QTableWidgetItem("Database"))
self.dokument_list.item(0, 0).setToolTip(file[0])
def btn_create_new_apparat(self):
self.frame_creation_progress.show()
self.groupBox.show()
self.groupBox_2.show()
global valid_input
@@ -655,6 +652,7 @@ class Ui(Ui_Semesterapparat):
self.app_fach.setEnabled(True)
self.check_send_mail.show()
self.check_file.setEnabled(False)
self.drpdwn_app_nr.setFocus()
if self.tableWidget_apparat_media.rowCount() > 0:
self.tableWidget_apparat_media.setRowCount(0)
# clear all fields
@@ -685,10 +683,6 @@ class Ui(Ui_Semesterapparat):
self.label_info.hide()
def btn_add_medium(self):
if not self.app_group_box.isEnabled():
self.confirm_popup("Bitte erst einen Apparat auswählen!", title="Fehler")
return
media = medienadder_ui()
media.exec()
mode = media.mode
@@ -726,7 +720,7 @@ class Ui(Ui_Semesterapparat):
# print("waiting for thread to finish")
QtWidgets.QApplication.processEvents()
self.__clear_fields()
# self.__clear_fields()
else:
return
@@ -934,7 +928,7 @@ class Ui(Ui_Semesterapparat):
self.dokument_list.setItem(0, 3, QtWidgets.QTableWidgetItem(file))
# set tooltip of row 3 to the file path for each row
self.dokument_list.item(0, 3).setToolTip(file)
self.dokument_list.item(0, 0).setToolTip(filename)
def open_document(self):
_selected_doc_name = ""
@@ -967,10 +961,6 @@ class Ui(Ui_Semesterapparat):
recreateFile(
_selected_doc_name, self.active_apparat, filetype=_selected_doc_filetype
)
# # if ~ in path, replace it with the home directory
# if "~" in path:
# path = path.replace("~", str(Path.home()))
# path = Path(path)
def add_media_from_file(self):
app_id = self.active_apparat
@@ -1391,16 +1381,15 @@ class Ui(Ui_Semesterapparat):
dialog.repaintSignal.connect(lambda: self.calendarWidget.reload(selected_date))
def open_settings(self):
settings = Settings(self.active_user)
settings.exec()
if settings.result() == QtWidgets.QDialog.DialogCode.Accepted:
data = settings.return_data()
# print(data)
OmegaConf.save(data, "config.yaml")
# re-load the config
OmegaConf.load("config.yaml")
self.logger.log_info("Saved settings to config.yaml")
self.reload()
print(settings.dict())
settingsUI = Settings(self.active_user)
settingsUI.exec()
if settingsUI.result() == QtWidgets.QDialog.DialogCode.Accepted:
settingsUI.save()
print(settings.dict())
# self.reload()
def reload(self):
state = self.confirm_popup(
@@ -1477,7 +1466,6 @@ class Ui(Ui_Semesterapparat):
if state == 1:
self.db.deleteBook(book_id)
self.update_app_media_list()
self.contact_prof(mail="deleted", location="")
pass
else:
# get all selected rows

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\widgets\widget_sources\admin_create_user.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\widgets\widget_sources\admin_edit_prof.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\widgets\widget_sources\admin_edit_user.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\widgets\widget_sources\calendar_entry.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\widgets\widget_sources\elsa_maindialog.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.

View File

@@ -1,6 +1,6 @@
# Form implementation generated from reading ui file 'c:\Users\aky547\GitHub\SemesterapparatsManager\src\ui\widgets\widget_sources\search_statistic_page.ui'
#
# Created by: PyQt6 UI code generator 6.6.1
# Created by: PyQt6 UI code generator 6.7.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.