def show_add_class_once_window(self): discipline = Discipline() d_name = discipline.show_name(self.session) self.add_class_once_ui.comboBox.clear() self.add_class_once_ui.comboBox.addItems(d_name) c = ClassFormat() c_name = c.show_name(self.session) self.add_class_once_ui.comboBox_2.clear() self.add_class_once_ui.comboBox_2.addItems(c_name) group = Group() ls_name = group.show_name(self.session) self.add_class_once_ui.comboBox_4.clear() self.add_class_once_ui.comboBox_4.addItems(ls_name) a = Audience() a_name = a.show_name(self.session) self.add_class_once_ui.comboBox_3.clear() self.add_class_once_ui.comboBox_3.addItems(a_name) date_now = self.add_class_once_ui.dateEdit.date().currentDate() self.add_class_once_ui.dateEdit.setDate(date_now) time_now = self.add_class_once_ui.timeEdit.time().currentTime() self.add_class_once_ui.timeEdit.setTime(time_now) self.add_class_once_window.show()
def delete(self): items = self.tableWidget.selectedItems() for i in items: row = self.tableWidget.row(i) name = self.tableWidget.item(row, 0).text() c = ClassFormat() c.delete(self.session, name) self.tableWidget.removeRow(row)
def show_training_formats_list_window(self): class_format = ClassFormat() ls_all = class_format.show_all(self.session) ls_all = np.array(ls_all) self.training_formats_list_ui.tableWidget = set_items_to_table( self.training_formats_list_ui.tableWidget, ls_all) self.training_formats_list_ui.tableWidget.resizeColumnsToContents() self.training_formats_list_window.show()
def update(self): c = ClassFormat() name = self.lineEdit.text() c.update(self.session, self.update_value, name) self.table.setItem(self.row, 0, QtWidgets.QTableWidgetItem(name)) self.table.resizeColumnsToContents() self.update_training_formats_window.close()
def add(self): class_format = ClassFormat() name = self.lineEdit.text() class_format.add(self.session, name) ls_all = class_format.show_all(self.session) ls_all = np.array(ls_all) self.table = set_items_to_table(self.table, ls_all) self.table.resizeColumnsToContents() self.add_training_formats_window.close()
def show_add_class_window(self): discipline = Discipline() d_name = discipline.show_name(self.session) self.add_class_ui.comboBox.clear() self.add_class_ui.comboBox.addItems(d_name) group = Group() ls_name = group.show_name(self.session) self.add_class_ui.comboBox_6.clear() self.add_class_ui.comboBox_6.addItems(ls_name) c = ClassFormat() c_name = c.show_name(self.session) self.add_class_ui.comboBox_2.clear() self.add_class_ui.comboBox_2.addItems(c_name) a = Audience() a_name = a.show_name(self.session) self.add_class_ui.comboBox_5.clear() self.add_class_ui.comboBox_5.addItems(a_name) s = Settings() schedule_format = s.get(self.session) if schedule_format == 0: s_name = ['Каждую неделю'] else: s_name = ['Каждую неделю', '1-ая неделя', '2-ая неделя'] self.add_class_ui.comboBox_4.clear() self.add_class_ui.comboBox_4.addItems(s_name) date_now = self.add_class_ui.dateEdit.date().currentDate() self.add_class_ui.dateEdit.setDate(date_now) self.add_class_ui.dateEdit_2.setDate(date_now) time_now = self.add_class_ui.timeEdit.time().currentTime() self.add_class_ui.timeEdit.setTime(time_now) self.add_class_window.show()
def show_update_window(self): discipline = Discipline() d_name = discipline.show_name(self.session) self.update_class_ui.comboBox.clear() self.update_class_ui.comboBox.addItems(d_name) group = Group() ls_name = group.show_name(self.session) self.update_class_ui.comboBox_3.clear() self.update_class_ui.comboBox_3.addItems(ls_name) c = ClassFormat() c_name = c.show_name(self.session) self.update_class_ui.comboBox_2.clear() self.update_class_ui.comboBox_2.addItems(c_name) a = Audience() a_name = a.show_name(self.session) self.update_class_ui.comboBox_4.clear() self.update_class_ui.comboBox_4.addItems(a_name) items_1 = self.tableWidget.selectedItems() items_2 = self.tableWidget_2.selectedItems() items_3 = self.tableWidget_3.selectedItems() items_4 = self.tableWidget_4.selectedItems() items_5 = self.tableWidget_5.selectedItems() items_6 = self.tableWidget_6.selectedItems() for i in items_1: row = self.tableWidget.row(i) time_item = self.tableWidget.item(row, 0).text() discipline = self.tableWidget.item(row, 1).text() group = self.tableWidget.item(row, 3).text() o = Occupation update_value = o.get(self.session, time_item, discipline, group) for i in items_2: row = self.tableWidget_2.row(i) time_item = self.tableWidget_2.item(row, 0).text() discipline = self.tableWidget_2.item(row, 1).text() group = self.tableWidget_2.item(row, 3).text() o = Occupation update_value = o.get(self.session, time_item, discipline, group) for i in items_3: row = self.tableWidget_3.row(i) time_item = self.tableWidget_3.item(row, 0).text() discipline = self.tableWidget_3.item(row, 1).text() group = self.tableWidget_3.item(row, 3).text() o = Occupation update_value = o.get(self.session, time_item, discipline, group) for i in items_4: row = self.tableWidget_4.row(i) time_item = self.tableWidget_4.item(row, 0).text() discipline = self.tableWidget_4.item(row, 1).text() group = self.tableWidget_4.item(row, 3).text() o = Occupation update_value = o.get(self.session, time_item, discipline, group) for i in items_5: row = self.tableWidget_5.row(i) time_item = self.tableWidget_5.item(row, 0).text() discipline = self.tableWidget_5.item(row, 1).text() group = self.tableWidget_5.item(row, 3).text() o = Occupation update_value = o.get(self.session, time_item, discipline, group) for i in items_6: row = self.tableWidget_6.row(i) time_item = self.tableWidget_6.item(row, 0).text() discipline = self.tableWidget_6.item(row, 1).text() group = self.tableWidget_6.item(row, 3).text() o = Occupation update_value = o.get(self.session, time_item, discipline, group) try: discipline = update_value.discipline.name self.update_class_ui.discipline_old = discipline index = self.update_class_ui.comboBox.findText(discipline) self.update_class_ui.comboBox.setCurrentIndex(index) class_format = update_value.class_format.name self.update_class_ui.class_format_old = class_format index = self.update_class_ui.comboBox_2.findText(class_format) self.update_class_ui.comboBox_2.setCurrentIndex(index) group = update_value.group.number self.update_class_ui.group_old = group index = self.update_class_ui.comboBox_3.findText(group) self.update_class_ui.comboBox_3.setCurrentIndex(index) audience = update_value.audience.corps + " " + update_value.audience.number index = self.update_class_ui.comboBox_4.findText(audience) self.update_class_ui.comboBox_4.setCurrentIndex(index) format = '%H:%M' time = datetime.datetime.strptime(time_item, format).time() self.update_class_ui.timeEdit.setTime(time) except: return self.update_class_window.show()