Exemple #1
0
    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()
Exemple #2
0
 def delete(self):
     items = self.tableWidget.selectedItems()
     for i in items:
         row = self.tableWidget.row(i)
         number = self.tableWidget.item(row, 1).text()
         audience = Audience()
         audience.delete(self.session, number)
         self.tableWidget.removeRow(row)
 def show_audience_list_window(self):
     audience = Audience()
     ls_all = audience.show_all(self.session)
     ls_all = np.array(ls_all)
     self.audience_list_ui.tableWidget = set_items_to_table(
         self.audience_list_ui.tableWidget, ls_all)
     self.audience_list_ui.tableWidget.resizeColumnsToContents()
     self.audience_list_window.show()
Exemple #4
0
    def add(self):
        audience = Audience()
        corps = self.lineEdit.text()
        number = self.lineEdit_2.text()
        audience.add(self.session, corps, number)

        ls_all = audience.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_audience_window.close()
Exemple #5
0
    def update(self):
        audience = Audience()
        corps = self.lineEdit.text()
        number = self.lineEdit_2.text()

        audience.update(self.session, self.update_value, corps, number)

        self.table.setItem(self.row, 0, QtWidgets.QTableWidgetItem(corps))
        self.table.setItem(self.row, 1, QtWidgets.QTableWidgetItem(number))
        self.table.resizeColumnsToContents()

        self.update_audience_window.close()
Exemple #6
0
    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()
Exemple #7
0
    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()