Example #1
0
 def updateAllList(self):
     self.allExaminersList.setEditTriggers(QAbstractItemView.NoEditTriggers)
     model = QStandardItemModel(self.allExaminersList)
     for i in Examiner.all():
         item = QStandardItem(i.to_string())
         model.appendRow(item)
     self.allExaminersList.setModel(model)
def all_examiners():
    try:
        examiners = Examiner.all()
        print_arr(examiners)
        if len(examiners) == 0:
            print("No results")
        else:
            res = int(input("Enter number of selected examiner or '-1' to go back: "))
            if res > 0 and res <= len(examiners):
                manipulate_examiner(examiners[res - 1])
                return
            elif res == -1:
                return
            else:
                print("Incorrect input")
    except:
        print("Error")
Example #3
0
    def exportXlsxClick(self):
        wb = openpyxl.load_workbook('..\\..\\Reports\\All.xlsx')
        if 'Examiners' not in wb.sheetnames:
            wb.create_sheet('Examiners')
        ws = wb['Examiners']
        ws.delete_cols(1, 6)
        ws.delete_rows(1, 100)
        all_list = Examiner.all()
        for i in range(len(all_list)):
            ws.cell(row=i + 1, column=1).value = all_list[i].id
            ws.cell(row=i + 1, column=2).value = all_list[i].surname
            ws.cell(row=i + 1, column=3).value = all_list[i].name
            ws.cell(row=i + 1, column=4).value = all_list[i].patronymic
            ws.cell(row=i + 1, column=5).value = all_list[i].payment
        wb.save('..\\..\\Reports\\All.xlsx')


# app = QApplication(sys.argv)
# w = ExaminerWindow()
# w.show()
# app.exec_()
 def update_all(self, listbox):
     listbox.delete(0, END)
     self.all_list = Examiner.all()
     for elem in self.all_list:
         listbox.insert(END, elem.to_string())
     return
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        all = Frame(self)
        all.pack(side=LEFT, fill=Y)
        Label(all, text="All examiners").pack()
        self.all_listbox = Listbox(all, width=100)
        self.all_listbox.bind('<Double-1>', self.all_list_on_click)
        self.all_list = Examiner.all()
        for person in self.all_list:
            self.all_listbox.insert(END, person.to_string())
        self.all_listbox.pack(side="top", fill="both", expand=True)
        all_report = Button(
            all,
            text="Export info about all examiners in docx files",
            command=self.all_docx_export)
        all_report.pack(side="top")
        xlsx_report = Button(all,
                             text="Export info about all examiners in Excel",
                             command=self.xlsx_export)
        xlsx_report.pack(side="top")

        #################################################################################################

        find = Frame(self)
        find.pack(side=LEFT, fill=Y)
        Label(find, text="Find examiner").pack()
        find_entry = Entry(find)
        find_entry.pack()
        self.find_listbox = Listbox(find, width=100)
        self.find_listbox.bind('<Double-1>', self.find_list_on_click)
        find_examiner = partial(self.find_examiner, self.find_listbox,
                                find_entry)
        find_btn = Button(find, text="Find", command=find_examiner).pack()
        self.find_listbox.pack(side="top", fill="both", expand=True)

        ########################################################################################################

        add = Frame(self)
        add.pack()

        Label(add, text="Add examiner",
              font="Helvetica -14 bold").grid(columnspan=2)

        Label(add, text="Surname: ").grid(row=1, column=0)
        surn = Entry(add, width=50)
        surn.grid(row=1, column=1)

        Label(add, text="Name: ").grid(row=2, column=0)
        name = Entry(add, width=50)
        name.grid(row=2, column=1)

        Label(add, text="Patronymic: ").grid(row=3, column=0)
        patr = Entry(add, width=50)
        patr.grid(row=3, column=1)

        Label(add, text="Salary: ").grid(row=4, column=0)
        salary = Entry(add, width=50)
        salary.grid(row=4, column=1)

        add_examiner = partial(self.add_examiner, surn, name, patr, salary,
                               self.all_listbox)

        add_btn = Button(add, text="Add examiner", command=add_examiner)
        add_btn.grid(columnspan=2)
Example #6
0
 def exportDocxClick(self):
     for i in Examiner.all():
         examiner_export(i)