d i f f   - - g i t   " a / \ 3 4 5 \ 2 2 0 \ 2 5 7 \ 3 4 5 \ 2 1 2 \ 2 5 0 \ 3 4 5 \ 2 3 1 \ 2 5 0 . p y "   " b / \ 3 4 5 \ 2 2 0 \ 2 5 7 \ 3 4 5 \ 2 1 2 \ 2 5 0 \ 3 4 5 \ 2 3 1 \ 2 5 0 . p y " 
 
 i n d e x   5 0 d 0 b 2 2 . . 6 9 1 3 8 8 f   1 0 0 6 4 4 
 
 - - -   " a / \ 3 4 5 \ 2 2 0 \ 2 5 7 \ 3 4 5 \ 2 1 2 \ 2 5 0 \ 3 4 5 \ 2 3 1 \ 2 5 0 . p y " 
 
 + + +   " b / \ 3 4 5 \ 2 2 0 \ 2 5 7 \ 3 4 5 \ 2 1 2 \ 2 5 0 \ 3 4 5 \ 2 3 1 \ 2 5 0 . p y " 
 
 @ @   - 2 , 7   + 2 , 7   @ @ 
 
   #   - * -   c o d i n g :   u t f - 8   - * - 
 
   
 
   " " " 
 
 - O C R USYt|~/TRhV
 
 + v	- O C R USYt|~/TRhV
 
   - - - - - - - - - - - - - - - - - 
 
   cO{USvVb_LubeO(u7b	bR
 
   " " " 
 
 @ @   - 1 3 , 5 3   + 1 3 , 1 1 6   @ @   i m p o r t   t i m e 
 
   i m p o r t   s u b p r o c e s s 
 
   i m p o r t   s h u t i l 
 
   i m p o r t   t k i n t e r   a s   t k 
 
 - f r o m   t k i n t e r   i m p o r t   m e s s a g e b o x ,   f i l e d i a l o g ,   s c r o l l e d t e x t 
 
 + f r o m   t k i n t e r   i m p o r t   m e s s a g e b o x ,   f i l e d i a l o g ,   s c r o l l e d t e x t ,   t t k 
 
 + f r o m   t k i n t e r   i m p o r t   f o n t   a s   t k f o n t 
 
   f r o m   t h r e a d i n g   i m p o r t   T h r e a d 
 
   i m p o r t   d a t e t i m e 
 
 + i m p o r t   j s o n 
 
 + i m p o r t   r e 
 
 + f r o m   t y p i n g   i m p o r t   D i c t ,   L i s t ,   O p t i o n a l ,   A n y 
 
   
 
 - d e f   e n s u r e _ d i r e c t o r i e s ( ) : 
 
 -         " " " nxO_vvU_~gX[(W" " " 
 
 -         d i r e c t o r i e s   =   [ " d a t a / i n p u t " ,   " d a t a / o u t p u t " ,   " d a t a / t e m p " ,   " l o g s " ] 
 
 -         f o r   d i r e c t o r y   i n   d i r e c t o r i e s : 
 
 -                 i f   n o t   o s . p a t h . e x i s t s ( d i r e c t o r y ) : 
 
 -                         o s . m a k e d i r s ( d i r e c t o r y ,   e x i s t _ o k = T r u e ) 
 
 -                         p r i n t ( f " R^vU_:   { d i r e c t o r y } " ) 
 
 + #   hQ@\Sϑ(uNߍ*NRr`
 
 + R U N N I N G _ T A S K   =   N o n e 
 
 + T H E M E _ M O D E   =   " l i g h t "     #   ؞Emr;N
 
   
 
 - c l a s s   L o g R e d i r e c t o r : 
 
 -         " " " e_͑[ThV(uNUc}TNQv^>f:y0RLub" " " 
 
 -         d e f   _ _ i n i t _ _ ( s e l f ,   t e x t _ w i d g e t ) : 
 
 -                 s e l f . t e x t _ w i d g e t   =   t e x t _ w i d g e t 
 
 -                 s e l f . b u f f e r   =   " " 
 
 -                 s e l f . t e r m i n a l   =   s y s . _ _ s t d o u t _ _     #   OX[SYvs t d o u t _(u
 
 + #   [INEmrTmr;Nr
 
 + T H E M E S   =   { 
 
 +         " l i g h t " :   { 
 
 +                 " b g " :   " # f 0 f 0 f 0 " , 
 
 +                 " f g " :   " # 0 0 0 0 0 0 " , 
 
 +                 " b u t t o n _ b g " :   " # e 0 e 0 e 0 " , 
 
 +                 " b u t t o n _ f g " :   " # 0 0 0 0 0 0 " , 
 
 +                 " l o g _ b g " :   " # f f f f f f " , 
 
 +                 " l o g _ f g " :   " # 0 0 0 0 0 0 " , 
 
 +                 " h i g h l i g h t _ b g " :   " # 4 a 6 9 8 4 " , 
 
 +                 " h i g h l i g h t _ f g " :   " # f f f f f f " , 
 
 +                 " b o r d e r " :   " # c c c c c c " , 
 
 +                 " s u c c e s s " :   " # 2 8 a 7 4 5 " , 
 
 +                 " e r r o r " :   " # d c 3 5 4 5 " , 
 
 +                 " w a r n i n g " :   " # f f c 1 0 7 " , 
 
 +                 " i n f o " :   " # 1 7 a 2 b 8 " 
 
 +         } , 
 
 +         " d a r k " :   { 
 
 +                 " b g " :   " # 2 d 2 d 2 d " , 
 
 +                 " f g " :   " # f f f f f f " , 
 
 +                 " b u t t o n _ b g " :   " # 4 4 4 4 4 4 " , 
 
 +                 " b u t t o n _ f g " :   " # f f f f f f " , 
 
 +                 " l o g _ b g " :   " # 1 e 1 e 1 e " , 
 
 +                 " l o g _ f g " :   " # e 0 e 0 e 0 " , 
 
 +                 " h i g h l i g h t _ b g " :   " # 4 a 6 9 8 4 " , 
 
 +                 " h i g h l i g h t _ f g " :   " # f f f f f f " , 
 
 +                 " b o r d e r " :   " # 5 5 5 5 5 5 " , 
 
 +                 " s u c c e s s " :   " # 2 8 a 7 4 5 " , 
 
 +                 " e r r o r " :   " # d c 3 5 4 5 " , 
 
 +                 " w a r n i n g " :   " # f f c 1 0 7 " , 
 
 +                 " i n f o " :   " # 1 7 a 2 b 8 " 
 
 +         } 
 
 + } 
 
 + 
 
 + c l a s s   S t a t u s B a r ( t k . F r a m e ) : 
 
 +         " " " r`h>f:yS_MR|~r`Tۏ^" " " 
 
 +         
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   m a s t e r ,   * * k w a r g s ) : 
 
 +                 s u p e r ( ) . _ _ i n i t _ _ ( m a s t e r ,   * * k w a r g s ) 
 
 +                 s e l f . c o n f i g u r e ( h e i g h t = 2 5 ,   r e l i e f = t k . S U N K E N ,   b o r d e r w i d t h = 1 ) 
 
                   
 
 -         d e f   w r i t e ( s e l f ,   s t r i n g ) : 
 
 -                 s e l f . b u f f e r   + =   s t r i n g 
 
 -                 #   TeQ0R~z
 
 -                 s e l f . t e r m i n a l . w r i t e ( s t r i n g ) 
 
 -                 #   (WU I ~z-Nfee,gcN
 
 -                 s e l f . t e x t _ w i d g e t . a f t e r ( 0 ,   s e l f . u p d a t e _ t e x t _ w i d g e t ) 
 
 +                 #   r`h~{
 
 +                 s e l f . s t a t u s _ l a b e l   =   t k . L a b e l ( s e l f ,   t e x t = " 1\~" ,   a n c h o r = t k . W ,   p a d x = 5 ) 
 
 +                 s e l f . s t a t u s _ l a b e l . p a c k ( s i d e = t k . L E F T ,   f i l l = t k . X ,   e x p a n d = T r u e ) 
 
                   
 
 -         d e f   u p d a t e _ t e x t _ w i d g e t ( s e l f ) : 
 
 -                 s e l f . t e x t _ w i d g e t . c o n f i g u r e ( s t a t e = t k . N O R M A L ) 
 
 -                 s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ) 
 
 -                 #   ꁨRnR0R^
 
 -                 s e l f . t e x t _ w i d g e t . s e e ( t k . E N D ) 
 
 -                 s e l f . t e x t _ w i d g e t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D ) 
 
 -                 s e l f . b u f f e r   =   " " 
 
 +                 #   ۏ^ag
 
 +                 s e l f . p r o g r e s s   =   t t k . P r o g r e s s b a r ( s e l f ,   o r i e n t = t k . H O R I Z O N T A L ,   l e n g t h = 2 0 0 ,   m o d e = ' d e t e r m i n a t e ' ) 
 
 +                 s e l f . p r o g r e s s . p a c k ( s i d e = t k . R I G H T ,   p a d x = 5 ,   p a d y = 2 ) 
 
                   
 
 -         d e f   f l u s h ( s e l f ) : 
 
 -                 s e l f . t e r m i n a l . f l u s h ( )     #   nxO~z_N7Re
 
 - 
 
 - d e f   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( c o m m a n d ,   l o g _ w i d g e t ) : 
 
 +                 #   υۏ^agRYr`	
 
 +                 s e l f . p r o g r e s s . p a c k _ f o r g e t ( ) 
 
 +                 
 
 +         d e f   s e t _ s t a t u s ( s e l f ,   t e x t ,   p r o g r e s s = N o n e ) : 
 
 +                 " " " nr`he,gTۏ^" " " 
 
 +                 s e l f . s t a t u s _ l a b e l . c o n f i g ( t e x t = t e x t ) 
 
 +                 
 
 +                 i f   p r o g r e s s   i s   n o t   N o n e   a n d   0   < =   p r o g r e s s   < =   1 0 0 : 
 
 +                         s e l f . p r o g r e s s . p a c k ( s i d e = t k . R I G H T ,   p a d x = 5 ,   p a d y = 2 ) 
 
 +                         s e l f . p r o g r e s s . c o n f i g ( v a l u e = p r o g r e s s ) 
 
 +                 e l s e : 
 
 +                         s e l f . p r o g r e s s . p a c k _ f o r g e t ( ) 
 
 +                         
 
 +         d e f   s e t _ r u n n i n g ( s e l f ,   i s _ r u n n i n g = T r u e ) : 
 
 +                 " " " nЏLr`" " " 
 
 +                 i f   i s _ r u n n i n g : 
 
 +                         s e l f . s t a t u s _ l a b e l . c o n f i g ( t e x t = " Yt-N. . . " ,   f o r e g r o u n d = T H E M E S [ T H E M E _ M O D E ] [ " i n f o " ] ) 
 
 +                         s e l f . p r o g r e s s . p a c k ( s i d e = t k . R I G H T ,   p a d x = 5 ,   p a d y = 2 ) 
 
 +                         s e l f . p r o g r e s s . c o n f i g ( m o d e = ' i n d e t e r m i n a t e ' ) 
 
 +                         s e l f . p r o g r e s s . s t a r t ( ) 
 
 +                 e l s e : 
 
 +                         s e l f . s t a t u s _ l a b e l . c o n f i g ( t e x t = " 1\~" ,   f o r e g r o u n d = T H E M E S [ T H E M E _ M O D E ] [ " f g " ] ) 
 
 +                         s e l f . p r o g r e s s . s t o p ( ) 
 
 +                         s e l f . p r o g r e s s . p a c k _ f o r g e t ( ) 
 
 +                         
 
 + d e f   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( c o m m a n d ,   l o g _ w i d g e t ,   s t a t u s _ b a r = N o n e ,   o n _ c o m p l e t e = N o n e ) : 
 
           " " " ЏL}TNv^\Q͑[T0Re_zS" " " 
 
 +         g l o b a l   R U N N I N G _ T A S K 
 
 +         
 
 +         #   Yg]	gNR(WЏLc:y(u7b
 
 +         i f   R U N N I N G _ T A S K   i s   n o t   N o n e : 
 
 +                 m e s s a g e b o x . s h o w i n f o ( " NRۏL-N" ,   " I{_S_MRNR[bTQgbLevd\O0" ) 
 
 +                 r e t u r n 
 
 +                 
 
           d e f   r u n _ i n _ t h r e a d ( ) : 
 
 +                 g l o b a l   R U N N I N G _ T A S K 
 
 +                 R U N N I N G _ T A S K   =   c o m m a n d 
 
 +                 
 
 +                 #   fer`h
 
 +                 i f   s t a t u s _ b a r : 
 
 +                         s t a t u s _ b a r . s e t _ r u n n i n g ( T r u e ) 
 
 +                 
 
                   #   U_}TN _YgbLve
 
                   s t a r t _ t i m e   =   d a t e t i m e . d a t e t i m e . n o w ( ) 
 
                   l o g _ w i d g e t . c o n f i g u r e ( s t a t e = t k . N O R M A L ) 
 
                   l o g _ w i d g e t . d e l e t e ( 1 . 0 ,   t k . E N D )     #   nzzKNMRve_
 
 -                 l o g _ w i d g e t . i n s e r t ( t k . E N D ,   f " gbL}TN:   { '   ' . j o i n ( c o m m a n d ) } \ n " ) 
 
 -                 l o g _ w i d g e t . i n s e r t ( t k . E N D ,   f "  _Ye:   { s t a r t _ t i m e . s t r f t i m e ( ' % Y - % m - % d   % H : % M : % S ' ) } \ n " ) 
 
 -                 l o g _ w i d g e t . i n s e r t ( t k . E N D ,   " = "   *   5 0   +   " \ n \ n " ) 
 
 +                 l o g _ w i d g e t . i n s e r t ( t k . E N D ,   f " gbL}TN:   { '   ' . j o i n ( c o m m a n d ) } \ n " ,   " c o m m a n d " ) 
 
 +                 l o g _ w i d g e t . i n s e r t ( t k . E N D ,   f "  _Ye:   { s t a r t _ t i m e . s t r f t i m e ( ' % Y - % m - % d   % H : % M : % S ' ) } \ n " ,   " t i m e " ) 
 
 +                 l o g _ w i d g e t . i n s e r t ( t k . E N D ,   " = "   *   5 0   +   " \ n \ n " ,   " s e p a r a t o r " ) 
 
                   l o g _ w i d g e t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D ) 
 
                   
 
                   #   SSYvs t d o u t Ts t d e r r 
 
 @ @   - 9 4 , 1 0   + 1 5 7 , 1 8   @ @   d e f   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( c o m m a n d ,   l o g _ w i d g e t ) : 
 
                                   e n v = e n v 
 
                           ) 
 
                           
 
 +                         o u t p u t _ d a t a   =   [ ] 
 
                           #   Sv^>f:yQ
 
                           f o r   l i n e   i n   p r o c e s s . s t d o u t : 
 
 +                                 o u t p u t _ d a t a . a p p e n d ( l i n e ) 
 
                                   p r i n t ( l i n e . r s t r i p ( ) )     #   vcSbpS0R]͑[Tvs t d o u t 
 
                                   
 
 +                                 #   \ՋNQ-NcSۏ^Oo`
 
 +                                 i f   s t a t u s _ b a r : 
 
 +                                         p r o g r e s s   =   e x t r a c t _ p r o g r e s s _ f r o m _ l o g ( l i n e ) 
 
 +                                         i f   p r o g r e s s   i s   n o t   N o n e : 
 
 +                                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a   p = p r o g r e s s :   s t a t u s _ b a r . s e t _ s t a t u s ( f " Yt-N:   { p } % [b" ,   p ) ) 
 
 +                                 
 
                           #   I{_ۏz~_g
 
                           p r o c e s s . w a i t ( ) 
 
                           
 
 @ @   - 1 1 0 , 3 5 2   + 1 8 1 , 4 9 4   @ @   d e f   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( c o m m a n d ,   l o g _ w i d g e t ) : 
 
                           p r i n t ( f " ~_ge:   { e n d _ t i m e . s t r f t i m e ( ' % Y - % m - % d   % H : % M : % S ' ) } " ) 
 
                           p r i n t ( f " e:   { d u r a t i o n . t o t a l _ s e c o n d s ( ) : . 2 f }   y" ) 
 
                           
 
 -                         #   YgYtbR>f:ybROo`
 
 -                         i f   p r o c e s s . r e t u r n c o d e   = =   0 : 
 
 -                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   m e s s a g e b o x . s h o w i n f o ( " d\ObR" ,   " Yt[b\ n (Wd a t a / o u t p u t vU_gw~g0" ) ) 
 
 +                         #   SQQ[
 
 +                         o u t p u t _ t e x t   =   ' ' . j o i n ( o u t p u t _ d a t a ) 
 
 +                         
 
 +                         #   hg/f&T/f[teAmz}TNNG0RN" *g~b0RSTv^veN" v`Q
 
 +                         i s _ p i p e l i n e   =   " p i p e l i n e "   i n   c o m m a n d 
 
 +                         n o _ m e r g e _ f i l e s   =   " *g~b0RSTv^veN"   i n   o u t p u t _ t e x t 
 
 +                         
 
 +                         #   Yg/f[teAmzNS/fl	g~b0RSTv^eNRƉ:NbR
 
 +                         i f   i s _ p i p e l i n e   a n d   n o _ m e r g e _ f i l e s : 
 
 +                                 p r i n t ( " [teAmz-N*g~b0RSTv^eNFOvQNekgbLbRƉ:NbR[b" ) 
 
 +                                 i f   s t a t u s _ b a r : 
 
 +                                         l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s t a t u s _ b a r . s e t _ s t a t u s ( " Yt[b" ,   1 0 0 ) ) 
 
 +                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s h o w _ r e s u l t _ p r e v i e w ( c o m m a n d ,   o u t p u t _ t e x t ) ) 
 
                           e l s e : 
 
 -                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   m e s s a g e b o x . s h o w e r r o r ( " d\O1Y%" ,   f " Yt1Y%ԏVx{ p r o c e s s . r e t u r n c o d e } " ) ) 
 
 +                                 #   gbL[bTYt~g
 
 +                                 i f   o n _ c o m p l e t e : 
 
 +                                         l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   o n _ c o m p l e t e ( p r o c e s s . r e t u r n c o d e ,   o u t p u t _ t e x t ) ) 
 
 +                                 
 
 +                                 #   YgYtbR>f:ybROo`
 
 +                                 i f   p r o c e s s . r e t u r n c o d e   = =   0 : 
 
 +                                         i f   s t a t u s _ b a r : 
 
 +                                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s t a t u s _ b a r . s e t _ s t a t u s ( " Yt[b" ,   1 0 0 ) ) 
 
 +                                         l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s h o w _ r e s u l t _ p r e v i e w ( c o m m a n d ,   o u t p u t _ t e x t ) ) 
 
 +                                 e l s e : 
 
 +                                         i f   s t a t u s _ b a r : 
 
 +                                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s t a t u s _ b a r . s e t _ s t a t u s ( f " Yt1Y%  ( ԏVx:   { p r o c e s s . r e t u r n c o d e } ) " ,   0 ) ) 
 
 +                                         l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   m e s s a g e b o x . s h o w e r r o r ( " d\O1Y%" ,   f " Yt1Y%ԏVx{ p r o c e s s . r e t u r n c o d e } " ) ) 
 
                                   
 
                   e x c e p t   E x c e p t i o n   a s   e : 
 
                           p r i n t ( f " \ n gbLQ:   { s t r ( e ) } " ) 
 
 +                         i f   s t a t u s _ b a r : 
 
 +                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s t a t u s _ b a r . s e t _ s t a t u s ( f " gbLQ:   { s t r ( e ) } " ,   0 ) ) 
 
                           l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   m e s s a g e b o x . s h o w e r r o r ( " gbL" ,   f " gbL}TNeQ:   { s t r ( e ) } " ) ) 
 
                   f i n a l l y : 
 
                           #   b`
