ui changes, formatting

This commit is contained in:
WorldTeacher
2024-06-05 15:39:55 +02:00
parent 98849f22a0
commit a56c70a8b4
26 changed files with 1163 additions and 402 deletions

View File

@@ -151,11 +151,12 @@ class Ui(Ui_Semesterapparat):
QtWidgets.QHeaderView.ResizeMode.Stretch
)
self.tableWidget_apparate.setSortingEnabled(True)
# self.tableWidget_apparate.text
self.actionEinstellungen.triggered.connect(self.open_settings)
# if help>documentation is clicked, open the documentation or shortcut is pressed
self.actionDokumentation.triggered.connect(self.open_documentation)
# Actions
self.actionEinstellungen.triggered.connect(self.open_settings)
self.actionDokumentation.triggered.connect(self.open_documentation)
Icon("offAction", self.actionBeenden)
self.actionBeenden.triggered.connect(self.quit)
# set validators
self.sem_year.setText(str(QtCore.QDate.currentDate().year()))
self.prof_mail.setValidator(
@@ -256,7 +257,6 @@ class Ui(Ui_Semesterapparat):
# if tab is changed, gather data needed
self.tabWidget.currentChanged.connect(self.tab_changed)
self.btn_search.clicked.connect(self.statistics)
# self.thread_check()
### Admin interface ###
self.select_action_box.addItem("")
@@ -293,7 +293,8 @@ class Ui(Ui_Semesterapparat):
self.elsa_save.clicked.connect(self.save_elsa)
self.elsa_date_today.clicked.connect(self.generateTodayDateElsa)
self.active_semester.clicked.connect(self.addSemester)
Icon("semap").set_icon(self.active_semester)
Icon("semester", self.active_semester)
Icon("today", self.elsa_date_today)
self.elsa_table.doubleClicked.connect(self.open_elsa)
self.btn_add_document_elsa.clicked.connect(self.addDokumentElsa)
self.check_file_elsa.clicked.connect(self.parseDokumentElsa)
@@ -311,6 +312,11 @@ class Ui(Ui_Semesterapparat):
self.mail_thread = None
self.autoGrabber = None
def quit(self):
# delete all temporary files
delete_temp_contents()
sys.exit()
def add_new_elsa(self):
self.create_frame_elsa.setEnabled(True)
self.elsa_cancel_create.setEnabled(True)
@@ -918,7 +924,6 @@ class Ui(Ui_Semesterapparat):
created_status.setToolTip("Doppelklick um den Semesterapparat zu öffnen")
deleted_status.setToolTip("Nur zur Übersicht")
# set deleted_status background to slightly gray
deleted_status.setStyleSheet("background-color: #f0f0f0")
def open_apparat(self, header: str, apparat: str, parent_depth: int):
print(header)
@@ -1240,13 +1245,13 @@ class Ui(Ui_Semesterapparat):
self.cancel_active_selection.setEnabled(False)
def confirm_popup(self, message: str):
dial = QtWidgets.QDialog()
popup = popus_confirm()
popup.setupUi(dial)
popup.setupUi()
popup.textEdit.setReadOnly(True)
popup.textEdit.setText(message)
dial.exec()
return dial.result()
popup.exec()
return popup.result()
def threads(self):
while True:
@@ -2170,6 +2175,7 @@ class Ui(Ui_Semesterapparat):
appnr = message["appnr"]
appnr = "/" if appnr is None else str(appnr)
self.line_app_info.setText(appnr)
def __delete_message():
message = messages[self.spin_select_message.value() - 1]
self.db.deleteMessage(message["id"])
@@ -2341,28 +2347,33 @@ class Ui(Ui_Semesterapparat):
return
def contact_prof(self, apparat=None, mail=""):
print(apparat)
if self.active_apparat == "":
if apparat is None:
if apparat is False:
self.confirm_popup("Bitte erst einen Apparat auswählen!")
return
if apparat:
active_apparat_id = apparat
else:
# TODO: stuff
pass
else:
active_apparat_id = self.drpdwn_app_nr.currentText()
print(active_apparat_id)
profname = self.drpdwn_prof_name.currentText().replace(",", "").split(" ")
profname = f"{profname[1]} {profname[0]}"
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
pmail = self.db.getSpecificProfData(prof_id, ["mail"])
# create a new thread to show the mail interface and send the mail
self.mail_thread = Mail_Dialog(
app_id=active_apparat_id,
prof_name=profname,
prof_mail=pmail,
app_name=self.app_name.text(),
app_subject=self.app_fach.currentText(),
)
self.mail_thread.show()
if apparat:
active_apparat_id = apparat
else:
active_apparat_id = self.drpdwn_app_nr.currentText()
print(active_apparat_id)
profname = self.drpdwn_prof_name.currentText().replace(",", "").split(" ")
profname = f"{profname[1]} {profname[0]}"
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
pmail = self.db.getSpecificProfData(prof_id, ["mail"])
# create a new thread to show the mail interface and send the mail
self.mail_thread = Mail_Dialog(
app_id=active_apparat_id,
prof_name=profname,
prof_mail=pmail,
app_name=self.app_name.text(),
app_subject=self.app_fach.currentText(),
)
self.mail_thread.show()
def delete_apparat(self):
selected_apparat_id = self.tableWidget_apparate.item(