def SetVal(self):
        if ChoosePerson.selectedPerson.get() != "-":
            FileStatus.Set()

        if self.set != 0:
            if self.set != self.currVal[0]:
                self.set = self.currVal[0]
            else:
                self.set = 0
        else:
            self.set = self.currVal[0]

        if self.set == 0:
            self.frame.config(bg="white")
        elif self.set == 1:
            self.frame.config(bg="green")
        elif self.set == 2:
            self.frame.config(bg="red")
        elif self.set == 3:
            self.frame.config(bg="yellow")

        self.masterWidget.event_generate("<<Update>>")

        if ChoosePerson.selectedPerson.get() != "-":
            fullName = ChoosePerson.selectedPerson.get()
            year = ChooseYear.selectedYear
            fullNameTab = fullName.split(" ")
            person = DataEngine.PersonList.GetPersonFromList(
                fullNameTab[0], fullNameTab[1])
            person.LoadSingleVal(year, self.monthVal, self.dayVal, self.set)
示例#2
0
	def Delete(self):
		fullName=self.selectVar.get()
		
		if fullName!="-":
			FileStatus.Set()

			fullNameTab=fullName.split(" ")

			DataEngine.PersonList.DeletePersonFromList(fullNameTab[0],fullNameTab[1])

			MainTable.ChoosePerson.UpdatePersonList()

		self.CloseProtocol()
    def Confirm(self):
        str = self.addRootEntry.get()
        valErrorFlag = 0

        try:
            year = int(str)
        except ValueError:
            self.errorWindow = Toplevel(self.addRoot)
            self.errorMsg = Label(self.errorWindow,
                                  text="ERROR! Wrong year!",
                                  font=("Arial", 12, "bold"))
            self.errorMsg.grid(row=0, column=0, padx=30, pady=30, sticky=N)
            valErrorFlag = 1

        if valErrorFlag == 0:
            fullName = ChoosePerson.selectedPerson.get()
            fullNameTab = fullName.split()

            person = DataEngine.PersonList.GetPersonFromList(
                fullNameTab[0], fullNameTab[1])
            checkYear = person.GetVacationCalendar(year)

            if checkYear != None:
                self.errorWindow = Toplevel(self.addRoot)
                self.errorMsg = Label(
                    self.errorWindow,
                    text="Błąd! Rok został już przypisany do wybranej osoby!",
                    font=("Arial", 12, "bold"))
                self.errorMsg.grid(row=0, column=0, padx=30, pady=30, sticky=N)
            else:
                FileStatus.Set()

                person.LoadNewYear(year)
                ChooseYear.UpdateYearsList()

                fullName = ChoosePerson.selectedPerson.get()
                fullName = fullName.split()
                person = DataEngine.PersonList.GetPersonFromList(
                    fullName[0], fullName[1])
                if person.GetVacationCalendar(year - 1) != None:
                    person.SetYearFreeDaysLeftFromLastYear(
                        year,
                        person.GetYearBaseFreeDays(year - 1) +
                        person.GetYearFreeDaysFromLastYear(year - 1) -
                        person.GetYearVacationDays(year - 1))
                else:
                    person.SetYearFreeDaysLeftFromLastYear(year, 0)
                ShowFreeDaysLeft.UpdateData()
                ShowFreeDaysLeft.Update()

                self.Close()
    def CheckInsertedBaseDays(*args):
        if (len(ShowFreeDaysLeft.baseFreeDaysStr.get()) > 0):
            if (len(ShowFreeDaysLeft.baseFreeDaysStr.get()) > 3):
                ShowFreeDaysLeft.baseFreeDaysStr.set(
                    (ShowFreeDaysLeft.baseFreeDaysStr.get())[:3])
            elif (not (ShowFreeDaysLeft.baseFreeDaysStr.get())[-1]
                  in ShowFreeDaysLeft.cyfry):
                ShowFreeDaysLeft.baseFreeDaysStr.set(
                    (ShowFreeDaysLeft.baseFreeDaysStr.get()
                     )[:len(ShowFreeDaysLeft.baseFreeDaysStr.get()) - 1])

        if (len(ShowFreeDaysLeft.baseFreeDaysStr.get()) > 0):
            ShowFreeDaysLeft.baseFreeDays = int(
                ShowFreeDaysLeft.baseFreeDaysStr.get())
        else:
            ShowFreeDaysLeft.baseFreeDays = 0

        ShowFreeDaysLeft.UpdateFreeDaysLeft()
        FileStatus.Set()
    def CheckInsertedLastYearDays(*args):
        if len(ShowFreeDaysLeft.freeDaysLastYearStr.get()) > 0:
            if (len(ShowFreeDaysLeft.freeDaysLastYearStr.get()) > 3):
                ShowFreeDaysLeft.freeDaysLastYearStr.set(
                    (ShowFreeDaysLeft.freeDaysLastYearStr.get())[:3])
            elif (not (
                ((ShowFreeDaysLeft.freeDaysLastYearStr.get())[-1]
                 in ShowFreeDaysLeft.cyfry) and
                ((ShowFreeDaysLeft.freeDaysLastYearStr.get())[-1] != '-'))):
                ShowFreeDaysLeft.freeDaysLastYearStr.set(
                    (ShowFreeDaysLeft.freeDaysLastYearStr.get()
                     )[:len(ShowFreeDaysLeft.freeDaysLastYearStr.get()) - 1])

        if (len(ShowFreeDaysLeft.freeDaysLastYearStr.get()) > 0):
            ShowFreeDaysLeft.freeDaysLastYear = int(
                ShowFreeDaysLeft.freeDaysLastYearStr.get())
        else:
            ShowFreeDaysLeft.freeDaysLastYear = 0

        ShowFreeDaysLeft.UpdateFreeDaysLeft()
        FileStatus.Set()