YSYs t d o u t Ts t d e r r 
 
                           s y s . s t d o u t   =   o l d _ s t d o u t 
 
                           s y s . s t d e r r   =   o l d _ s t d e r r 
 
 +                         
 
 +                         #   NR[b͑nr`
 
 +                         R U N N I N G _ T A S K   =   N o n e 
 
 +                         i f   s t a t u s _ b a r : 
 
 +                                 l o g _ w i d g e t . a f t e r ( 0 ,   l a m b d a :   s t a t u s _ b a r . s e t _ r u n n i n g ( F a l s e ) ) 
 
           
 
           #   (We~z-NЏLMQU I ;^X
 
           T h r e a d ( t a r g e t = r u n _ i n _ t h r e a d ) . s t a r t ( ) 
 
   
 
 - d e f   a d d _ t o _ l o g ( l o g _ w i d g e t ,   t e x t ) : 
 
 -         " " " Te_zSmRe,g" " " 
 
 -         l o g _ w i d g e t . c o n f i g u r e ( s t a t e = t k . N O R M A L ) 
 
 -         l o g _ w i d g e t . i n s e r t ( t k . E N D ,   t e x t ) 
 
 -         l o g _ w i d g e t . s e e ( t k . E N D )     #   ꁨRnR0R^
 
 -         l o g _ w i d g e t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D ) 
 
 + d e f   e x t r a c t _ p r o g r e s s _ f r o m _ l o g ( l o g _ l i n e ) : 
 
 +         " " " Ne_L-NcSۏ^Oo`" " " 
 
 +         #   \Ջ9SM" Ytyb!k  x / y " <h_vۏ^Oo`
 
 +         b a t c h _ m a t c h   =   r e . s e a r c h ( r ' Ytyb!k  ( \ d + ) / ( \ d + ) ' ,   l o g _ l i n e ) 
 
 +         i f   b a t c h _ m a t c h : 
 
 +                 c u r r e n t   =   i n t ( b a t c h _ m a t c h . g r o u p ( 1 ) ) 
 
 +                 t o t a l   =   i n t ( b a t c h _ m a t c h . g r o u p ( 2 ) ) 
 
 +                 r e t u r n   i n t ( c u r r e n t   /   t o t a l   *   1 0 0 ) 
 
 +         
 
 +         #   \Ջ9SM~vRk<h_
 
 +         p e r c e n t _ m a t c h   =   r e . s e a r c h ( r ' ( \ d + ) % ' ,   l o g _ l i n e ) 
 
 +         i f   p e r c e n t _ m a t c h : 
 
 +                 r e t u r n   i n t ( p e r c e n t _ m a t c h . g r o u p ( 1 ) ) 
 
 +         
 
 +         r e t u r n   N o n e 
 
   
 
 - d e f   s e l e c t _ f i l e ( l o g _ w i d g e t ) : 
 
 -         " " " 	bVGreNv^
Y6R0Rd a t a / i n p u t vU_" " " 
 
 -         #   nxOvU_X[(W
 
 -         e n s u r e _ d i r e c t o r i e s ( ) 
 
 -         
 
 -         #   SeQvU_v~[_
 
 -         i n p u t _ d i r   =   o s . p a t h . a b s p a t h ( " d a t a / i n p u t " ) 
 
 -         
 
 -         f i l e _ p a t h   =   f i l e d i a l o g . a s k o p e n f i l e n a m e ( 
 
 -                 t i t l e = " 	bYtvVGreN" , 
 
 -                 i n i t i a l d i r = i n p u t _ d i r ,     #   ؞Sb _d a t a / i n p u t vU_
 
 -                 f i l e t y p e s = [ ( " VGreN" ,   " * . j p g   * . j p e g   * . p n g   * . b m p " ) ] 
 
 -         ) 
 
 -         
 
 -         i f   n o t   f i l e _ p a t h : 
 
 -                 r e t u r n   N o n e 
 
 + d e f   s h o w _ r e s u l t _ p r e v i e w ( c o m m a n d ,   o u t p u t ) : 
 
 +         " " " >f:yYt~gȉ" " " 
 
 +         #   9hnc}TN{|WcS
NTv~gOo`
 
 +         i f   " o c r "   i n   c o m m a n d : 
 
 +                 s h o w _ o c r _ r e s u l t _ p r e v i e w ( o u t p u t ) 
 
 +         e l i f   " e x c e l "   i n   c o m m a n d : 
 
 +                 s h o w _ e x c e l _ r e s u l t _ p r e v i e w ( o u t p u t ) 
 
 +         e l i f   " m e r g e "   i n   c o m m a n d : 
 
 +                 s h o w _ m e r g e _ r e s u l t _ p r e v i e w ( o u t p u t ) 
 
 +         e l i f   " p i p e l i n e "   i n   c o m m a n d : 
 
 +                 s h o w _ p i p e l i n e _ r e s u l t _ p r e v i e w ( o u t p u t ) 
 
 +         e l s e : 
 
 +                 m e s s a g e b o x . s h o w i n f o ( " Yt[b" ,   " d\O]bR[b\ n (Wd a t a / o u t p u t vU_gw~g0" ) 
 
 + 
 
 + d e f   s h o w _ o c r _ r e s u l t _ p r e v i e w ( o u t p u t ) : 
 
 +         " " " >f:yO C R Yt~gȉ" " " 
 
 +         #   cSYtveNpeϑ
 
 +         f i l e s _ m a t c h   =   r e . s e a r c h ( r ' ~b0R  ( \ d + )   *NVGreNvQ-N  ( \ d + )   *N*gYt' ,   o u t p u t ) 
 
 +         p r o c e s s e d _ m a t c h   =   r e . s e a r c h ( r ' @b	gVGrYt[b,   ;`:   ( \ d + ) ,   bR:   ( \ d + ) ' ,   o u t p u t ) 
 
 +         
 
 +         i f   p r o c e s s e d _ m a t c h : 
 
 +                 t o t a l   =   i n t ( p r o c e s s e d _ m a t c h . g r o u p ( 1 ) ) 
 
 +                 s u c c e s s   =   i n t ( p r o c e s s e d _ m a t c h . g r o u p ( 2 ) ) 
 
                   
 
 -         #   U_	beNvOo`
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]	beN:   { f i l e _ p a t h } \ n " ) 
 
 -         
 
 -         #   {vh_Y~>e(Wd a t a / i n p u t -N
 
 -         o u t p u t _ p a t h   =   o s . p a t h . j o i n ( " d a t a / i n p u t " ,   o s . p a t h . b a s e n a m e ( f i l e _ p a t h ) ) 
 
 -         a b s _ o u t p u t _ p a t h   =   o s . p a t h . a b s p a t h ( o u t p u t _ p a t h ) 
 
 -         
 
 -         #   hg/f&T/fT N*NeN
 
 -         i f   o s . p a t h . n o r m p a t h ( o s . p a t h . a b s p a t h ( f i l e _ p a t h ) )   ! =   o s . p a t h . n o r m p a t h ( a b s _ o u t p u t _ p a t h ) : 
 
 -                 #   Yg/f
NTveNR
Y6R
 
 -                 t r y : 
 
 -                         s h u t i l . c o p y 2 ( f i l e _ p a t h ,   o u t p u t _ p a t h ) 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]
Y6ReN0RYtvU_:   { o u t p u t _ p a t h } \ n " ) 
 
 -                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " 
