4
4
# Copyright © 2024, A.A. Suvorov
5
5
# All rights reserved.
6
6
# --------------------------------------------------------
7
- # https://github.com/smartlegionlab//
7
+ # https://github.com/smartlegionlab/
8
8
# --------------------------------------------------------
9
9
import shutil
10
10
11
11
12
12
class CenteredTextDecorator :
13
13
14
14
@classmethod
15
- def decorate (cls , text = '' , char = '' ):
15
+ def decorate (cls , text = '' , symbol = '' ):
16
16
columns = cls ._get_term_width ()
17
- symbol = ' ' if not char else char
17
+ symbol = ' ' if not symbol else symbol
18
18
msg = (f' { text } ' if text else '' ).center (columns , symbol [0 ])
19
19
return msg
20
20
@@ -26,30 +26,30 @@ def _get_term_width(cls):
26
26
class FramedTextDecorator :
27
27
28
28
@classmethod
29
- def decorate (cls , text = '' , top_char = '-' , bottom_char = '-' ):
29
+ def decorate (cls , text = '' , top_symbol = '-' , bottom_symbol = '-' ):
30
30
text_len = len (text )
31
- top_text = top_char * text_len
32
- bottom_text = bottom_char * text_len
31
+ top_text = top_symbol * text_len
32
+ bottom_text = bottom_symbol * text_len
33
33
return f'{ top_text } \n { text } \n { bottom_text } '
34
34
35
35
36
36
class SmartPrinter :
37
37
38
38
@classmethod
39
- def print_center (cls , text = '' , char = '-' ):
40
- print (CenteredTextDecorator .decorate (text , char ))
39
+ def print_center (cls , text = '' , symbol = '-' ):
40
+ print (CenteredTextDecorator .decorate (text , symbol ))
41
41
42
42
@classmethod
43
- def print_framed (cls , text = '' , char = '-' ):
44
- print (FramedTextDecorator .decorate (text , char ))
43
+ def print_framed (cls , text = '' , symbol = '-' ):
44
+ print (FramedTextDecorator .decorate (text , symbol ))
45
45
46
46
@classmethod
47
- def show_head (cls , text = '' , top_char = '*' , main_char = '-' ):
48
- print (CenteredTextDecorator .decorate (char = top_char ))
49
- print (CenteredTextDecorator .decorate (text = text , char = main_char ))
47
+ def show_head (cls , text = '' , top_symbol = '*' , main_symbol = '-' ):
48
+ print (CenteredTextDecorator .decorate (symbol = top_symbol ))
49
+ print (CenteredTextDecorator .decorate (text = text , symbol = main_symbol ))
50
50
51
51
@classmethod
52
- def show_footer (cls , url = '' , copyright_ = '' , top_char = '-' , main_char = '*' ):
53
- print (CenteredTextDecorator .decorate (text = url , char = top_char ))
54
- print (CenteredTextDecorator .decorate (text = copyright_ , char = top_char ))
55
- print (CenteredTextDecorator .decorate (char = main_char ))
52
+ def show_footer (cls , url = '' , copyright_ = '' , top_symbol = '-' , main_symbol = '*' ):
53
+ print (CenteredTextDecorator .decorate (text = url , symbol = top_symbol ))
54
+ print (CenteredTextDecorator .decorate (text = copyright_ , symbol = top_symbol ))
55
+ print (CenteredTextDecorator .decorate (symbol = main_symbol ))
0 commit comments