def delete_safety(self): items = self.tableWidget.selectedItems() for i in items: col = self.tableWidget.column(i) safety = Safety() safe_name = safety.all_name(self.session, self.discipline_name, self.group_number) choosen_safe = safe_name[col - 1] safety.delete(self.session, choosen_safe, self.discipline_name, self.group_number) self.tableWidget.setRowCount(0) pass_safety = PassSafety() table_content: np.ndarray = pass_safety.all( self.session, self.discipline_name, self.group_number) self.tableWidget = set_items_to_table(self.tableWidget, table_content) table_header: list = safety.all_name(self.session, self.discipline_name, self.group_number, flag_header=True) self.tableWidget.setHorizontalHeaderLabels(table_header) self.tableWidget.resizeColumnsToContents() break
def show_journal_safety_window(self): safety = Safety() group_number: str = self.comboBox_2.currentText() discipline_name: str = self.comboBox.currentText() pass_safety = PassSafety() table_content: np.ndarray = pass_safety.all(self.session, discipline_name, group_number) self.journal_safety_ui.tableWidget = set_items_to_table(self.journal_safety_ui.tableWidget, table_content) table_header: list = safety.all_name(self.session, discipline_name, group_number, flag_header=True) self.journal_safety_ui.tableWidget.setHorizontalHeaderLabels(table_header) self.journal_safety_ui.tableWidget.resizeColumnsToContents() self.journal_safety_ui.group_number = group_number self.journal_safety_ui.discipline_name = discipline_name self.journal_safety_ui.label_2.setText(discipline_name) self.journal_safety_ui.label_4.setText(group_number) self.journal_safety_ui.teacher_journal_ui = self.teacher_journal_ui self.journal_safety_ui.teacher_journal_window = self.teacher_journal_window self.journal_safety_ui.journal_attendance_window = self.journal_attendance_window self.journal_safety_ui.journal_attendance_ui = self.journal_attendance_ui self.journal_safety_ui.journal_safety_ui = self.journal_safety_ui self.journal_safety_ui.journal_safety_window = self.journal_safety_window self.journal_safety_window.show()
def show_add_safety_student_window(self): student = Student() s_name = student.show_name(self.session, self.group_number) self.add_safety_student_ui.comboBox.clear() self.add_safety_student_ui.comboBox.addItems(s_name) safety = Safety() safe_name = safety.all_name(self.session, self.discipline_name, self.group_number) self.add_safety_student_ui.comboBox_2.clear() self.add_safety_student_ui.comboBox_2.addItems(safe_name) date_now = self.add_safety_student_ui.dateEdit.date().currentDate() self.add_safety_student_ui.dateEdit.setDate(date_now) self.add_safety_student_ui.group_number = self.group_number self.add_safety_student_ui.discipline_name = self.discipline_name self.add_safety_student_window.show()
def add(self): name: str = self.lineEdit.text() safety = Safety() safety.add(self.session, self.discipline_name, self.group_number, name) pass_safety = PassSafety() table_content: np.ndarray = pass_safety.all(self.session, self.discipline_name, self.group_number) self.table = set_items_to_table(self.table, table_content) table_header: list = safety.all_name(self.session, self.discipline_name, self.group_number, flag_header=True) self.table.setHorizontalHeaderLabels(table_header) self.table.resizeColumnsToContents() self.add_safety_window.close()
def show_update_safety_student_window(self): items = self.tableWidget.selectedItems() for i in items: row = self.tableWidget.row(i) col = self.tableWidget.column(i) fio = self.tableWidget.item(row, 0).text() date = self.tableWidget.item(row, col).text() date = str_to_date_2(date) self.update_safety_student_ui.dateEdit.setDate(date) safety = Safety() safe_name = safety.all_name(self.session, self.discipline_name, self.group_number) choosen_safe = safe_name[col - 1] self.update_safety_student_ui.label_4.setText(fio) self.update_safety_student_ui.label_5.setText(choosen_safe) break self.update_safety_student_ui.group_number = self.group_number self.update_safety_student_ui.discipline_name = self.discipline_name self.update_safety_student_window.show()