update to files
This commit is contained in:
@@ -161,8 +161,6 @@ class Ui(Ui_Semesterapparat):
|
||||
self.calendarWidget.setObjectName("MessageCalendar")
|
||||
self.calendarWidget.clicked.connect(self.open_reminder)
|
||||
# assign a context menu to the calendar
|
||||
self.calendarWidget.setContextMenuPolicy(QtCore.Qt.ContextMenuPolicy.CustomContextMenu)
|
||||
self.calendarWidget.customContextMenuRequested.connect(self.calendar_context_menu)
|
||||
|
||||
self.tableWidget_apparat_media.horizontalHeader().setSectionResizeMode(
|
||||
QtWidgets.QHeaderView.ResizeMode.Stretch
|
||||
@@ -839,7 +837,7 @@ class Ui(Ui_Semesterapparat):
|
||||
appdata = ApparatData()
|
||||
appdata.app_fach = self.app_fach.currentText()
|
||||
appdata.appname = self.app_name.text()
|
||||
appdata.appnr = self.active_apparat()
|
||||
appdata.appnr = self.active_apparat
|
||||
appdata.dauerapp = self.check_eternal_app.isChecked()
|
||||
appdata.prof_mail = self.prof_mail.text()
|
||||
appdata.prof_tel = self.prof_tel_nr.text()
|
||||
@@ -1037,7 +1035,7 @@ class Ui(Ui_Semesterapparat):
|
||||
self.update_documemt_list()
|
||||
|
||||
def update_documemt_list(self):
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
prof_id = self.db.getProfId(
|
||||
self.drpdwn_prof_name.currentText().replace(", ", " ")
|
||||
)
|
||||
@@ -1129,7 +1127,7 @@ class Ui(Ui_Semesterapparat):
|
||||
if data == []:
|
||||
self.confirm_popup("Bitte mindestens ein Medium hinzufügen!")
|
||||
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
|
||||
# check if app_id is in database
|
||||
if not self.db.checkApparatExists(app_id):
|
||||
@@ -1195,13 +1193,13 @@ class Ui(Ui_Semesterapparat):
|
||||
self.avail_status.setText(f"0/{items}")
|
||||
self.avail_status.show()
|
||||
books = self.db.getBooks(
|
||||
self.active_apparat(),
|
||||
self.active_apparat,
|
||||
self.db.getProfId(self.drpdwn_prof_name.currentText()),
|
||||
deleted=0,
|
||||
)
|
||||
|
||||
# thread = QThread()
|
||||
appnumber = self.active_apparat()
|
||||
appnumber = self.active_apparat
|
||||
print(links)
|
||||
availcheck = AvailChecker(links, appnumber, books=books)
|
||||
# availcheck.moveToThread(thread)
|
||||
@@ -1227,7 +1225,7 @@ class Ui(Ui_Semesterapparat):
|
||||
|
||||
def update_app_media_list(self):
|
||||
deleted = 0 if not self.chkbx_show_del_media.isChecked() else 1
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
|
||||
books: list[dict[int, BookData, int]] = self.db.getBooks(
|
||||
app_id, prof_id, deleted
|
||||
@@ -1315,7 +1313,7 @@ class Ui(Ui_Semesterapparat):
|
||||
pass
|
||||
|
||||
def text_to_clipboard(self):
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
text = f"SQ=select distinct akkey from aupr01 where aufst='{app_id}' union select pr_isn from aks4pd where akruf ='{app_id}'"
|
||||
clipboard = QtWidgets.QApplication.clipboard()
|
||||
clipboard.setText(text)
|
||||
@@ -1344,7 +1342,7 @@ class Ui(Ui_Semesterapparat):
|
||||
# set tooltip of row 3 to the file path for each row
|
||||
self.dokument_list.item(0, 3).setToolTip(file)
|
||||
|
||||
# self.db.insert_file(files, self.active_apparat(), self.db.get_prof_id(self.drpdwn_prof_name.currentText()))
|
||||
# self.db.insert_file(files, self.active_apparat, self.db.get_prof_id(self.drpdwn_prof_name.currentText()))
|
||||
|
||||
def open_document(self):
|
||||
_selected_doc_name = ""
|
||||
@@ -1372,7 +1370,7 @@ class Ui(Ui_Semesterapparat):
|
||||
path = path.resolve()
|
||||
os.system(f"open {path}")
|
||||
else:
|
||||
recreateFile(_selected_doc_name,self.active_apparat() ,filetype=_selected_doc_filetype)
|
||||
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()))
|
||||
@@ -1424,7 +1422,7 @@ class Ui(Ui_Semesterapparat):
|
||||
delete=False, suffix="." + file_type
|
||||
)
|
||||
temp_file.write(
|
||||
self.db.getBlob(file_name, int(self.active_apparat()))
|
||||
self.db.getBlob(file_name, int(self.active_apparat))
|
||||
)
|
||||
temp_file.close()
|
||||
file = temp_file.name
|
||||
@@ -1437,7 +1435,7 @@ class Ui(Ui_Semesterapparat):
|
||||
signatures = csv_to_list(file)
|
||||
data = __open_dialog(signatures)
|
||||
# get the app_id and prof_id
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
|
||||
# add the data to the database
|
||||
for book in data:
|
||||
@@ -1458,7 +1456,7 @@ class Ui(Ui_Semesterapparat):
|
||||
if data == []:
|
||||
return
|
||||
# get the app_id and prof_id
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
|
||||
# add the data to the database
|
||||
for book in data:
|
||||
@@ -1477,7 +1475,7 @@ class Ui(Ui_Semesterapparat):
|
||||
self.tableWidget_apparate.setToolTip(
|
||||
"Bitte warten, bis alle Medien hinzugefügt wurden"
|
||||
)
|
||||
app_id = self.active_apparat()
|
||||
app_id = self.active_apparat
|
||||
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
|
||||
# check if apparat in database
|
||||
|
||||
@@ -1583,7 +1581,7 @@ class Ui(Ui_Semesterapparat):
|
||||
self.confirm_popup("Bitte alle Pflichtfelder ausfüllen!")
|
||||
return
|
||||
appd = ApparatData()
|
||||
appd.appnr = self.active_apparat()
|
||||
appd.appnr = self.active_apparat
|
||||
appd.prof_title = (
|
||||
None
|
||||
if self.prof_title.text() == ""
|
||||
@@ -1616,7 +1614,12 @@ class Ui(Ui_Semesterapparat):
|
||||
# self.btn_load_apparat()
|
||||
|
||||
__clear_fields()
|
||||
|
||||
if self.check_send_mail.isChecked():
|
||||
self.contact_prof()
|
||||
|
||||
def send_mail_preview(self):
|
||||
pass
|
||||
@property
|
||||
def active_apparat(self):
|
||||
return self.drpdwn_app_nr.currentText()
|
||||
|
||||
@@ -1632,7 +1635,7 @@ class Ui(Ui_Semesterapparat):
|
||||
}
|
||||
)
|
||||
self.dokument_list.item(i, 2).setText("")
|
||||
self.db.insertFile(files, self.active_apparat(), self.db.getProfId(self.drpdwn_prof_name.currentText()))
|
||||
self.db.insertFile(files, self.active_apparat, self.db.getProfId(self.drpdwn_prof_name.currentText()))
|
||||
|
||||
def update_apparat_list(self):
|
||||
# get a list of new apparats based on self.apparats and self.old_apparats
|
||||
@@ -1681,14 +1684,7 @@ class Ui(Ui_Semesterapparat):
|
||||
)
|
||||
self.logger.log_info(f"Inserted apparat {apparat[4]}")
|
||||
|
||||
def calendar_context_menu(self):
|
||||
# create a context menu for the calendar
|
||||
menu = QtWidgets.QMenu()
|
||||
create_reminder = menu.addAction("Erinnerung erstellen")
|
||||
create_reminder.triggered.connect(self.reminder(date=self.calendarWidget.selectedDate().toString("yyyy-MM-dd")))
|
||||
menu.exec(QtGui.QCursor.pos())
|
||||
return menu
|
||||
|
||||
|
||||
def open_context_menu(self, position):
|
||||
menu = QtWidgets.QMenu()
|
||||
extend_action = menu.addAction("Verlängern")
|
||||
@@ -1715,7 +1711,7 @@ class Ui(Ui_Semesterapparat):
|
||||
self.db.addMessage(
|
||||
data,
|
||||
self.active_user,
|
||||
self.active_apparat if self.active_apparat() != "" else None,
|
||||
self.active_apparat if self.active_apparat != "" else None,
|
||||
)
|
||||
self.calendarWidget.setMessages([data])
|
||||
self.calendarWidget.updateCells()
|
||||
@@ -1739,8 +1735,10 @@ class Ui(Ui_Semesterapparat):
|
||||
self.message_frame.hide()
|
||||
return
|
||||
self.message_box.setText(message["message"])
|
||||
appnr = message["appnr"]
|
||||
appnr = "/" if appnr is None else str(appnr)
|
||||
self.line_app_info.setText(
|
||||
message["appnr"] if message["appnr"] != None else "/"
|
||||
appnr
|
||||
)
|
||||
|
||||
def __delete_message():
|
||||
@@ -1751,6 +1749,7 @@ class Ui(Ui_Semesterapparat):
|
||||
self.spin_select_message.setMaximum(len(messages))
|
||||
self.spin_select_message.setValue(1)
|
||||
self.label_total_day_messages.setText("/ " + str(len(messages)))
|
||||
|
||||
|
||||
selected_date = self.calendarWidget.selectedDate().toString("yyyy-MM-dd")
|
||||
print(selected_date)
|
||||
@@ -1812,11 +1811,11 @@ class Ui(Ui_Semesterapparat):
|
||||
self.tableWidget_apparat_media.currentRow(), 1
|
||||
).text()
|
||||
data = self.db.getBookBasedOnSignature(
|
||||
app_id=self.active_apparat(),
|
||||
app_id=self.active_apparat,
|
||||
signature=book,
|
||||
prof_id=self.db.getProfId(self.drpdwn_prof_name.currentText()),
|
||||
)
|
||||
book_id = self.db.getBookIdBasedOnSignature(self.active_apparat(),self.db.getProfId(self.drpdwn_prof_name.currentText()),book)
|
||||
book_id = self.db.getBookIdBasedOnSignature(self.active_apparat,self.db.getProfId(self.drpdwn_prof_name.currentText()),book)
|
||||
widget = QtWidgets.QDialog()
|
||||
bookedit = edit_bookdata_ui()
|
||||
bookedit.setupUi(widget)
|
||||
@@ -1907,34 +1906,36 @@ class Ui(Ui_Semesterapparat):
|
||||
return
|
||||
|
||||
def contact_prof(self):
|
||||
if self.active_apparat == "":
|
||||
self.confirm_popup("Bitte erst einen Apparat auswählen!")
|
||||
return
|
||||
dialog = QtWidgets.QDialog()
|
||||
mail_prev = Mail_Dialog()
|
||||
mail_prev.setupUi(dialog)
|
||||
mail_prevs = os.listdir("mail_vorlagen")
|
||||
if self.app_name.text() == "":
|
||||
mail_prevs.remove("Information zum Semesterapparat.eml")
|
||||
mail_prev.comboBox.addItems(mail_prevs)
|
||||
active_apparat_id = self.tableWidget_apparate.item(
|
||||
self.tableWidget_apparate.currentRow(), 0
|
||||
).text()
|
||||
general_data = {
|
||||
"Appname": self.app_name.text(),
|
||||
"AppName": self.app_name.text(),
|
||||
"AppSubject": self.app_fach.currentText(),
|
||||
"appnr": active_apparat_id,
|
||||
"AppNr": active_apparat_id,
|
||||
}
|
||||
print(active_apparat_id)
|
||||
mail_prev.appid = active_apparat_id
|
||||
base_data = self.db.getProfData(id=active_apparat_id)
|
||||
profname = self.db.getProfNameById(base_data["id"])
|
||||
profname = self.drpdwn_prof_name.currentText().replace(",", "")
|
||||
profname = profname.split(" ")
|
||||
profname = f"{profname[1]} {profname[0]}"
|
||||
prof_id = self.db.getProfId(self.drpdwn_prof_name.currentText())
|
||||
mail = self.db.getSpecificProfData(prof_id, ["mail"])
|
||||
pass_data = {
|
||||
"prof_name": profname,
|
||||
"mail_name": base_data["prof_mail"],
|
||||
"mail_name": mail,
|
||||
"general": general_data,
|
||||
}
|
||||
|
||||
mail_prev.set_data(pass_data)
|
||||
mail_prev = Mail_Dialog(app_id = self.active_apparat,data = pass_data,app_name = self.app_name.text(),app_subject = self.app_fach.currentText())
|
||||
mail_prev.setupUi(dialog)
|
||||
mail_prev.comboBox.addItems(mail_prevs)
|
||||
mail_prev.set_mail()
|
||||
dialog.exec()
|
||||
|
||||
@@ -1987,7 +1988,7 @@ def launch_gui():
|
||||
|
||||
print(aui.active_user)
|
||||
MainWindow.show()
|
||||
atexit.register()
|
||||
# atexit.register()
|
||||
atexit.register(delete_temp_contents)
|
||||
atexit.register(aui.validate_thread.quit)
|
||||
sys.exit(app.exec())
|
||||
|
||||
Reference in New Issue
Block a user