def generatePDF(self): try: i = max(self.lPaid + self.lUnpaid) except: i = 0 downloadFile(FILENAME) numberOfPermissions = simpledialog.askinteger('Antal', 'Hur många tillstånd?') while numberOfPermissions != None and numberOfPermissions % 3 != 0: tk.messagebox.showinfo('Fel', 'Måste vara jämt delbart med tre!') numberOfPermissions = simpledialog.askinteger('Antal', 'Hur många tillstånd?') if numberOfPermissions: self.updateListOfUnpaid(i, numberOfPermissions) fileName = creatPermissionPDF(self.apartmentNumber, i+1, numberOfPermissions) updateFile_PaidUnpaid(self.apartmentNumber, self.dPaid_dates, self.lUnpaid) if self.checkButtonVal.get(): sendEmail(fileName, self.lEmail, 'Parkeringstillstånd', 'Här kommer dina parkeringstillstånd!') else: webbrowser.open_new(r'%s' % fileName)
def updateValues(self, dMarkedAsPaid): self.lPaid += dMarkedAsPaid.keys() self.lUnpaid = [x for x in self.lUnpaid if x not in dMarkedAsPaid.keys()] self.list.clear() self.lPaid.sort() self.lUnpaid.sort() for idnbr in dMarkedAsPaid.keys(): #print(idnbr, dMarkedAsPaid[idnbr]) self.dPaid_dates[str(idnbr)] = dMarkedAsPaid[idnbr] #print(self.dPaid_dates) self.labelPaid.config(text=listToCommaSeperatedString(self.lPaid)) self.labelUnpaid.config(text=listToCommaSeperatedString(self.lUnpaid)) self.list.append(self.labelPaid) self.list.append(self.labelUnpaid) updateFile_PaidUnpaid(self.apartmentNumber, self.dPaid_dates, self.lUnpaid)