def execute(self):
     ''' This methods only approve the safe input datas'''
     hoursandmins = dates.worktimecalc(self.__in_hour, self.__in_min,
                                       self.__out_hour, self.__out_min,
                                       self.Meal)
     self.expandallwithzero(hoursandmins[0], hoursandmins[1])
     Message = 'Datum ' + self.date + '\n' + 'Belepes ideje ' \
         + self.Arrive + '\n' + 'Kilepes ideje ' + self.Out + '\n' \
         + 'Munkaido ' + self.WorkTime
     Data = 'Datum ' + self.date + ' Belepes ' + self.Arrive + 9 * X \
         + self.date + ' Kilepes ' + self.Out + ' Ebed ' + self.Meal \
         + 13 * X + ' Munkaido ' + self.WorkTime
     messagebox.getdata(Message)
     Directory = dates.actualyear()
     os.chdir(PATH + '\\' + str(Directory))
     File = dates.actualmonth(months)
     directory.filewrite(File, Data)
     self.MenuOneContainer.destroy()
     run.menuone()
 def execute(self):
     ''' This methods only approve the safe input datas'''
     hoursandmins = dates.worktimecalc(
         self.__in_hour,
         self.__in_min,
         self.__out_hour,
         self.__out_min,
         self.Meal)
     self.expandallwithzero(hoursandmins[0], hoursandmins[1])
     Message = 'Datum ' + self.date + '\n' + 'Belepes ideje ' \
         + self.Arrive + '\n' + 'Kilepes ideje ' + self.Out + '\n' \
         + 'Munkaido ' + self.WorkTime
     Data = 'Datum ' + self.date + ' Belepes ' + self.Arrive + 9 * X \
         + self.date + ' Kilepes ' + self.Out + ' Ebed ' + self.Meal \
         + 13 * X + ' Munkaido ' + self.WorkTime
     messagebox.getdata(Message)
     Directory = dates.actualyear()
     os.chdir(PATH + '\\' + str(Directory))
     File = dates.actualmonth(months)
     directory.filewrite(File, Data)
     self.MenuOneContainer.destroy()
     run.menuone()
    def showdata(self, Title, Fajl, Days):
        '''This method i'''
        Fajl = os.getcwd() + '\\' + Fajl
        self.Title = Title
        self.Fajl = Fajl
        IdoFajl = open(Fajl, 'a')
        IdoFajl.seek(0, 2)
        IdoFajlHossz = IdoFajl.tell()
        if IdoFajlHossz == 0L:
            messagebox.single(warempty_one, warempty_two)
            IdoFajl.close()
        else:
            showdata = Tk()
            self.f4 = showdata
            showdata.title(menufour_title)
            scrollbar = Scrollbar(showdata)
            scrollbar.pack(side=RIGHT, fill=Y)
            IdoFajl = open(Fajl, 'r')
            data_hours = data_min = 0
            bejegyzes = 5
            nap = 0
            Label(showdata, text=Title, font='Bold', padx=10, pady=10).pack()
            begin = 0
            # Start to Read from file
            while 1:
                IdoAdatok = IdoFajl.readline()
                Bont_result = re.match('(.*)(Munkaido)\s*(\d+:\d+)', IdoAdatok)
                Datum_result = re.match('(.*)(Datum)\s*(\d+.\d+.\d+)',
                                        IdoAdatok)
                whatday = dates.whatday(Datum_result)
                if Bont_result:
                    work_time = Bont_result.group(3)
                    hours = work_time.split(':')[0]
                    mins = work_time.split(':')[1]
                    data_hours += int(hours)
                    data_min += int(mins)

                if IdoAdatok != '':
                    FilePrint = self.Fajl + 'print'
                    if begin == 0:
                        try:
                            os.remove(FilePrint)
                        except WindowsError:
                            pass
                        directory.filewrite(FilePrint, self.Title + '\n')
                        directory.filewrite(FilePrint, worktime_report1)
                        begin = 1
                    s = re.sub('[DatumBelepesKilepesEbedMunkaIdo]', '',
                               IdoAdatok)

                    if whatday == 0:
                        directory.filewrite(FilePrint, ' MON \t' + s)
                    elif whatday == 1:
                        directory.filewrite(FilePrint, ' TUE \t' + s)
                    elif whatday == 2:
                        directory.filewrite(FilePrint, ' WED \t' + s)
                    elif whatday == 3:
                        directory.filewrite(FilePrint, ' THU \t' + s)
                    elif whatday == 4:
                        directory.filewrite(FilePrint, ' FRI \t' + s)
                    elif whatday == 5:
                        directory.filewrite(FilePrint, ' SAT \t' + s)
                    elif whatday == 6:
                        directory.filewrite(FilePrint, ' SUN \t' + s)
                    bejegyzes = bejegyzes + 1
                    nap = nap + 1

                else:
                    requiredmins = (nap * 8) * 60
                    currentmins = (data_hours * 60 + data_min) - requiredmins
                    ShowMin = dates.mintotime(currentmins)

                    if data_min > 60:
                        plus_hours = data_min / 60
                        data_min = data_min % 60
                        data_hours += plus_hours
                    data_hours = dates.ExpandWithZero(data_hours)
                    data_min = dates.ExpandWithZero(data_min)
                    directory.filewrite(FilePrint, '\n' + seperatesign)
                    directory.filewrite(FilePrint,
                                        'Osszegzesi informaciok :\n')
                    directory.filewrite(
                        FilePrint, 'Havi munkaorak szama :  \t%s:%s' %
                        (data_hours, data_min))
                    directory.filewrite(FilePrint, Days % nap)
                    directory.filewrite(
                        FilePrint, '\nJelenlegi óraszám :  \t%s' % (ShowMin))
                    #Create a copy of File
                    with open(FilePrint) as copy_of_file:
                        file_content = copy_of_file.read()

