def __init__(self, aClient): self.client = aClient self.formatDate = "%d/%m/%y" self.destination = "Output\\" + aClient.name + "\\" if not os.path.isdir(self.destination): pp.printWarning("Path :" + self.destination + " does not exist") os.makedirs(self.destination) self.factureClient = Facture(self.client.lastFactureId + 1, self.client.name)
def __init__(self, master, config, clientList): self.master = master self.config = config self.clientList = clientList self.clientListVar = {} self.listCheckBox = [] self.shouldActivateAll = False self.listPhoto = [] self.progressGen = IntVar(0) self.maxProgress = IntVar() self.maxProgress.set(len(clientList)) self.progresBar = None for widget in master.grid_slaves(): #Don't touch the menu bar ! if widget.widgetName != "frame": widget.destroy() try: self.master.nametowidget(".placeHolder").destroy() except Exception: pp.printWarning("Unable to destroy placeholder")
def callbackGen(self, event): isError = False pp.printGreen("Generating the doc ") event.widget.master.config(cursor="watch") numberOfClient = len(self.clientListVar) self.progresBar.grid() for aClient in self.clientListVar: self.progressGen.set(self.progressGen.get() + 1) if self.clientListVar[aClient].get(): try: pp.printGreen(" " + aClient) aWritter = FactureWritter(self.clientList[aClient]) gentime = aWritter.printFacture() except Exception as e: pp.printError("I have fail") pp.printError(e) pp.printError(traceback.format_exc()) messagebox.showerror("Erreur", str(e)) event.widget.master.config(cursor="arrow") self.progressGen.set(self.progressGen.get() + 1) isError = True continue self.clientList[aClient].toConfig(True) self.progressGen.set(self.progressGen.get() + 1) else: self.progressGen.set(self.progressGen.get() + 1) event.widget.master.config(cursor="arrow") if isError: pp.printWarning(" Erreur durant la génération") messagebox.showerror( "Warning", "Probléme durant laa génération des factures") else: messagebox.showinfo("Info", "Facture créé avec success") self.progresBar.grid_remove()
def __init__(self,master,config,clientList): self.master=master self.config=config self.clientList = clientList self.listOfDueDate = {} self.listOfLateFact = {} self.listOfIncomingFact = {} self.buildListOfDueDate() self.yearMonth = "" self.calendarDate = datetime.now().date() self.detaislLabel = StringVar() self.activeDate="" self.clickDate="" self.clickWidget=None self.listPhoto = [] self.activeFacture=None for widget in master.grid_slaves(): #Don't touch the menu bar ! if widget.widgetName !="frame": widget.destroy() try : self.master.nametowidget(".placeHolder").destroy() except Exception: pp.printWarning("Unable to delete placeholder ")
def drawCalendar(self,master) : aFakeLabel = Label(self.master, text="W" + str(1)) myFont = tkFont.Font(font=aFakeLabel['font']) myFont.config(weight=tkFont.BOLD) day_list = ["Er", "Lu", "Ma", "Me", "Je", "Ve", "Sa", "Di"] daysInCurrentMonth = calendar.monthrange(self.calendarDate.year, self.calendarDate.month)[1] + 1 shiftValue=datetime(self.calendarDate.year, self.calendarDate.month, 1).date().weekday() self.yearMonth=str(self.calendarDate.year)+"-" month=str(self.calendarDate.month) if len(month) < 2: month="0" +month self.yearMonth=self.yearMonth+month+"-" currentWeek=int(datetime.strftime(self.calendarDate,'%W')) currentWeek-=1 master.config(text= self.calendarDate.strftime('%B')) #Comptue number of displayable week maxWeek= ((daysInCurrentMonth+shiftValue)/7) if maxWeek>5.0: maxWeek=6 maxWeek+=1 aLabelPrevious = Label(master, text="<prec",font=myFont) aLabelPrevious.grid(row=0,column=0) aLabelPrevious.bind("<Button-1>", self.previousMonth) aLabelNext = Label(master, text="suiv>",font=myFont) aLabelNext.grid(row=0,column=1) aLabelNext.bind("<Button-1>", self.nextMonth) #Header print of calendar for aDay in range(1, 8): aLabel = Label(master, text=str(day_list[aDay]),font=myFont).grid(row=1,column=aDay) for aWeek in range(1,int(maxWeek)): aLabel=Label(master, text="w"+str(aWeek+currentWeek),font=myFont) aLabel.grid(row=aWeek+1,column=0) #Print calendar column = 1+shiftValue row = 2 for aDay in range (1,daysInCurrentMonth): aLabel = Label(master, text=str(aDay),name=str(aDay)) fullDay=str(aDay) if len(fullDay) < 2: fullDay="0"+fullDay fullDay=self.yearMonth+fullDay if aDay == self.calendarDate.day: aLabel = Label(master, text=str(aDay),fg="blue",font=myFont,name=str(aDay)) elif fullDay in self.listOfDueDate: pp.printWarning("Find a due date "+str(aDay)) aLabel = Label(master, text=str(aDay),fg="red",font=myFont,name=str(aDay)) if column >7 : row+=1 column=1 aLabel.grid(row=row, column=column ) aLabel.bind("<Button-1>", self.showDetails) aLabel.bind("<Enter>", self.highlightMe) aLabel.bind("<Leave>", self.hideMe) column+=1