1
- # gascii.py
2
- # A graphic and interactive table of printable ASCII characters.
1
+ # gascii.py
2
+ # A graphic and interactive table of printable ASCII characters.
3
3
#
4
4
# Copyright 2020 Timéo Arnouts <tim.arnouts@protonmail.com>
5
5
#
28
28
29
29
ConsoleEffect = NoReturn
30
30
31
- ASCII_CHARS = [chr (char )
32
- for char in range (32 , 127 )]
31
+ ASCII_CHARS = [chr (char ) for char in range (32 , 127 )]
33
32
34
33
TITLE = "ASCII character table"
35
34
DESCRIPTION = "The 95 ASCII printable characters."
@@ -80,9 +79,9 @@ def cursor_position(stdscr,
80
79
cursor_x -= 2
81
80
elif key == curses .KEY_RIGHT :
82
81
cursor_x += 2
83
- elif key == 339 : # Page ▲ key.
82
+ elif key == 339 : # Page ▲ key.
84
83
cursor_y = pos_y
85
- elif key == 338 : # Page ▼ key.
84
+ elif key == 338 : # Page ▼ key.
86
85
cursor_y = pos_y + y_max
87
86
elif key == 262 : # Begin ◄ key.
88
87
cursor_x = pos_x
@@ -115,8 +114,8 @@ def char_indications(stdscr,
115
114
"""
116
115
char = chr (char_code )
117
116
118
- char_line = "Char: %s" % char
119
- char_name = "Name: %s" % unicodedata .name (char )
117
+ char_line = "Char: " + char
118
+ char_name = "Name: " + unicodedata .name (char )
120
119
121
120
stdscr .addstr (pos_y + 1 , pos_x , TITLE .center (pos_x - 7 ), curses .A_BOLD )
122
121
stdscr .addstr (pos_y + 3 , pos_x , DESCRIPTION )
@@ -135,7 +134,7 @@ def char_indications(stdscr,
135
134
def mainloop (stdscr ) -> ConsoleEffect :
136
135
"""curses rendering."""
137
136
rows , cols = stdscr .getmaxyx ()
138
-
137
+
139
138
char_table_pos_x , char_table_pos_y = (4 , 2 )
140
139
interface_pos = (cols // 2 , 0 )
141
140
@@ -144,7 +143,7 @@ def mainloop(stdscr) -> ConsoleEffect:
144
143
char_table_pos_y ,
145
144
30 , 10 )
146
145
147
- for char in cursor_positions :
146
+ for char in cursor_positions :
148
147
stdscr .clear ()
149
148
stdscr .box ()
150
149
0 commit comments