Y6ReN1Y%:   { e } \ n " ) 
 
 -                         m e s s a g e b o x . s h o w e r r o r ( " " ,   f " 
Y6ReN1Y%:   { e } " ) 
 
 -                         r e t u r n   N o n e 
 
 -         
 
 -         #   ԏV~[_nxO}TNLYtcknx
 
 -         r e t u r n   a b s _ o u t p u t _ p a t h 
 
 +                 #   R^~gȉ[݋Fh
 
 +                 p r e v i e w   =   t k . T o p l e v e l ( ) 
 
 +                 p r e v i e w . t i t l e ( " O C R Yt~g" ) 
 
 +                 p r e v i e w . g e o m e t r y ( " 4 0 0 x 3 0 0 " ) 
 
 +                 p r e v i e w . r e s i z a b l e ( F a l s e ,   F a l s e ) 
 
 +                 
 
 +                 #   E\-N>f:y
 
 +                 c e n t e r _ w i n d o w ( p r e v i e w ) 
 
 +                 
 
 +                 #   mRQ[
 
 +                 t k . L a b e l ( p r e v i e w ,   t e x t = " O C R Yt[b" ,   f o n t = ( " A r i a l " ,   1 6 ,   " b o l d " ) ) . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 r e s u l t _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +                 r e s u l t _ f r a m e . p a c k ( p a d y = 1 0 ,   f i l l = t k . B O T H ,   e x p a n d = T r u e ) 
 
 +                 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " ;`qQYt:   { t o t a l }   *NeN" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " bRYt:   { s u c c e s s }   *NeN" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " 1Y%peϑ:   { t o t a l   -   s u c c e s s }   *NeN" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 
 
 +                 #   Yt~gċ0O
 
 +                 i f   s u c c e s s   = =   t o t a l : 
 
 +                         r e s u l t _ t e x t   =   " hQYtbR" 
 
 +                         r e s u l t _ c o l o r   =   " # 2 8 a 7 4 5 " 
 
 +                 e l i f   s u c c e s s   >   t o t a l   *   0 . 8 : 
 
 +                         r e s u l t _ t e x t   =   " 'YRYtbR0" 
 
 +                         r e s u l t _ c o l o r   =   " # f f c 1 0 7 " 
 
 +                 e l s e : 
 
 +                         r e s u l t _ t e x t   =   " Yt1Y%Yhge_0" 
 
 +                         r e s u l t _ c o l o r   =   " # d c 3 5 4 5 " 
 
 +                         
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = r e s u l t _ t e x t ,   f o n t = ( " A r i a l " ,   1 2 ,   " b o l d " ) ,   f g = r e s u l t _ c o l o r ) . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 #   mR	c
 
 +                 b u t t o n _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +                 b u t t o n _ f r a m e . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " gwQeN" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o s . p a t h . a b s p a t h ( " d a t a / o u t p u t " ) ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " sQ" ,   c o m m a n d = p r e v i e w . d e s t r o y ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +         e l s e : 
 
 +                 m e s s a g e b o x . s h o w i n f o ( " O C R Yt[b" ,   " O C R Yt][b(Wd a t a / o u t p u t vU_gw~g0" ) 
 
   
 
 - d e f   s e l e c t _ e x c e l _ f i l e ( l o g _ w i d g e t ) : 
 
 -         " " " 	bE x c e l eNv^
Y6R0Rd a t a / o u t p u t vU_" " " 
 
 -         #   nxOvU_X[(W
 
 -         e n s u r e _ d i r e c t o r i e s ( ) 
 
 -         
 
 -         #   SQvU_v~[_
 
 -         o u t p u t _ d i r   =   o s . p a t h . a b s p a t h ( " d a t a / o u t p u t " ) 
 
 -         
 
 -         f i l e _ p a t h   =   f i l e d i a l o g . a s k o p e n f i l e n a m e ( 
 
 -                 t i t l e = " 	bYtvE x c e l eN" , 
 
 -                 i n i t i a l d i r = o u t p u t _ d i r ,     #   ؞Sb _d a t a / o u t p u t vU_
 
 -                 f i l e t y p e s = [ ( " E x c e l eN" ,   " * . x l s x   * . x l s " ) ] 
 
 -         ) 
 
 -         
 
 -         i f   n o t   f i l e _ p a t h : 
 
 -                 r e t u r n   N o n e 
 
 + d e f   s h o w _ e x c e l _ r e s u l t _ p r e v i e w ( o u t p u t ) : 
 
 +         " " " >f:yE x c e l Yt~gȉ" " " 
 
 +         #   cSYtvE x c e l Oo`
 
 +         e x t r a c t _ m a t c h   =   r e . s e a r c h ( r ' cS0R  ( \ d + )   *NFUTOo`' ,   o u t p u t ) 
 
 +         f i l e _ m a t c h   =   r e . s e a r c h ( r ' Ǒ-US]OX[0R:   ( . + ? ) ( ? : \ n | $ ) ' ,   o u t p u t ) 
 
 +         
 
 +         i f   e x t r a c t _ m a t c h   a n d   f i l e _ m a t c h : 
 
 +                 p r o d u c t s _ c o u n t   =   i n t ( e x t r a c t _ m a t c h . g r o u p ( 1 ) ) 
 
 +                 o u t p u t _ f i l e   =   f i l e _ m a t c h . g r o u p ( 1 ) 
 
                   
 
 -         #   U_	beNvOo`
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]	beN:   { f i l e _ p a t h } \ n " ) 
 
 -         
 
 -         #   {vh_Y~>e(Wd a t a / o u t p u t -N
 
 -         o u t p u t _ p a t h   =   o s . p a t h . j o i n ( " d a t a / o u t p u t " ,   o s . p a t h . b a s e n a m e ( f i l e _ p a t h ) ) 
 
 -         a b s _ o u t p u t _ p a t h   =   o s . p a t h . a b s p a t h ( o u t p u t _ p a t h ) 
 
 -         
 
 -         #   hg/f&T/fT N*NeN
 
 -         i f   o s . p a t h . n o r m p a t h ( o s . p a t h . a b s p a t h ( f i l e _ p a t h ) )   ! =   o s . p a t h . n o r m p a t h ( a b s _ o u t p u t _ p a t h ) : 
 
 -                 #   Yg/f
NTveNR
Y6R
 
 +                 #   R^~gȉ[݋Fh
 
 +                 p r e v i e w   =   t k . T o p l e v e l ( ) 
 
 +                 p r e v i e w . t i t l e ( " E x c e l Yt~g" ) 
 
 +                 p r e v i e w . g e o m e t r y ( " 4 5 0 x 3 2 0 " ) 
 
 +                 p r e v i e w . r e s i z a b l e ( F a l s e ,   F a l s e ) 
 
 +                 
 
 +                 #   O9_zE\-N>f:y
 
 +                 c e n t e r _ w i n d o w ( p r e v i e w ) 
 
 +                 
 
 +                 #   mRQ[
 
 +                 t k . L a b e l ( p r e v i e w ,   t e x t = " E x c e l Yt[b" ,   f o n t = ( " A r i a l " ,   1 6 ,   " b o l d " ) ) . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 r e s u l t _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +                 r e s u l t _ f r a m e . p a c k ( p a d y = 1 0 ,   f i l l = t k . B O T H ,   e x p a n d = T r u e ) 
 
 +                 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " cSFUTpeϑ:   { p r o d u c t s _ c o u n t }   *N" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " QeN:   { o s . p a t h . b a s e n a m e ( o u t p u t _ f i l e ) } " ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 
 
 +                 #   YtbRc:y
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = " Ǒ-US]bRub" ,   f o n t = ( " A r i a l " ,   1 2 ,   " b o l d " ) ,   f g = " # 2 8 a 7 4 5 " ) . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 #   eNOo`Fh
 
 +                 f i l e _ f r a m e   =   t k . F r a m e ( r e s u l t _ f r a m e ,   r e l i e f = t k . G R O O V E ,   b o r d e r w i d t h = 1 ) 
 
 +                 f i l e _ f r a m e . p a c k ( f i l l = t k . X ,   p a d x = 1 5 ,   p a d y = 5 ) 
 
 +                 
 
 +                 t k . L a b e l ( f i l e _ f r a m e ,   t e x t = " eNOo`" ,   f o n t = ( " A r i a l " ,   1 0 ,   " b o l d " ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 1 0 ,   p a d y = 5 ) 
 
 +                 
 
 +                 #   SeN'Y\Te
 
                   t r y : 
 
 -                         s h u t i l . c o p y 2 ( f i l e _ p a t h ,   o u t p u t _ p a t h ) 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]
Y6ReN0RYtvU_:   { o u t p u t _ p a t h } \ n " ) 
 
 -                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " 
Y6ReN1Y%:   { e } \ n " ) 
 
 -                         m e s s a g e b o x . s h o w e r r o r ( " " ,   f " 
Y6ReN1Y%:   { e } " ) 
 
 -                         r e t u r n   N o n e 
 
 -         
 
 -         #   ԏV~[_nxO}TNLYtcknx
 
 -         r e t u r n   a b s _ o u t p u t _ p a t h 
 
 +                         f i l e _ s i z e   =   o s . p a t h . g e t s i z e ( o u t p u t _ f i l e ) 
 
 +                         f i l e _ t i m e   =   d a t e t i m e . d a t e t i m e . f r o m t i m e s t a m p ( o s . p a t h . g e t m t i m e ( o u t p u t _ f i l e ) ) 
 
 +                         
 
 +                         s i z e _ t e x t   =   f " { f i l e _ s i z e   /   1 0 2 4 : . 1 f }   K B "   i f   f i l e _ s i z e   <   1 0 2 4 * 1 0 2 4   e l s e   f " { f i l e _ s i z e   /   ( 1 0 2 4 * 1 0 2 4 ) : . 1 f }   M B " 
 
 +                         
 
 +                         t k . L a b e l ( f i l e _ f r a m e ,   t e x t = f " eN'Y\:   { s i z e _ t e x t } " ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 1 0 ,   p a d y = 2 ) 
 
 +                         t k . L a b e l ( f i l e _ f r a m e ,   t e x t = f " R^e:   { f i l e _ t i m e . s t r f t i m e ( ' % Y - % m - % d   % H : % M : % S ' ) } " ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 1 0 ,   p a d y = 2 ) 
 
 +                 e x c e p t : 
 
 +                         t k . L a b e l ( f i l e _ f r a m e ,   t e x t = " elSeNOo`" ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 1 0 ,   p a d y = 2 ) 
 
 +                 
 
 +                 #   mR	c
 
 +                 b u t t o n _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +                 b u t t o n _ f r a m e . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sb _eN" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o u t p u t _ f i l e ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 5 ) 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sb _@b(WeN9Y" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o s . p a t h . d i r n a m e ( o u t p u t _ f i l e ) ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 5 ) 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " sQ" ,   c o m m a n d = p r e v i e w . d e s t r o y ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 5 ) 
 
 +         e l s e : 
 
 +                 m e s s a g e b o x . s h o w i n f o ( " E x c e l Yt[b" ,   " E x c e l Yt][b(Wd a t a / o u t p u t vU_gw~g0" ) 
 
   
 
 - d e f   p r o c e s s _ s i n g l e _ i m a g e ( l o g _ w i d g e t ) : 
 
 -         " " " YtUS*NVGr" " " 
 
 -         f i l e _ p a t h   =   s e l e c t _ f i l e ( l o g _ w i d g e t ) 
 
 -         i f   f i l e _ p a t h : 
 
 -                 #   nxOeNX[(W
 
 -                 i f   o s . p a t h . e x i s t s ( f i l e _ p a t h ) : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ck(WYtVGr:   { o s . p a t h . b a s e n a m e ( f i l e _ p a t h ) } \ n " ) 
 
 -                         #   O(u~[_v^c[vcQ0Rd a t a / o u t p u t 
 
 -                         r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " o c r " ,   " - - i n p u t " ,   f i l e _ p a t h ] ,   l o g _ w i d g e t ) 
 
 -                 e l s e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " eN