#Create a Testbox for Showing Information
                    Ido_lista = Text(showdata,
                                     yscrollcommand=scrollbar.set,
                                     width=63,
                                     height=20,
                                     font='Bold')
                    Ido_lista.pack(side=TOP, fill=NONE, padx=10, pady=10)
                    scrollbar.config(command=Ido_lista.yview)
                    Ido_lista.insert(END, file_content)
                    Next = Button(showdata,
                                  text='Tovabb',
                                  height=1,
                                  width=20,
                                  command=self.quit_menutwo)
                    Next.pack(side=LEFT, fill=NONE, padx=10, pady=10)
                    Back = Button(
                        showdata, text='Nyomtat',
                        height=1, width=20,
                        command=lambda : \
                        self.printfile(Fajl))
                    Back.pack(side=LEFT, fill=NONE, padx=10, pady=10)
                    Ido_lista.configure(state='disabled')
                    break
                    IdoFajl.close()
    def showdata(
        self, Title,
        Fajl, Days ):
        '''This method i'''
        Fajl= os.getcwd() + '\\' + Fajl
        self.Title = Title
        self.Fajl = Fajl
        IdoFajl = open(Fajl, 'a')
        IdoFajl.seek(0, 2)
        IdoFajlHossz = IdoFajl.tell()
        if IdoFajlHossz == 0L:
            messagebox.single(warempty_one, warempty_two)
            IdoFajl.close()
        else:
            showdata = Tk()
            self.f4 = showdata
            showdata.title(menufour_title)
            scrollbar = Scrollbar(showdata)
            scrollbar.pack(side=RIGHT, fill=Y)
            IdoFajl = open(Fajl, 'r')
            data_hours = data_min = 0
            bejegyzes = 5
            nap = 0
            Label(showdata, text=Title, 
                font='Bold', padx=10, pady=10).pack()
            begin = 0
            # Start to Read from file
            while 1:
                IdoAdatok = IdoFajl.readline()
                Bont_result = re.match('(.*)(Munkaido)\s*(\d+:\d+)',
                        IdoAdatok)
                Datum_result = re.match('(.*)(Datum)\s*(\d+.\d+.\d+)',
                        IdoAdatok)
                whatday = dates.whatday(Datum_result)
                if Bont_result:
                    work_time = Bont_result.group(3)
                    hours = work_time.split(':')[0]
                    mins = work_time.split(':')[1]
                    data_hours += int(hours)
                    data_min += int(mins)

                if IdoAdatok != '':
                    FilePrint = self.Fajl + 'print'
                    if begin == 0:
                        try:
                            os.remove(FilePrint)
                        except WindowsError:
                            pass
                        directory.filewrite(FilePrint, self.Title + '\n'
                                )
                        directory.filewrite(FilePrint, worktime_report1)
                        begin = 1
                    s = re.sub('[DatumBelepesKilepesEbedMunkaIdo]', '',
                               IdoAdatok)

                    if whatday == 0:
                        directory.filewrite(FilePrint, ' MON \t' + s)
                    elif whatday == 1:
                        directory.filewrite(FilePrint, ' TUE \t' + s)
                    elif whatday == 2:
                        directory.filewrite(FilePrint, ' WED \t' + s)
                    elif whatday == 3:
                        directory.filewrite(FilePrint, ' THU \t' + s)
                    elif whatday == 4:
                        directory.filewrite(FilePrint, ' FRI \t' + s)
                    elif whatday == 5:
                        directory.filewrite(FilePrint, ' SAT \t' + s)
                    elif whatday == 6:
                        directory.filewrite(FilePrint, ' SUN \t' + s)
                    bejegyzes = bejegyzes + 1
                    nap = nap + 1
		
                else:
                    requiredmins = (nap*8)*60
                    currentmins = (data_hours *60 + data_min) -requiredmins
                    ShowMin = dates.mintotime(currentmins)
                    
                    
                    if data_min > 60:
                        plus_hours = data_min / 60
                        data_min = data_min % 60
                        data_hours += plus_hours
                    data_hours = dates.ExpandWithZero(data_hours)
                    data_min = dates.ExpandWithZero(data_min)
                    directory.filewrite(FilePrint, '\n' + seperatesign)
                    directory.filewrite(FilePrint,
                            'Osszegzesi informaciok :\n')
                    directory.filewrite(FilePrint,
                            'Havi munkaorak szama :  \t%s:%s'
                            % (data_hours, data_min))
                    directory.filewrite(FilePrint, Days % nap)
                    directory.filewrite(FilePrint,
                            '\nJelenlegi óraszám :  \t%s'
                            % (ShowMin))
					#Create a copy of File					
                    with open (FilePrint) as copy_of_file:
                        file_content = copy_of_file.read()					
					#Create a Testbox for Showing Information
                    Ido_lista = Text(
                        showdata,
                        yscrollcommand=scrollbar.set,
                        width=63,
                        height=20,
                        font='Bold')
                    Ido_lista.pack(
                        side=TOP,
                        fill=NONE,
                        padx=10,
                        pady=10)
                    scrollbar.config(command=Ido_lista.yview)
                    Ido_lista.insert(END, file_content)
                    Next = Button(
                        showdata,text='Tovabb', 
                        height=1,width=20, 
                        command=self.quit_menutwo)
                    Next.pack(
                        side=LEFT,fill=NONE,
                        padx=10, pady=10)
                    Back = Button(
                        showdata, text='Nyomtat',
                        height=1, width=20, 
                        command=lambda : \
                        self.printfile(Fajl))
                    Back.pack(
                        side=LEFT, fill=NONE,
                        padx=10, pady=10)
                    Ido_lista.configure(state='disabled')
                    break
                    IdoFajl.close()