示例#6
0
	def Modify(self):
		if self.selectVar.get()!="-":
			name=self.nameEntry.get()
			surname=self.surnameEntry.get()

			if name!="" and surname!="":
				if " " in name:
					self.errorWindow=Toplevel(self.root)
					self.errorWindow.iconbitmap(r"logo_ikona.ico")
					self.errorMsg=Label(self.errorWindow,text="Błąd! Imię nie może zawierać białych znaków!",font=("Arial",12,"bold"))
					self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
				elif " " in surname:
					self.errorWindow=Toplevel(self.root)
					self.errorWindow.iconbitmap(r"logo_ikona.ico")
					self.errorMsg=Label(self.errorWindow,text="Błąd! Nazwisko nie może zawierać białych znaków!",font=("Arial",12,"bold"))
					self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
				else:
					FileStatus.Set()

					basicName=self.selectVar.get()
					basicNameTab=basicName.split(" ")

					person=DataEngine.PersonList.GetPersonFromList(basicNameTab[0],basicNameTab[1])

					person.SetName(name)
					person.SetSurname(surname)

					MainTable.ChoosePerson.UpdatePersonList()

					self.CloseProtocol()
			else:
				self.errorWindow=Toplevel(self.root)
				self.errorWindow.iconbitmap(r"logo_ikona.ico")
				self.errorMsg=Label(self.errorWindow,text="Błąd! Złe dane osobowe!",font=("Arial",12,"bold"))
				self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
		else:
			self.errorWindow=Toplevel(self.root)
			self.errorWindow.iconbitmap(r"logo_ikona.ico")			  
			self.errorMsg=Label(self.errorWindow,text="Błąd! Nie wybrano osoby!",font=("Arial",12,"bold"))
			self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
示例#7
0
	def AddPerson(self):
		name=self.nameEntry.get()
		surname=self.surnameEntry.get()
		valErrorFlag=0

		try:
			year=int(self.yearStr.get())
		except ValueError:
			self.errorWindow=Toplevel(self.root)
			self.errorWindow.iconbitmap(r"logo_ikona.ico")
			self.errorMsg=Label(self.errorWindow,text="Błąd! Zły format wartości roku!",font=("Arial",12,"bold"))
			self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
			valErrorFlag=1

		if valErrorFlag==0:
			if name=="" or surname=="":
				self.errorWindow=Toplevel(self.root)
				self.errorWindow.iconbitmap(r"logo_ikona.ico")
				self.errorMsg=Label(self.errorWindow,text="Błąd! Brak imienia lub nazwiska!",font=("Arial",12,"bold"))
				self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
			else:
				if " " in name:
					self.errorWindow=Toplevel(self.root)
					self.errorWindow.iconbitmap(r"logo_ikona.ico")
					self.errorMsg=Label(self.errorWindow,text="Błąd! Imię nie może zawierać białych znaków!",font=("Arial",12,"bold"))
					self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
				elif " " in surname:
					self.errorWindow=Toplevel(self.root)
					self.errorWindow.iconbitmap(r"logo_ikona.ico")
					self.errorMsg=Label(self.errorWindow,text="Błąd! Nazwisko nie może zawierać białych znaków!",font=("Arial",12,"bold"))
					self.errorMsg.grid(row=0,column=0,padx=30,pady=30,sticky=N)
				else:
					FileStatus.Set()

					newPerson=DataEngine.PersonData(name,surname,year)
					DataEngine.PersonList.AddPersonToList(newPerson)
					MainTable.ChoosePerson.UpdatePersonList()
					self.CloseProtocol()