NX[(W:   { f i l e _ p a t h } \ n " ) 
 
 -                         m e s s a g e b o x . s h o w e r r o r ( " " ,   f " eN
NX[(W:   { f i l e _ p a t h } " ) 
 
 + d e f   s h o w _ m e r g e _ r e s u l t _ p r e v i e w ( o u t p u t ) : 
 
 +         " " " >f:yTv^~gȉ" " " 
 
 +         #   cSTv^Oo`
 
 +         m e r g e d _ m a t c h   =   r e . s e a r c h ( r ' Tv^N  ( \ d + )   *NǑ-US' ,   o u t p u t ) 
 
 +         p r o d u c t _ m a t c h   =   r e . s e a r c h ( r ' qQYt  ( \ d + )   *NFUT' ,   o u t p u t ) 
 
 +         o u t p u t _ m a t c h   =   r e . s e a r c h ( r ' ]OX[0R:   ( . + ? ) ( ? : \ n | $ ) ' ,   o u t p u t ) 
 
 +         
 
 +         i f   m e r g e d _ m a t c h   a n d   o u t p u t _ m a t c h : 
 
 +                 m e r g e d _ c o u n t   =   i n t ( m e r g e d _ m a t c h . g r o u p ( 1 ) ) 
 
 +                 p r o d u c t _ c o u n t   =   i n t ( p r o d u c t _ m a t c h . g r o u p ( 1 ) )   i f   p r o d u c t _ m a t c h   e l s e   0 
 
 +                 o u t p u t _ f i l e   =   o u t p u t _ m a t c h . g r o u p ( 1 ) 
 
 +                 
 
 +                 #   R^~gȉ[݋Fh
 
 +                 p r e v i e w   =   t k . T o p l e v e l ( ) 
 
 +                 p r e v i e w . t i t l e ( " Ǒ-USTv^~g" ) 
 
 +                 p r e v i e w . g e o m e t r y ( " 4 5 0 x 3 0 0 " ) 
 
 +                 p r e v i e w . r e s i z a b l e ( F a l s e ,   F a l s e ) 
 
 +                 
 
 +                 #   n;N
 
 +                 a p p l y _ t h e m e ( p r e v i e w ) 
 
 +                 
 
 +                 #   mRQ[
 
 +                 t k . L a b e l ( p r e v i e w ,   t e x t = " Ǒ-USTv^[b" ,   f o n t = ( " A r i a l " ,   1 6 ,   " b o l d " ) ) . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 r e s u l t _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +                 r e s u l t _ f r a m e . p a c k ( p a d y = 1 0 ,   f i l l = t k . B O T H ,   e x p a n d = T r u e ) 
 
 +                 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " Tv^Ǒ-USpeϑ:   { m e r g e d _ c o u n t }   *N" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " YtFUTpeϑ:   { p r o d u c t _ c o u n t }   *N" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = f " QeN:   { o s . p a t h . b a s e n a m e ( o u t p u t _ f i l e ) } " ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 
 
 +                 #   YtbRc:y
 
 +                 t k . L a b e l ( r e s u l t _ f r a m e ,   t e x t = " Ǒ-US]bRTv^" ,   f o n t = ( " A r i a l " ,   1 2 ,   " b o l d " ) ,   f g = T H E M E S [ T H E M E _ M O D E ] [ " s u c c e s s " ] ) . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 #   mR	c
 
 +                 b u t t o n _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +                 b u t t o n _ f r a m e . p a c k ( p a d y = 1 0 ) 
 
 +                 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sb _eN" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o u t p u t _ f i l e ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sb _@b(WeN9Y" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o s . p a t h . d i r n a m e ( o u t p u t _ f i l e ) ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " sQ" ,   c o m m a n d = p r e v i e w . d e s t r o y ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
           e l s e : 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " *g	beNd\O]Sm\ n " ) 
 
 +                 m e s s a g e b o x . s h o w i n f o ( " Ǒ-USTv^[b" ,   " Ǒ-USTv^][b(Wd a t a / o u t p u t vU_gw~g0" ) 
 
   
 
 - d e f   p r o c e s s _ e x c e l _ f i l e ( l o g _ w i d g e t ) : 
 
 -         " " " YtE x c e l eN" " " 
 
 -         f i l e _ p a t h   =   s e l e c t _ e x c e l _ f i l e ( l o g _ w i d g e t ) 
 
 -         i f   f i l e _ p a t h : 
 
 -                 #   nxOeNX[(W
 
 -                 i f   o s . p a t h . e x i s t s ( f i l e _ p a t h ) : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ck(WYtE x c e l eN:   { o s . p a t h . b a s e n a m e ( f i l e _ p a t h ) } \ n " ) 
 
 -                         #   O(u~[_
 
 -                         r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " e x c e l " ,   " - - i n p u t " ,   f i l e _ p a t h ] ,   l o g _ w i d g e t ) 
 
 + d e f   s h o w _ p i p e l i n e _ r e s u l t _ p r e v i e w ( o u t p u t ) : 
 
 +         " " " >f:y[teAmz~gȉ" " " 
 
 +         #   cSsQ.Oo`
 
 +         o c r _ m a t c h   =   r e . s e a r c h ( r ' @b	gVGrYt[b,   ;`:   ( \ d + ) ,   bR:   ( \ d + ) ' ,   o u t p u t ) 
 
 +         e x c e l _ m a t c h   =   r e . s e a r c h ( r ' cS0R  ( \ d + )   *NFUTOo`' ,   o u t p u t ) 
 
 +         o u t p u t _ f i l e _ m a t c h   =   r e . s e a r c h ( r ' Ǒ-US]OX[0R:   ( . + ? ) ( ? : \ n | $ ) ' ,   o u t p u t ) 
 
 +         
 
 +         #   R^~gȉ[݋Fh
 
 +         p r e v i e w   =   t k . T o p l e v e l ( ) 
 
 +         p r e v i e w . t i t l e ( " [teAmzYt~g" ) 
 
 +         p r e v i e w . g e o m e t r y ( " 5 0 0 x 4 0 0 " ) 
 
 +         p r e v i e w . r e s i z a b l e ( F a l s e ,   F a l s e ) 
 
 +         
 
 +         #   E\-N>f:y
 
 +         c e n t e r _ w i n d o w ( p r e v i e w ) 
 
 +         
 
 +         #   mRQ[
 
 +         t k . L a b e l ( p r e v i e w ,   t e x t = " [teYtAmz][b" ,   f o n t = ( " A r i a l " ,   1 6 ,   " b o l d " ) ) . p a c k ( p a d y = 1 0 ) 
 
 +         
 
 +         #   mRYt~gc:ysSOl	gSTv^eN_N>f:ybR	
 
 +         n o _ f i l e s _ m a t c h   =   r e . s e a r c h ( r ' *g~b0RSTv^veN' ,   o u t p u t ) 
 
 +         i f   n o _ f i l e s _ m a t c h : 
 
 +                 t k . L a b e l ( p r e v i e w ,   t e x t = " *g~b0RSTv^eNFOvQNek]bRgbL" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( p a d y = 0 ) 
 
 +         
 
 +         r e s u l t _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +         r e s u l t _ f r a m e . p a c k ( p a d y = 1 0 ,   f i l l = t k . B O T H ,   e x p a n d = T r u e ) 
 
 +         
 
 +         #   R^YL~g:SW
 
 +         r e s u l t _ t e x t   =   s c r o l l e d t e x t . S c r o l l e d T e x t ( r e s u l t _ f r a m e ,   w r a p = t k . W O R D ,   h e i g h t = 1 5 ,   w i d t h = 6 0 ) 
 
 +         r e s u l t _ t e x t . p a c k ( f i l l = t k . B O T H ,   e x p a n d = T r u e ,   p a d x = 1 5 ,   p a d y = 5 ) 
 
 +         r e s u l t _ t e x t . c o n f i g u r e ( s t a t e = t k . N O R M A L ) 
 
 +         
 
 +         #   kXEQ~ge,g
 
 +         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " = = = = =   AmzgbL~g  = = = = = \ n \ n " ,   " t i t l e " ) 
 
 +         
 
 +         #   O C R Yt~g
 
 +         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " ek1 :   O C R Ƌ+R\ n " ,   " s t e p " ) 
 
 +         i f   o c r _ m a t c h : 
 
 +                 t o t a l   =   i n t ( o c r _ m a t c h . g r o u p ( 1 ) ) 
 
 +                 s u c c e s s   =   i n t ( o c r _ m a t c h . g r o u p ( 2 ) ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   f "     YtVGr:   { t o t a l }   *N\ n " ,   " i n f o " ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   f "     bRƋ+R:   { s u c c e s s }   *N\ n " ,   " i n f o " ) 
 
 +                 i f   s u c c e s s   = =   t o t a l : 
 
 +                         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   "     ~g:   hQƋ+RbR\ n " ,   " s u c c e s s " ) 
 
                   e l s e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " eN
NX[(W:   { f i l e _ p a t h } \ n " ) 
 
 -                         m e s s a g e b o x . s h o w e r r o r ( " " ,   f " eN
NX[(W:   { f i l e _ p a t h } " ) 
 
 +                         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   f "     ~g:   RƋ+RbR  ( { s u c c e s s } / { t o t a l } ) \ n " ,   " w a r n i n g " ) 
 
           e l s e : 
 
 -                 #   Yg*g	beN\ՋYt gevE x c e l 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " *g	beN\ՋYt gevE x c e l eN\ n " ) 
 
 -                 r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " e x c e l " ] ,   l o g _ w i d g e t ) 
 
 - 
 
 - d e f   o r g a n i z e _ p r o j e c t _ f i l e s ( l o g _ w i d g e t ) : 
 
 -         " " " tetyv-NveN0RcknxMOn" " " 
 
 -         #   nxOvU_X[(W
 
 -         e n s u r e _ d i r e c t o r i e s ( ) 
 
 -         
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   "  _YtetyveN. . . \ n " ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   "     ~g:   eO C R YtbYtOo`
N[te\ n " ,   " w a r n i n g " ) 
 
 +         
 
 +         #   E x c e l Yt~g
 
 +         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " \ n ek2 :   E x c e l Yt\ n " ,   " s t e p " ) 
 
 +         i f   e x c e l _ m a t c h : 
 
 +                 p r o d u c t s   =   i n t ( e x c e l _ m a t c h . g r o u p ( 1 ) ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   f "     cSFUT:   { p r o d u c t s }   *N\ n " ,   " i n f o " ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   "     ~g:   bRubǑ-US\ n " ,   " s u c c e s s " ) 
 
 +                 i f   o u t p u t _ f i l e _ m a t c h : 
 
 +                         o u t p u t _ f i l e   =   o u t p u t _ f i l e _ m a t c h . g r o u p ( 1 ) 
 
 +                         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   f "     QeN:   { o s . p a t h . b a s e n a m e ( o u t p u t _ f i l e ) } \ n " ,   " i n f o " ) 
 
 +         e l s e : 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   "     ~g:   eE x c e l YtbYtOo`
N[te\ n " ,   " w a r n i n g " ) 
 
           
 
 -         #   ly9hvU_eN
 
 -         f i l e s _ m o v e d   =   0 
 
 +         #   ;`SOċ0O
 
 +         r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " \ n = = = = =   teSOċ0O  = = = = = \ n " ,   " t i t l e " ) 
 
           
 
 -         #   Yte_eN
 
 -         l o g _ f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( ' . ' )   i f   f . e n d s w i t h ( ' . l o g ' ) ] 
 
 -         f o r   l o g _ f i l e   i n   l o g _ f i l e s : 
 
 -                 t r y : 
 
 -                         s r c _ p a t h   =   o s . p a t h . j o i n ( ' . ' ,   l o g _ f i l e ) 
 
 -                         d s t _ p a t h   =   o s . p a t h . j o i n ( ' l o g s ' ,   l o g _ f i l e ) 
 
 -                         i f   n o t   o s . p a t h . e x i s t s ( d s t _ p a t h )   o r   o s . p a t h . g e t m t i m e ( s r c _ p a t h )   >   o s . p a t h . g e t m t i m e ( d s t _ p a t h ) : 
 
 -                                 s h u t i l . c o p y 2 ( s r c _ p a t h ,   d s t _ p a t h ) 
 
 -                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]yRe_eN:   { s r c _ p a t h }   - >   { d s t _ p a t h } \ n " ) 
 
 -                                 f i l e s _ m o v e d   + =   1 
 
 -                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yRe_eNQ:   { e } \ n " ) 
 
 +         h a s _ e r r o r s   =   " "   i n   o u t p u t   o r   " 1Y%"   i n   o u t p u t 
 
           
 
 -         #   YtJ S O N eN
 
 -         j s o n _ f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( ' . ' )   i f   f . e n d s w i t h ( ' . j s o n ' ) ] 
 
 -         f o r   j s o n _ f i l e   i n   j s o n _ f i l e s : 
 
 -                 t r y : 
 
 -                         s r c _ p a t h   =   o s . p a t h . j o i n ( ' . ' ,   j s o n _ f i l e ) 
 
 -                         d s t _ p a t h   =   o s . p a t h . j o i n ( ' d a t a ' ,   j s o n _ f i l e ) 
 
 -                         i f   n o t   o s . p a t h . e x i s t s ( d s t _ p a t h )   o r   o s . p a t h . g e t m t i m e ( s r c _ p a t h )   >   o s . p a t h . g e t m t i m e ( d s t _ p a t h ) : 
 
 -                                 s h u t i l . c o p y 2 ( s r c _ p a t h ,   d s t _ p a t h ) 
 
 -                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]yRU_eN:   { s r c _ p a t h }   - >   { d s t _ p a t h } \ n " ) 
 
 -                                 f i l e s _ m o v e d   + =   1 
 
 -                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yRU_eNQ:   { e } \ n " ) 
 
 -         
 
 -         #   Yti n p u t To u t p u t vU_
 
 -         f o r   o l d _ d i r ,   n e w _ d i r   i n   { " i n p u t " :   " d a t a / i n p u t " ,   " o u t p u t " :   " d a t a / o u t p u t " } . i t e m s ( ) : 
 
 -                 i f   o s . p a t h . e x i s t s ( o l d _ d i r )   a n d   o s . p a t h . i s d i r ( o l d _ d i r ) : 
 
 -                         f o r   f i l e   i n   o s . l i s t d i r ( o l d _ d i r ) : 
 
 -                                 s r c _ p a t h   =   o s . p a t h . j o i n ( o l d _ d i r ,   f i l e ) 
 
 -                                 d s t _ p a t h   =   o s . p a t h . j o i n ( n e w _ d i r ,   f i l e ) 
 
 -                                 t r y : 
 
 -                                         i f   o s . p a t h . i s f i l e ( s r c _ p a t h ) : 
 
 -                                                 i f   n o t   o s . p a t h . e x i s t s ( d s t _ p a t h )   o r   o s . p a t h . g e t m t i m e ( s r c _ p a t h )   >   o s . p a t h . g e t m t i m e ( d s t _ p a t h ) : 
 
 -                                                         s h u t i l . c o p y 2 ( s r c _ p a t h ,   d s t _ p a t h ) 
 
 -                                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]lyeN:   { s r c _ p a t h }   - >   { d s t _ p a t h } \ n " ) 
 
 -                                                         f i l e s _ m o v e d   + =   1 
 
 -                                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yReNQ:   { e } \ n " ) 
 
 -         
 
 -         #   >f:y~g
 
 -         i f   f i l e s _ m o v e d   >   0 : 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " tet[bqQtet  { f i l e s _ m o v e d }   *NeN\ n " ) 
 
 -                 m e s s a g e b o x . s h o w i n f o ( " tet[b" ,   f " ]tet  { f i l e s _ m o v e d }   *NeN0RcknxMOn0\ n " 
 
 -                                                       " SYeNOYu(WSMOnNnxOpenc[hQ0" ) 
 
 +         i f   n o _ f i l e s _ m a t c h : 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " l	g~b0RSTv^veNFOYtAmz]bR[b0\ n " ,   " w a r n i n g " ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " SN	bSb _E x c e l eNbgwQeN9Y0\ n " ,   " i n f o " ) 
 
 +         e l i f   o c r _ m a t c h   a n d   e x c e l _ m a t c h   a n d   n o t   h a s _ e r r o r s : 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " Amz[tegbLbR\ n " ,   " s u c c e s s " ) 
 
 +         e l i f   o c r _ m a t c h   o r   e x c e l _ m a t c h : 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " AmzRgbLbRhge_S`0\ n " ,   " w a r n i n g " ) 
 
           e l s e : 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " l	g tetveN\ n " ) 
 
 -                 m e s s a g e b o x . s h o w i n f o ( " tet[b" ,   " l	g tetveN0" ) 
 
 - 
 
 - d e f   c l e a n _ d a t a _ f i l e s ( l o g _ w i d g e t ) : 
 
 -         " " " ntd a t a vU_-NveN" " " 
 
 -         #   nxOvU_X[(W
 
 -         e n s u r e _ d i r e c t o r i e s ( ) 
 
 +                 r e s u l t _ t e x t . i n s e r t ( t k . E N D ,   " AmzgbLSX[(Wgw~e_0\ n " ,   " e r r o r " ) 
 
           
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   "  _YnteN. . . \ n " ) 
 
 +         #   nh~{7h_
 
 +         r e s u l t _ t e x t . t a g _ c o n f i g u r e ( " t i t l e " ,   f o n t = ( " A r i a l " ,   1 2 ,   " b o l d " ) ) 
 
 +         r e s u l t _ t e x t . t a g _ c o n f i g u r e ( " s t e p " ,   f o n t = ( " A r i a l " ,   1 1 ,   " b o l d " ) ) 
 
 +         r e s u l t _ t e x t . t a g _ c o n f i g u r e ( " i n f o " ,   f o n t = ( " A r i a l " ,   1 0 ) ) 
 
 +         r e s u l t _ t e x t . t a g _ c o n f i g u r e ( " s u c c e s s " ,   f o n t = ( " A r i a l " ,   1 0 ,   " b o l d " ) ,   f o r e g r o u n d = " # 2 8 a 7 4 5 " ) 
 
 +         r e s u l t _ t e x t . t a g _ c o n f i g u r e ( " w a r n i n g " ,   f o n t = ( " A r i a l " ,   1 0 ,   " b o l d " ) ,   f o r e g r o u n d = " # f f c 1 0 7 " ) 
 
 +         r e s u l t _ t e x t . t a g _ c o n f i g u r e ( " e r r o r " ,   f o n t = ( " A r i a l " ,   1 0 ,   " b o l d " ) ,   f o r e g r o u n d = " # d c 3 5 4 5 " ) 
 
           
 
 -         #   S ntvvU_
 
 -         i n p u t _ d i r   =   o s . p a t h . a b s p a t h ( " d a t a / i n p u t " ) 
 
 -         o u t p u t _ d i r   =   o s . p a t h . a b s p a t h ( " d a t a / o u t p u t " ) 
 
 +         r e s u l t _ t e x t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D ) 
 
           
 
 -         #   ~eNOo`
 
 -         i n p u t _ f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( i n p u t _ d i r )   i f   o s . p a t h . i s f i l e ( o s . p a t h . j o i n ( i n p u t _ d i r ,   f ) ) ] 
 
 -         o u t p u t _ f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( o u t p u t _ d i r )   i f   o s . p a t h . i s f i l e ( o s . p a t h . j o i n ( o u t p u t _ d i r ,   f ) ) ] 
 
 -         
 
 -         #   >f:y~Oo`
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " eQvU_  ( { i n p u t _ d i r } )   qQ	g  { l e n ( i n p u t _ f i l e s ) }   *NeN\ n " ) 
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " QvU_  ( { o u t p u t _ d i r } )   qQ	g  { l e n ( o u t p u t _ f i l e s ) }   *NeN\ n " ) 
 
 +         #   mR	c
 
 +         b u t t o n _ f r a m e   =   t k . F r a m e ( p r e v i e w ) 
 
 +         b u t t o n _ f r a m e . p a c k ( p a d y = 1 0 ) 
 
           
 
 -         #   >f:ynx[݋Fh
 
 -         i f   n o t   i n p u t _ f i l e s   a n d   n o t   o u t p u t _ f i l e s : 
 
 -                 m e s s a g e b o x . s h o w i n f o ( " nteN" ,   " l	g ntveN" ) 
 
 -                 r e t u r n 
 
 +         i f   o u t p u t _ f i l e _ m a t c h : 
 
 +                 o u t p u t _ f i l e   =   o u t p u t _ f i l e _ m a t c h . g r o u p ( 1 ) 
 
 +                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sb _E x c e l eN" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o u t p u t _ f i l e ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +         e l s e : 
 
 +                 #   Ygl	g~b0RTv^TveNFOE x c e l YtbRcOSb _ geE x c e l eNv	y
 
 +                 i f   e x c e l _ m a t c h : 
 
 +                         #   ~b0RQvU_-N gevǑ-USE x c e l eN
 
 +                         o u t p u t _ d i r   =   o s . p a t h . a b s p a t h ( " d a t a / o u t p u t " ) 
 
 +                         e x c e l _ f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( o u t p u t _ d i r )   i f   f . s t a r t s w i t h ( ' Ǒ-US_ ' )   a n d   ( f . e n d s w i t h ( ' . x l s ' )   o r   f . e n d s w i t h ( ' . x l s x ' ) ) ] 
 
 +                         i f   e x c e l _ f i l e s : 
 
 +                                 #   	cO9eec^S geveN
 
 +                                 e x c e l _ f i l e s . s o r t ( k e y = l a m b d a   x :   o s . p a t h . g e t m t i m e ( o s . p a t h . j o i n ( o u t p u t _ d i r ,   x ) ) ,   r e v e r s e = T r u e ) 
 
 +                                 l a t e s t _ f i l e   =   o s . p a t h . j o i n ( o u t p u t _ d i r ,   e x c e l _ f i l e s [ 0 ] ) 
 
 +                                 t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sb _ geE x c e l eN" ,   
 
 +                                                   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( l a t e s t _ f i l e ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +         
 
 +         t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " gwQeN9Y" ,   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o s . p a t h . a b s p a t h ( " d a t a / o u t p u t " ) ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +         t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " sQ" ,   c o m m a n d = p r e v i e w . d e s t r o y ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 + 
 
 + d e f   a p p l y _ t h e m e ( w i d g e t ,   t h e m e _ m o d e = N o n e ) : 
 
 +         " " " ^(u;N0R\N" " " 
 
 +         g l o b a l   T H E M E _ M O D E 
 
           
 
 -         c o n f i r m _ m e s s a g e   =   " nx[ntNNeNT\ n \ n " 
 
 -         c o n f i r m _ m e s s a g e   + =   f " -   eQvU_:   { l e n ( i n p u t _ f i l e s ) }   *NeN\ n " 
 
 -         c o n f i r m _ m e s s a g e   + =   f " -   QvU_:   { l e n ( o u t p u t _ f i l e s ) }   *NeN\ n " 
 
 -         c o n f i r m _ m e s s a g e   + =   " \ n dkd\O
NSd " 
 
 +         i f   t h e m e _ m o d e   i s   N o n e : 
 
 +                 t h e m e _ m o d e   =   T H E M E _ M O D E 
 
           
 
 -         i f   n o t   m e s s a g e b o x . a s k y e s n o ( " nxnt" ,   c o n f i r m _ m e s s a g e ) : 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " ntd\O]Sm\ n " ) 
 
 -                 r e t u r n 
 
 +         t h e m e   =   T H E M E S [ t h e m e _ m o d e ] 
 
           
 
 -         #   nteQvU_veN
 
 -         f i l e s _ d e l e t e d   =   0 
 
 -         
 
 -         #   HQc:y(u7b	bntvvU_
 
 -         o p t i o n s   =   [ ] 
 
 -         i f   i n p u t _ f i l e s : 
 
 -                 o p t i o n s . a p p e n d ( ( " eQvU_( d a t a / i n p u t ) " ,   i n p u t _ d i r ) ) 
 
 -         i f   o u t p u t _ f i l e s : 
 
 -                 o p t i o n s . a p p e n d ( ( " QvU_( d a t a / o u t p u t ) " ,   o u t p u t _ d i r ) ) 
 
 -         
 
 -         #   R^4Nev	b[݋Fh
 
 -         d i a l o g   =   t k . T o p l e v e l ( ) 
 
 -         d i a l o g . t i t l e ( " 	bntvvU_" ) 
 
 -         d i a l o g . g e o m e t r y ( " 3 0 0 x 2 0 0 " ) 
 
 -         d i a l o g . t r a n s i e n t ( l o g _ w i d g e t . w i n f o _ t o p l e v e l ( ) )     #   n:N;NzSvP[zS
 
 -         d i a l o g . g r a b _ s e t ( )     #   !j`[݋Fh
 
 -         
 
 -         t k . L a b e l ( d i a l o g ,   t e x t = " 	bntvvU_: " ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( p a d y = 1 0 ) 
 
 -         
 
 -         #   	bSϑ
 
 -         c h o i c e s   =   { } 
 
 -         f o r   n a m e ,   p a t h   i n   o p t i o n s : 
 
 -                 v a r   =   t k . B o o l e a n V a r ( v a l u e = T r u e )     #   ؞	-N
 
 -                 c h o i c e s [ p a t h ]   =   v a r 
 
 -                 t k . C h e c k b u t t o n ( d i a l o g ,   t e x t = n a m e ,   v a r i a b l e = v a r ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 -         
 
 -         #    RdMRYN	y
 
 -         b a c k u p _ v a r   =   t k . B o o l e a n V a r ( v a l u e = F a l s e ) 
 
 -         t k . C h e c k b u t t o n ( d i a l o g ,   t e x t = "  RdMRYNeN" ,   v a r i a b l e = b a c k u p _ v a r ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( a n c h o r = t k . W ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 -         
 
 -         r e s u l t   =   { " c o n f i r m e d " :   F a l s e ,   " c h o i c e s " :   { } ,   " b a c k u p " :   F a l s e } 
 
 -         
 
 -         d e f   o n _ c o n f i r m ( ) : 
 
 -                 r e s u l t [ " c o n f i r m e d " ]   =   T r u e 
 
 -                 r e s u l t [ " c h o i c e s " ]   =   { p a t h :   v a r . g e t ( )   f o r   p a t h ,   v a r   i n   c h o i c e s . i t e m s ( ) } 
 
 -                 r e s u l t [ " b a c k u p " ]   =   b a c k u p _ v a r . g e t ( ) 
 
 -                 d i a l o g . d e s t r o y ( ) 
 
 -         
 
 -         d e f   o n _ c a n c e l ( ) : 
 
 -                 d i a l o g . d e s t r o y ( ) 
 
 -         
 
 -         #   	c
 
 -         b u t t o n _ f r a m e   =   t k . F r a m e ( d i a l o g ) 
 
 -         b u t t o n _ f r a m e . p a c k ( p a d y = 1 0 ) 
 
 -         t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " nx" ,   c o m m a n d = o n _ c o n f i r m ,   w i d t h = 1 0 ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 -         t k . B u t t o n ( b u t t o n _ f r a m e ,   t e x t = " Sm" ,   c o m m a n d = o n _ c a n c e l ,   w i d t h = 1 0 ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
 +         t r y : 
 
 +                 w i d g e t . c o n f i g u r e ( b g = t h e m e [ " b g " ] ,   f g = t h e m e [ " f g " ] ) 
 
 +         e x c e p t : 
 
 +                 p a s s 
 
 +                 
 
 +         #   R_^(u0R@b	gP[N
 
 +         f o r   c h i l d   i n   w i d g e t . w i n f o _ c h i l d r e n ( ) : 
 
 +                 i f   i s i n s t a n c e ( c h i l d ,   t k . B u t t o n )   a n d   n o t   i s i n s t a n c e ( c h i l d ,   t t k . B u t t o n ) : 
 
 +                         c h i l d . c o n f i g u r e ( b g = t h e m e [ " b u t t o n _ b g " ] ,   f g = t h e m e [ " b u t t o n _ f g " ] ) 
 
 +                 e l i f   i s i n s t a n c e ( c h i l d ,   s c r o l l e d t e x t . S c r o l l e d T e x t ) : 
 
 +                         c h i l d . c o n f i g u r e ( b g = t h e m e [ " l o g _ b g " ] ,   f g = t h e m e [ " l o g _ f g " ] ) 
 
 +                 e l s e : 
 
 +                         t r y : 
 
 +                                 c h i l d . c o n f i g u r e ( b g = t h e m e [ " b g " ] ,   f g = t h e m e [ " f g " ] ) 
 
 +                         e x c e p t : 
 
 +                                 p a s s 
 
 +                                 
 
 +                 #   R_YtP[NvP[N
 
 +                 a p p l y _ t h e m e ( c h i l d ,   t h e m e _ m o d e ) 
 
 + 
 
 + d e f   t o g g l e _ t h e m e ( r o o t ,   l o g _ w i d g e t ,   s t a t u s _ b a r = N o n e ) : 
 
 +         " " " Rbc;N!j_" " " 
 
 +         g l o b a l   T H E M E _ M O D E 
 
           
 
 -         #   I{_[݋FhsQ
 
 -         d i a l o g . w a i t _ w i n d o w ( ) 
 
 +         #   Rbc;N!j_
 
 +         T H E M E _ M O D E   =   " d a r k "   i f   T H E M E _ M O D E   = =   " l i g h t "   e l s e   " l i g h t " 
 
           
 
 -         i f   n o t   r e s u l t [ " c o n f i r m e d " ] : 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " ntd\O]Sm\ n " ) 
 
 -                 r e t u r n 
 
 +         #   ^(u;N0Rte*NLub
 
 +         a p p l y _ t h e m e ( r o o t ) 
 
           
 
 -         #   YNeN
 
 -         i f   r e s u l t [ " b a c k u p " ] : 
 
 -                 b a c k u p _ d i r   =   o s . p a t h . j o i n ( " d a t a " ,   " b a c k u p " ,   d a t e t i m e . d a t e t i m e . n o w ( ) . s t r f t i m e ( " % Y % m % d % H % M % S " ) ) 
 
 -                 o s . m a k e d i r s ( b a c k u p _ d i r ,   e x i s t _ o k = T r u e ) 
 
 -                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " R^YNvU_:   { b a c k u p _ d i r } \ n " ) 
 
 -                 
 
 -                 f o r   d i r _ p a t h ,   s e l e c t e d   i n   r e s u l t [ " c h o i c e s " ] . i t e m s ( ) : 
 
 -                         i f   s e l e c t e d : 
 
 -                                 d i r _ n a m e   =   o s . p a t h . b a s e n a m e ( d i r _ p a t h ) 
 
 -                                 b a c k u p _ s u b d i r   =   o s . p a t h . j o i n ( b a c k u p _ d i r ,   d i r _ n a m e ) 
 
 -                                 o s . m a k e d i r s ( b a c k u p _ s u b d i r ,   e x i s t _ o k = T r u e ) 
 
 -                                 
 
 -                                 f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( d i r _ p a t h )   i f   o s . p a t h . i s f i l e ( o s . p a t h . j o i n ( d i r _ p a t h ,   f ) ) ] 
 
 -                                 f o r   f i l e   i n   f i l e s : 
 
 -                                         s r c   =   o s . p a t h . j o i n ( d i r _ p a t h ,   f i l e ) 
 
 -                                         d s t   =   o s . p a t h . j o i n ( b a c k u p _ s u b d i r ,   f i l e ) 
 
 -                                         t r y : 
 
 -                                                 s h u t i l . c o p y 2 ( s r c ,   d s t ) 
 
 -                                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]YN:   { s r c }   - >   { d s t } \ n " ) 
 
 -                                         e x c e p t   E x c e p t i o n   a s   e : 
 
 -                                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " YN1Y%:   { s r c } ,   :   { e } \ n " ) 
 
 -         
 
 -         #    Rd@b	vU_veN
 
 -         f o r   d i r _ p a t h ,   s e l e c t e d   i n   r e s u l t [ " c h o i c e s " ] . i t e m s ( ) : 
 
 -                 i f   s e l e c t e d : 
 
 -                         f i l e s   =   [ f   f o r   f   i n   o s . l i s t d i r ( d i r _ p a t h )   i f   o s . p a t h . i s f i l e ( o s . p a t h . j o i n ( d i r _ p a t h ,   f ) ) ] 
 
 -                         f o r   f i l e   i n   f i l e s : 
 
 -                                 f i l e _ p a t h   =   o s . p a t h . j o i n ( d i r _ p a t h ,   f i l e ) 
 
 -                                 t r y : 
 
 -                                         o s . r e m o v e ( f i l e _ p a t h ) 
 
 -                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ] Rd:   { f i l e _ p a t h } \ n " ) 
 
 -                                         f i l e s _ d e l e t e d   + =   1 
 
 -                                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f "  Rd1Y%:   { f i l e _ p a t h } ,   :   { e } \ n " ) 
 
 +         #   Mne_7h_
 
 +         l o g _ w i d g e t . c o n f i g u r e ( b g = T H E M E S [ T H E M E _ M O D E ] [ " l o g _ b g " ] ,   f g = T H E M E S [ T H E M E _ M O D E ] [ " l o g _ f g " ] ) 
 
           
 
 -         #   >f:y~g
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " nt[bqQ Rd  { f i l e s _ d e l e t e d }   *NeN\ n " ) 
 
 -         m e s s a g e b o x . s h o w i n f o ( " nt[b" ,   f " qQ Rd  { f i l e s _ d e l e t e d }   *NeN" ) 
 
 +         #   nr`h
 
 +         i f   s t a t u s _ b a r : 
 
 +                 a p p l y _ t h e m e ( s t a t u s _ b a r ) 
 
 +                 
 
 +         #   OX[;Nn
 
 +         t r y : 
 
 +                 w i t h   o p e n ( " d a t a / u s e r _ s e t t i n g s . j s o n " ,   " w " )   a s   f : 
 
 +                         j s o n . d u m p ( { " t h e m e " :   T H E M E _ M O D E } ,   f ) 
 
 +         e x c e p t : 
 
 +                 p a s s 
 
 +         
 
 +         r e t u r n   T H E M E _ M O D E 
 
   
 
 - d e f   c l e a n _ c a c h e ( l o g _ w i d g e t ) : 
 
 -         " " " ndX[͑nYtU_" " " 
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   "  _YndX[. . . \ n " ) 
 
 + d e f   e n s u r e _ d i r e c t o r i e s ( ) : 
 
 +         " " " nxO_vvU_~gX[(W" " " 
 
 +         d i r e c t o r i e s   =   [ " d a t a / i n p u t " ,   " d a t a / o u t p u t " ,   " d a t a / t e m p " ,   " l o g s " ] 
 
 +         f o r   d i r e c t o r y   i n   d i r e c t o r i e s : 
 
 +                 i f   n o t   o s . p a t h . e x i s t s ( d i r e c t o r y ) : 
 
 +                         o s . m a k e d i r s ( d i r e c t o r y ,   e x i s t _ o k = T r u e ) 
 
 +                         p r i n t ( f " R^vU_:   { d i r e c t o r y } " ) 
 
 + 
 
 + c l a s s   L o g R e d i r e c t o r : 
 
 +         " " " e_͑[ThV(uNUc}TNQv^>f:y0RLub" " " 
 
 +         d e f   _ _ i n i t _ _ ( s e l f ,   t e x t _ w i d g e t ) : 
 
 +                 s e l f . t e x t _ w i d g e t   =   t e x t _ w i d g e t 
 
 +                 s e l f . b u f f e r   =   " " 
 
 +                 s e l f . t e r m i n a l   =   s y s . _ _ s t d o u t _ _     #   OX[SYvs t d o u t _(u
 
 +                 
 
 +         d e f   w r i t e ( s e l f ,   s t r i n g ) : 
 
 +                 s e l f . b u f f e r   + =   s t r i n g 
 
 +                 #   TeQ0R~z
 
 +                 s e l f . t e r m i n a l . w r i t e ( s t r i n g ) 
 
 +                 #   (WU I ~z-Nfee,gcN
 
 +                 s e l f . t e x t _ w i d g e t . a f t e r ( 0 ,   s e l f . u p d a t e _ t e x t _ w i d g e t ) 
 
 +                 
 
 +         d e f   u p d a t e _ t e x t _ w i d g e t ( s e l f ) : 
 
 +                 s e l f . t e x t _ w i d g e t . c o n f i g u r e ( s t a t e = t k . N O R M A L ) 
 
 +                 
 
 +                 #   9hncQ[O(u
NTvh~{
 
 +                 i f   s e l f . b u f f e r . s t r i p ( ) : 
 
 +                         #   hKm
NT{|Wvmo`v^^(uv^7h_
 
 +                         i f   a n y ( m a r k e r   i n   s e l f . b u f f e r . l o w e r ( )   f o r   m a r k e r   i n   [ " " ,   " e r r o r " ,   " 1Y%" ,   " _8^" ,   " e x c e p t i o n " ] ) : 
 
 +                                 s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ,   " e r r o r " ) 
 
 +                         e l i f   a n y ( m a r k e r   i n   s e l f . b u f f e r . l o w e r ( )   f o r   m a r k e r   i n   [ " fJT" ,   " w a r n i n g " ] ) : 
 
 +                                 s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ,   " w a r n i n g " ) 
 
 +                         e l i f   a n y ( m a r k e r   i n   s e l f . b u f f e r . l o w e r ( )   f o r   m a r k e r   i n   [ " bR" ,   " s u c c e s s " ,   " [b" ,   " bRYt" ] ) : 
 
 +                                 s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ,   " s u c c e s s " ) 
 
 +                         e l i f   a n y ( m a r k e r   i n   s e l f . b u f f e r . l o w e r ( )   f o r   m a r k e r   i n   [ " i n f o " ,   " Oo`" ,   "  _Y" ,   " Yt-N" ] ) : 
 
 +                                 s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ,   " i n f o " ) 
 
 +                         e l s e : 
 
 +                                 s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ,   " n o r m a l " ) 
 
 +                 e l s e : 
 
 +                         s e l f . t e x t _ w i d g e t . i n s e r t ( t k . E N D ,   s e l f . b u f f e r ) 
 
 +                         
 
 +                 #   ꁨRnR0R^
 
 +                 s e l f . t e x t _ w i d g e t . s e e ( t k . E N D ) 
 
 +                 s e l f . t e x t _ w i d g e t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D ) 
 
 +                 s e l f . b u f f e r   =   " " 
 
 +                 
 
 +         d e f   f l u s h ( s e l f ) : 
 
 +                 s e l f . t e r m i n a l . f l u s h ( )     #   nxO~z_N7Re
 
 + 
 
 + d e f   c r e a t e _ c o l l a p s i b l e _ f r a m e ( p a r e n t ,   t i t l e ,   i n i t i a l _ s t a t e = T r u e ) : 
 
 +         " " " R^SbSvbg" " " 
 
 +         f r a m e   =   t k . F r a m e ( p a r e n t ) 
 
 +         f r a m e . p a c k ( f i l l = t k . X ,   p a d y = 5 ) 
 
           
 
 -         c a c h e _ f i l e s   =   [ 
 
 -                 " d a t a / p r o c e s s e d _ f i l e s . j s o n " ,     #   O C R YtU_
 
 -                 " d a t a / o u t p u t / p r o c e s s e d _ f i l e s . j s o n "     #   E x c e l YtU_
 
 -         ] 
 
 +         #   hh
 
 +         t i t l e _ f r a m e   =   t k . F r a m e ( f r a m e ) 
 
 +         t i t l e _ f r a m e . p a c k ( f i l l = t k . X ) 
 
           
 
 -         f o r   c a c h e _ f i l e   i n   c a c h e _ f i l e s : 
 
 -                 t r y : 
 
 -                         i f   o s . p a t h . e x i s t s ( c a c h e _ f i l e ) : 
 
 -                                 #   R^YN
 
 -                                 b a c k u p _ f i l e   =   f " { c a c h e _ f i l e } . b a k " 
 
 -                                 s h u t i l . c o p y 2 ( c a c h e _ f i l e ,   b a c k u p _ f i l e ) 
 
 -                                 
 
 -                                 #   nzzb RdX[eN
 
 -                                 w i t h   o p e n ( c a c h e _ f i l e ,   ' w ' )   a s   f : 
 
 -                                         f . w r i t e ( ' { } ' )     #   QeQzzvJ S O N [a
 
 -                                 
 
 -                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]ndX[eN:   { c a c h e _ f i l e } v^R^YN:   { b a c k u p _ f i l e } \ n " ) 
 
 -                         e l s e : 
 
 -                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " X[eN
NX[(W:   { c a c h e _ f i l e } \ n " ) 
 
 -                 e x c e p t   E x c e p t i o n   a s   e : 
 
 -                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ndX[eNeQ:   { c a c h e _ f i l e } ,   :   { e } \ n " ) 
 
 +         #   bSc:yhV
 
 +         s t a t e _ v a r   =   t k . B o o l e a n V a r ( v a l u e = i n i t i a l _ s t a t e ) 
 
 +         i n d i c a t o r   =   " %"   i f   i n i t i a l _ s t a t e   e l s e   " %" 
 
 +         s t a t e _ l a b e l   =   t k . L a b e l ( t i t l e _ f r a m e ,   t e x t = i n d i c a t o r ,   f o n t = ( " A r i a l " ,   1 0 ,   " b o l d " ) ) 
 
 +         s t a t e _ l a b e l . p a c k ( s i d e = t k . L E F T ,   p a d x = 5 ) 
 
 +         
 
 +         #   h
 
 +         t i t l e _ l a b e l   =   t k . L a b e l ( t i t l e _ f r a m e ,   t e x t = t i t l e ,   f o n t = ( " A r i a l " ,   1 1 ,   " b o l d " ) ) 
 
 +         t i t l e _ l a b e l . p a c k ( s i d e = t k . L E F T ,   p a d x = 5 ) 
 
 +         
 
 +         #   Q[:SW
 
 +         c o n t e n t _ f r a m e   =   t k . F r a m e ( f r a m e ) 
 
 +         i f   i n i t i a l _ s t a t e : 
 
 +                 c o n t e n t _ f r a m e . p a c k ( f i l l = t k . X ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +         
 
 +         #   pQNNYtQpe
 
 +         d e f   t o g g l e _ c o l l a p s e ( e v e n t = N o n e ) : 
 
 +                 c u r r e n t _ s t a t e   =   s t a t e _ v a r . g e t ( ) 
 
 +                 n e w _ s t a t e   =   n o t   c u r r e n t _ s t a t e 
 
 +                 s t a t e _ v a r . s e t ( n e w _ s t a t e ) 
 
 +                 
 
 +                 #   fec:yhV
 
 +                 s t a t e _ l a b e l . c o n f i g ( t e x t = " %"   i f   n e w _ s t a t e   e l s e   " %" ) 
 
 +                 
 
 +                 #   >f:ybυQ[
 
 +                 i f   n e w _ s t a t e : 
 
 +                         c o n t e n t _ f r a m e . p a c k ( f i l l = t k . X ,   p a d x = 2 0 ,   p a d y = 5 ) 
 
 +                 e l s e : 
 
 +                         c o n t e n t _ f r a m e . p a c k _ f o r g e t ( ) 
 
           
 
 -         a d d _ t o _ l o g ( l o g _ w i d g e t ,   " X[nd[b|~\͑eYt@b	geN\ n " ) 
 
 -         m e s s a g e b o x . s h o w i n f o ( " X[nd" ,   " X[]nd|~\͑eYt@b	geN0" ) 
 
 +         #   ~[pQNN
 
 +         t i t l e _ f r a m e . b i n d ( " < B u t t o n - 1 > " ,   t o g g l e _ c o l l a p s e ) 
 
 +         s t a t e _ l a b e l . b i n d ( " < B u t t o n - 1 > " ,   t o g g l e _ c o l l a p s e ) 
 
 +         t i t l e _ l a b e l . b i n d ( " < B u t t o n - 1 > " ,   t o g g l e _ c o l l a p s e ) 
 
 +         
 
 +         r e t u r n   c o n t e n t _ f r a m e ,   s t a t e _ v a r 
 
   
 
   d e f   m a i n ( ) : 
 
           " " " ;NQpe" " " 
 
 @ @   - 4 6 5 , 7   + 6 7 8 , 7   @ @   d e f   m a i n ( ) : 
 
           #   R^zS
 
           r o o t   =   t k . T k ( ) 
 
           r o o t . t i t l e ( " v	- O C R USYt|~  v 1 . 0 " ) 
 
 -         r o o t . g e o m e t r y ( " 1 2 0 0 x 8 0 0 " )     #   XRzS[^N[~e_
 
 +         r o o t . g e o m e t r y ( " 1 2 0 0 x 6 5 0 " )     #   XRzSؚ^N[~fYCQ }
 
           
 
           #   R^;N:SWRrR
 
           m a i n _ p a n e   =   t k . P a n e d W i n d o w ( r o o t ,   o r i e n t = t k . H O R I Z O N T A L ) 
 
 @ @   - 4 7 6 , 1 3 0   + 6 8 9 , 3 3 1   @ @   d e f   m a i n ( ) : 
 
           m a i n _ p a n e . a d d ( l e f t _ f r a m e ) 
 
           
 
           #   h
 
 -         t k . L a b e l ( l e f t _ f r a m e ,   t e x t = " v	- O C R USYt|~" ,   f o n t = ( " A r i a l " ,   1 6 ) ) . p a c k ( p a d y = 1 0 ) 
 
 +         t i t l e _ f r a m e   =   t k . F r a m e ( l e f t _ f r a m e ) 
 
 +         t i t l e _ f r a m e . p a c k ( f i l l = t k . X ,   p a d y = 1 0 ) 
 
 +         
 
 +         #   ;Nh
 
 +         t k . L a b e l ( t i t l e _ f r a m e ,   t e x t = " v	- O C R USYt|~" ,   f o n t = ( " A r i a l " ,   1 6 ,   " b o l d " ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 0 ) 
 
           
 
 -         #   R	c:SW
 
 -         b u t t o n s _ f r a m e   =   t k . F r a m e ( l e f t _ f r a m e ) 
 
 -         b u t t o n s _ f r a m e . p a c k ( p a d y = 1 0 ,   f i l l = t k . Y ) 
 
 +         #   mR\OOo`
 
 +         a u t h o r _ f r a m e   =   t k . F r a m e ( l e f t _ f r a m e ) 
 
 +         a u t h o r _ f r a m e . p a c k ( f i l l = t k . X ,   p a d y = 0 ) 
 
 +         t k . L a b e l ( a u t h o r _ f r a m e ,   t e x t = " \O"k"k"k" ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( s i d e = t k . L E F T ,   p a d x = 1 5 ) 
 
           
 
           #   R^e_>f:y:SW
 
           l o g _ f r a m e   =   t k . F r a m e ( m a i n _ p a n e ) 
 
           m a i n _ p a n e . a d d ( l o g _ f r a m e ) 
 
           
 
           #   e_h
 
 -         t k . L a b e l ( l o g _ f r a m e ,   t e x t = " Yte_" ,   f o n t = ( " A r i a l " ,   1 2 ) ) . p a c k ( p a d y = 5 ) 
 
 +         t k . L a b e l ( l o g _ f r a m e ,   t e x t = " Yte_" ,   f o n t = ( " A r i a l " ,   1 2 ,   " b o l d " ) ) . p a c k ( p a d y = 5 ) 
 
           
 
           #   e_e,g:SW
 
           l o g _ t e x t   =   s c r o l l e d t e x t . S c r o l l e d T e x t ( l o g _ f r a m e ,   w r a p = t k . W O R D ,   h e i g h t = 3 0 ,   w i d t h = 6 0 ) 
 
           l o g _ t e x t . p a c k ( f i l l = t k . B O T H ,   e x p a n d = T r u e ,   p a d x = 5 ,   p a d y = 5 ) 
 
           l o g _ t e x t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D )     #   n:NS
 
           
 
 +         #   :Ne_e,gmRh~{7h_
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " n o r m a l " ,   f o r e g r o u n d = " # 0 0 0 0 0 0 " ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " c o m m a n d " ,   f o r e g r o u n d = " # 1 7 a 2 b 8 " ,   f o n t = ( " A r i a l " ,   1 0 ,   " b o l d " ) ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " t i m e " ,   f o r e g r o u n d = " # 1 7 a 2 b 8 " ,   f o n t = ( " A r i a l " ,   9 ) ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " s e p a r a t o r " ,   f o r e g r o u n d = " # c c c c c c " ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " e r r o r " ,   f o r e g r o u n d = " # d c 3 5 4 5 " ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " w a r n i n g " ,   f o r e g r o u n d = " # f f c 1 0 7 " ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " s u c c e s s " ,   f o r e g r o u n d = " # 2 8 a 7 4 5 " ) 
 
 +         l o g _ t e x t . t a g _ c o n f i g u r e ( " i n f o " ,   f o r e g r o u n d = " # 1 7 a 2 b 8 " ) 
 
 +         
 
 +         #   R^r`h
 
 +         s t a t u s _ b a r   =   S t a t u s B a r ( r o o t ) 
 
 +         s t a t u s _ b a r . p a c k ( s i d e = t k . B O T T O M ,   f i l l = t k . X ) 
 
 +         
 
           #   e_RYQ[
 
 -         a d d _ t o _ l o g ( l o g _ t e x t ,   " v	- O C R USYt|~/TRhV  v 1 . 0 \ n " ) 
 
 -         a d d _ t o _ l o g ( l o g _ t e x t ,   f " S_MR]\OvU_:   { o s . g e t c w d ( ) } \ n " ) 
 
 -         a d d _ t o _ l o g ( l o g _ t e x t ,   " |~]QY1\~	bgbLvd\O0\ n " ) 
 
 +         a d d _ t o _ l o g ( l o g _ t e x t ,   " v	- O C R USYt|~/TRhV  v 1 . 0 \ n " ,   " c o m m a n d " ) 
 
 +         a d d _ t o _ l o g ( l o g _ t e x t ,   f " S_MR]\OvU_:   { o s . g e t c w d ( ) } \ n " ,   " i n f o " ) 
 
 +         a d d _ t o _ l o g ( l o g _ t e x t ,   " |~]QY1\~	bgbLvd\O0\ n " ,   " n o r m a l " ) 
 
           
 
 -         #   O C R Ƌ+R	c
 
 -         t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 -                 t e x t = " O C R VPƋ+R  ( ybϑ) " ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 -                 c o m m a n d = l a m b d a :   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " o c r " ,   " - - b a t c h " ] ,   l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 -         
 
 -         #   US*NVGrYt
 
 -         t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 -                 t e x t = " YtUS*NVGr" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 -                 c o m m a n d = l a m b d a :   p r o c e s s _ s i n g l e _ i m a g e ( l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +         #   R^	c:SWO(u$NR^@\	
 
 +         b u t t o n _ a r e a   =   t k . F r a m e ( l e f t _ f r a m e ) 
 
 +         b u t t o n _ a r e a . p a c k ( f i l l = t k . B O T H ,   e x p a n d = T r u e ,   p a d y = 1 0 ) 
 
 +         
 
 +         #   	c:\[Tݍ
 
 +         b u t t o n _ w i d t h   =   1 5 
 
 +         b u t t o n _ h e i g h t   =   2 
 
 +         b u t t o n _ p a d x   =   5 
 
 +         b u t t o n _ p a d y   =   5 
 
           
 
 -         #   E x c e l Yt	c
 
 +         #   ,{ NL
 
 +         r o w 1   =   t k . F r a m e ( b u t t o n _ a r e a ) 
 
 +         r o w 1 . p a c k ( f i l l = t k . X ,   p a d y = b u t t o n _ p a d y ) 
 
 +         
 
 +         #   YtE x c e l eN
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 +                 r o w 1 ,   
 
                   t e x t = " YtE x c e l eN" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 -                 c o m m a n d = l a m b d a :   p r o c e s s _ e x c e l _ f i l e ( l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
 +                 c o m m a n d = l a m b d a :   p r o c e s s _ e x c e l _ f i l e ( l o g _ t e x t ,   s t a t u s _ b a r ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
           
 
 -         #   USTv^	c
 
 +         #   O C R ybϑƋ+R
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 -                 t e x t = " Tv^Ǒ-US" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 -                 c o m m a n d = l a m b d a :   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " m e r g e " ] ,   l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 -         
 
 -         #   [teAmz	c
 
 +                 r o w 1 ,   
 
 +                 t e x t = " O C R ybϑƋ+R" ,   
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
 +                 c o m m a n d = l a m b d a :   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " o c r " ,   " - - b a t c h " ] ,   l o g _ t e x t ,   s t a t u s _ b a r ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
 +         
 
 +         #   ,{NL
 
 +         r o w 2   =   t k . F r a m e ( b u t t o n _ a r e a ) 
 
 +         r o w 2 . p a c k ( f i l l = t k . X ,   p a d y = b u t t o n _ p a d y ) 
 
 +         
 
 +         #   [teYtAmz
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 +                 r o w 2 ,   
 
                   t e x t = " [teYtAmz" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 -                 c o m m a n d = l a m b d a :   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " p i p e l i n e " ] ,   l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
 +                 c o m m a n d = l a m b d a :   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " p i p e l i n e " ] ,   l o g _ t e x t ,   s t a t u s _ b a r ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
           
 
 -         #   ndX[	c
 
 +         #   YtUS*NVGr
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 -                 t e x t = " ndYtX[" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 -                 c o m m a n d = l a m b d a :   c l e a n _ c a c h e ( l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +                 r o w 2 ,   
 
 +                 t e x t = " YtUS*NVGr" ,   
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
 +                 c o m m a n d = l a m b d a :   p r o c e s s _ s i n g l e _ i m a g e ( l o g _ t e x t ,   s t a t u s _ b a r ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
           
 
 -         #   teteN	c
 
 +         #   ,{	NL
 
 +         r o w 3   =   t k . F r a m e ( b u t t o n _ a r e a ) 
 
 +         r o w 3 . p a c k ( f i l l = t k . X ,   p a d y = b u t t o n _ p a d y ) 
 
 +         
 
 +         #   Tv^Ǒ-US	c
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 +                 r o w 3 ,   
 
 +                 t e x t = " Tv^Ǒ-US" ,   
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
 +                 c o m m a n d = l a m b d a :   r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " m e r g e " ] ,   l o g _ t e x t ,   s t a t u s _ b a r ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
 +         
 
 +         #   tetyveN
 
 +         t k . B u t t o n ( 
 
 +                 r o w 3 ,   
 
                   t e x t = " tetyveN" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
                   c o m m a n d = l a m b d a :   o r g a n i z e _ p r o j e c t _ f i l e s ( l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
 +         
 
 +         #   ,{VL
 
 +         r o w 4   =   t k . F r a m e ( b u t t o n _ a r e a ) 
 
 +         r o w 4 . p a c k ( f i l l = t k . X ,   p a d y = b u t t o n _ p a d y ) 
 
 +         
 
 +         #   ndYtX[	c
 
 +         t k . B u t t o n ( 
 
 +                 r o w 4 ,   
 
 +                 t e x t = " ndYtX[" ,   
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
 +                 c o m m a n d = l a m b d a :   c l e a n _ c a c h e ( l o g _ t e x t ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
           
 
           #   nteN	c
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 +                 r o w 4 ,   
 
                   t e x t = " nteN" ,   
 
 -                 w i d t h = 2 0 , 
 
 -                 h e i g h t = 2 , 
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
                   c o m m a n d = l a m b d a :   c l e a n _ d a t a _ f i l e s ( l o g _ t e x t ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
 +         
 
 +         #   ,{NL
 
 +         r o w 5   =   t k . F r a m e ( b u t t o n _ a r e a ) 
 
 +         r o w 5 . p a c k ( f i l l = t k . X ,   p a d y = b u t t o n _ p a d y ) 
 
           
 
           #   Sb _eQvU_
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 +                 r o w 5 ,   
 
                   t e x t = " Sb _eQvU_" ,   
 
 -                 w i d t h = 2 0 , 
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
                   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o s . p a t h . a b s p a t h ( " d a t a / i n p u t " ) ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
           
 
           #   Sb _QvU_
 
           t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e ,   
 
 +                 r o w 5 ,   
 
                   t e x t = " Sb _QvU_" ,   
 
 -                 w i d t h = 2 0 , 
 
 +                 w i d t h = b u t t o n _ w i d t h , 
 
 +                 h e i g h t = b u t t o n _ h e i g h t , 
 
                   c o m m a n d = l a m b d a :   o s . s t a r t f i l e ( o s . p a t h . a b s p a t h ( " d a t a / o u t p u t " ) ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 -         
 
 -         #   nzze_	c
 
 -         t k . B u t t o n ( 
 
 -                 b u t t o n s _ f r a m e , 
 
 -                 t e x t = " nzze_" , 
 
 -                 w i d t h = 2 0 , 
 
 -                 c o m m a n d = l a m b d a :   l o g _ t e x t . d e l e t e ( 1 . 0 ,   t k . E N D ) 
 
 -         ) . p a c k ( p a d y = 5 ) 
 
 +         ) . p a c k ( s i d e = t k . L E F T ,   p a d x = b u t t o n _ p a d x ) 
 
           
 
           #   ^f
 
 -         t k . L a b e l ( l e f t _ f r a m e ,   t e x t = "    2 0 2 5   v	- O C R USYt|~  v 1 . 0 " ,   f o n t = ( " A r i a l " ,   1 0 ) ) . p a c k ( s i d e = t k . B O T T O M ,   p a d y = 1 0 ) 
 
 +         t k . L a b e l ( l e f t _ f r a m e ,   t e x t = "    2 0 2 5   v	- O C R USYt|~  v 1 . 0   b y   "k"k"k" ,   f o n t = ( " A r i a l " ,   9 ) ) . p a c k ( s i d e = t k . B O T T O M ,   p a d y = 1 0 ) 
 
 +         
 
 +         #   O9eUS*NVGrTE x c e l YtQpeNO(ur`h
 
 +         d e f   p r o c e s s _ s i n g l e _ i m a g e _ w i t h _ s t a t u s ( l o g _ w i d g e t ,   s t a t u s _ b a r ) : 
 
 +                 s t a t u s _ b a r . s e t _ s t a t u s ( " 	bVGr-N. . . " ) 
 
 +                 f i l e _ p a t h   =   s e l e c t _ f i l e ( l o g _ w i d g e t ) 
 
 +                 i f   f i l e _ p a t h : 
 
 +                         s t a t u s _ b a r . s e t _ s t a t u s ( "  _YYtVGr. . . " ) 
 
 +                         r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " o c r " ,   " - - i n p u t " ,   f i l e _ p a t h ] ,   l o g _ w i d g e t ,   s t a t u s _ b a r ) 
 
 +                 e l s e : 
 
 +                         s t a t u s _ b a r . s e t _ s t a t u s ( " d\O]Sm" ) 
 
 +                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   " *g	beNd\O]Sm\ n " ,   " w a r n i n g " ) 
 
 +         
 
 +         d e f   p r o c e s s _ e x c e l _ f i l e _ w i t h _ s t a t u s ( l o g _ w i d g e t ,   s t a t u s _ b a r ) : 
 
 +                 s t a t u s _ b a r . s e t _ s t a t u s ( " 	bE x c e l eN-N. . . " ) 
 
 +                 f i l e _ p a t h   =   s e l e c t _ e x c e l _ f i l e ( l o g _ w i d g e t ) 
 
 +                 i f   f i l e _ p a t h : 
 
 +                         s t a t u s _ b a r . s e t _ s t a t u s ( "  _YYtE x c e l eN. . . " ) 
 
 +                         r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " e x c e l " ,   " - - i n p u t " ,   f i l e _ p a t h ] ,   l o g _ w i d g e t ,   s t a t u s _ b a r ) 
 
 +                 e l s e : 
 
 +                         s t a t u s _ b a r . s e t _ s t a t u s ( "  _YYt geE x c e l eN. . . " ) 
 
 +                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   " *g	beN\ՋYt gevE x c e l eN\ n " ,   " i n f o " ) 
 
 +                         r u n _ c o m m a n d _ w i t h _ l o g g i n g ( [ " p y t h o n " ,   " r u n . p y " ,   " e x c e l " ] ,   l o g _ w i d g e t ,   s t a t u s _ b a r ) 
 
 +         
 
 +         #   fbcSYQpe_(u
 
 +         g l o b a l   p r o c e s s _ s i n g l e _ i m a g e ,   p r o c e s s _ e x c e l _ f i l e 
 
 +         p r o c e s s _ s i n g l e _ i m a g e   =   p r o c e s s _ s i n g l e _ i m a g e _ w i t h _ s t a t u s 
 
 +         p r o c e s s _ e x c e l _ f i l e   =   p r o c e s s _ e x c e l _ f i l e _ w i t h _ s t a t u s 
 
           
 
           #   /TR;N_s
 
           r o o t . m a i n l o o p ( ) 
 
   
 
 + d e f   a d d _ t o _ l o g ( l o g _ w i d g e t ,   t e x t ,   t a g = " n o r m a l " ) : 
 
 +         " " " Te_zSmRe,g/ec7h_h~{" " " 
 
 +         l o g _ w i d g e t . c o n f i g u r e ( s t a t e = t k . N O R M A L ) 
 
 +         l o g _ w i d g e t . i n s e r t ( t k . E N D ,   t e x t ,   t a g ) 
 
 +         l o g _ w i d g e t . s e e ( t k . E N D )     #   ꁨRnR0R^
 
 +         l o g _ w i d g e t . c o n f i g u r e ( s t a t e = t k . D I S A B L E D ) 
 
 + 
 
 + d e f   s e l e c t _ f i l e ( l o g _ w i d g e t ,   f i l e _ t y p e s = [ ( " @b	geN" ,   " * . * " ) ] ,   t i t l e = " 	beN" ) : 
 
 +         " " " (ueN	b[݋Fh" " " 
 
 +         f i l e _ p a t h   =   f i l e d i a l o g . a s k o p e n f i l e n a m e ( t i t l e = t i t l e ,   f i l e t y p e s = f i l e _ t y p e s ) 
 
 +         i f   f i l e _ p a t h : 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]	beN:   { f i l e _ p a t h } \ n " ,   " i n f o " ) 
 
 +         r e t u r n   f i l e _ p a t h 
 
 + 
 
 + d e f   s e l e c t _ e x c e l _ f i l e ( l o g _ w i d g e t ) : 
 
 +         " " " 	bE x c e l eN" " " 
 
 +         r e t u r n   s e l e c t _ f i l e ( 
 
 +                 l o g _ w i d g e t ,   
 
 +                 [ ( " E x c e l eN" ,   " * . x l s x   * . x l s " ) ,   ( " @b	geN" ,   " * . * " ) ] ,   
 
 +                 " 	bE x c e l eN" 
 
 +         ) 
 
 + 
 
 + d e f   c l e a n _ c a c h e ( l o g _ w i d g e t ) : 
 
 +         " " " ndYtX[" " " 
 
 +         t r y : 
 
 +                 #   ndO C R X[
 
 +                 o c r _ c a c h e _ f i l e   =   o s . p a t h . j o i n ( " d a t a / o u t p u t " ,   " p r o c e s s e d _ f i l e s . j s o n " ) 
 
 +                 i f   o s . p a t h . e x i s t s ( o c r _ c a c h e _ f i l e ) : 
 
 +                         o s . r e m o v e ( o c r _ c a c h e _ f i l e ) 
 
 +                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]ndO C R YtX[:   { o c r _ c a c h e _ f i l e } \ n " ,   " s u c c e s s " ) 
 
 +                 
 
 +                 #   nd4NeeN9Y
 
 +                 t e m p _ d i r   =   o s . p a t h . j o i n ( " d a t a / t e m p " ) 
 
 +                 i f   o s . p a t h . e x i s t s ( t e m p _ d i r ) : 
 
 +                         f o r   f i l e   i n   o s . l i s t d i r ( t e m p _ d i r ) : 
 
 +                                 f i l e _ p a t h   =   o s . p a t h . j o i n ( t e m p _ d i r ,   f i l e ) 
 
 +                                 t r y : 
 
 +                                         i f   o s . p a t h . i s f i l e ( f i l e _ p a t h ) : 
 
 +                                                 o s . r e m o v e ( f i l e _ p a t h ) 
 
 +                                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]nd4NeeN:   { f i l e _ p a t h } \ n " ,   " i n f o " ) 
 
 +                                 e x c e p t   E x c e p t i o n   a s   e : 
 
 +                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ndeNeQ:   { f i l e _ p a t h } ,   :   { s t r ( e ) } \ n " ,   " e r r o r " ) 
 
 +                 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " X[nd[b\ n " ,   " s u c c e s s " ) 
 
 +         e x c e p t   E x c e p t i o n   a s   e : 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ndX[eQ:   { s t r ( e ) } \ n " ,   " e r r o r " ) 
 
 + 
 
 + d e f   o r g a n i z e _ p r o j e c t _ f i l e s ( l o g _ w i d g e t ) : 
 
 +         " " " tetyveN~g" " " 
 
 +         t r y : 
 
 +                 #   R^_vvU_
 
 +                 d i r e c t o r i e s   =   [ " d a t a / i n p u t " ,   " d a t a / o u t p u t " ,   " d a t a / t e m p " ,   " l o g s " ] 
 
 +                 f o r   d i r e c t o r y   i n   d i r e c t o r i e s : 
 
 +                         i f   n o t   o s . p a t h . e x i s t s ( d i r e c t o r y ) : 
 
 +                                 o s . m a k e d i r s ( d i r e c t o r y ,   e x i s t _ o k = T r u e ) 
 
 +                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " R^vU_:   { d i r e c t o r y } \ n " ,   " i n f o " ) 
 
 +                 
 
 +                 #   yRe_eN0Rl o g s vU_
 
 +                 f o r   f i l e   i n   o s . l i s t d i r ( " . " ) : 
 
 +                         i f   f i l e . e n d s w i t h ( " . l o g " )   a n d   o s . p a t h . i s f i l e ( f i l e ) : 
 
 +                                 d e s t _ p a t h   =   o s . p a t h . j o i n ( " l o g s " ,   f i l e ) 
 
 +                                 t r y : 
 
 +                                         s h u t i l . m o v e ( f i l e ,   d e s t _ p a t h ) 
 
 +                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yRe_eN:   { f i l e }   - >   { d e s t _ p a t h } \ n " ,   " i n f o " ) 
 
 +                                 e x c e p t   E x c e p t i o n   a s   e : 
 
 +                                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yReNeQ:   { f i l e } ,   :   { s t r ( e ) } \ n " ,   " e r r o r " ) 
 
 +                 
 
 +                 #   yRMneN0Rc o n f i g vU_
 
 +                 i f   n o t   o s . p a t h . e x i s t s ( " c o n f i g " ) : 
 
 +                         o s . m a k e d i r s ( " c o n f i g " ,   e x i s t _ o k = T r u e ) 
 
 +                 
 
 +                 f o r   f i l e   i n   o s . l i s t d i r ( " . " ) : 
 
 +                         i f   f i l e . e n d s w i t h ( " . i n i " )   o r   f i l e . e n d s w i t h ( " . c f g " )   o r   f i l e . e n d s w i t h ( " . j s o n " ) : 
 
 +                                 i f   o s . p a t h . i s f i l e ( f i l e )   a n d   f i l e   ! =   " d a t a / u s e r _ s e t t i n g s . j s o n " : 
 
 +                                         d e s t _ p a t h   =   o s . p a t h . j o i n ( " c o n f i g " ,   f i l e ) 
 
 +                                         t r y : 
 
 +                                                 s h u t i l . m o v e ( f i l e ,   d e s t _ p a t h ) 
 
 +                                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yRMneN:   { f i l e }   - >   { d e s t _ p a t h } \ n " ,   " i n f o " ) 
 
 +                                         e x c e p t   E x c e p t i o n   a s   e : 
 
 +                                                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " yReNeQ:   { f i l e } ,   :   { s t r ( e ) } \ n " ,   " e r r o r " ) 
 
 +                 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   " yveNtet[b\ n " ,   " s u c c e s s " ) 
 
 +         e x c e p t   E x c e p t i o n   a s   e : 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " tetyveNeQ:   { s t r ( e ) } \ n " ,   " e r r o r " ) 
 
 + 
 
 + d e f   c l e a n _ d a t a _ f i l e s ( l o g _ w i d g e t ) : 
 
 +         " " " ntpenceN" " " 
 
 +         t r y : 
 
 +                 #   nxnt
 
 +                 i f   n o t   m e s s a g e b o x . a s k y e s n o ( " nxnt" ,   " nx[nt@b	gpenceNTُ\ Rd@b	geQTQpenc0" ) : 
 
 +                         a d d _ t o _ l o g ( l o g _ w i d g e t ,   " d\O]Sm\ n " ,   " i n f o " ) 
 
 +                         r e t u r n 
 
 +                 
 
 +                 #   nteQvU_
 
 +                 i n p u t _ d i r   =   " d a t a / i n p u t " 
 
 +                 f i l e s _ c l e a n e d   =   0 
 
 +                 f o r   f i l e   i n   o s . l i s t d i r ( i n p u t _ d i r ) : 
 
 +                         f i l e _ p a t h   =   o s . p a t h . j o i n ( i n p u t _ d i r ,   f i l e ) 
 
 +                         i f   o s . p a t h . i s f i l e ( f i l e _ p a t h ) : 
 
 +                                 o s . r e m o v e ( f i l e _ p a t h ) 
 
 +                                 f i l e s _ c l e a n e d   + =   1 
 
 +                 
 
 +                 #   ntQvU_
 
 +                 o u t p u t _ d i r   =   " d a t a / o u t p u t " 
 
 +                 f o r   f i l e   i n   o s . l i s t d i r ( o u t p u t _ d i r ) : 
 
 +                         f i l e _ p a t h   =   o s . p a t h . j o i n ( o u t p u t _ d i r ,   f i l e ) 
 
 +                         i f   o s . p a t h . i s f i l e ( f i l e _ p a t h ) : 
 
 +                                 o s . r e m o v e ( f i l e _ p a t h ) 
 
 +                                 f i l e s _ c l e a n e d   + =   1 
 
 +                                 
 
 +                 #   nt4NevU_
 
 +                 t e m p _ d i r   =   " d a t a / t e m p " 
 
 +                 f o r   f i l e   i n   o s . l i s t d i r ( t e m p _ d i r ) : 
 
 +                         f i l e _ p a t h   =   o s . p a t h . j o i n ( t e m p _ d i r ,   f i l e ) 
 
 +                         i f   o s . p a t h . i s f i l e ( f i l e _ p a t h ) : 
 
 +                                 o s . r e m o v e ( f i l e _ p a t h ) 
 
 +                                 f i l e s _ c l e a n e d   + =   1 
 
 +                 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ]nt  { f i l e s _ c l e a n e d }   *NpenceN\ n " ,   " s u c c e s s " ) 
 
 +         e x c e p t   E x c e p t i o n   a s   e : 
 
 +                 a d d _ t o _ l o g ( l o g _ w i d g e t ,   f " ntpenceNeQ:   { s t r ( e ) } \ n " ,   " e r r o r " ) 
 
 + 
 
 + d e f   c e n t e r _ w i n d o w ( w i n d o w ) : 
 
 +         " " " OzSE\-N>f:y" " " 
 
 +         w i n d o w . u p d a t e _ i d l e t a s k s ( ) 
 
 +         w i d t h   =   w i n d o w . w i n f o _ w i d t h ( ) 
 
 +         h e i g h t   =   w i n d o w . w i n f o _ h e i g h t ( ) 
 
 +         x   =   ( w i n d o w . w i n f o _ s c r e e n w i d t h ( )   / /   2 )   -   ( w i d t h   / /   2 ) 
 
 +         y   =   ( w i n d o w . w i n f o _ s c r e e n h e i g h t ( )   / /   2 )   -   ( h e i g h t   / /   2 ) 
 
 +         w i n d o w . g e o m e t r y ( ' { } x { } + { } + { } ' . f o r m a t ( w i d t h ,   h e i g h t ,   x ,   y ) ) 
 
 + 
 
   i f   _ _ n a m e _ _   = =   " _ _ m a i n _ _ " : 
 
           m a i n ( )   
 
 \   N o   n e w l i n e   a t   e n d   o f   f i l e 
 
 