Skip to content

Commit e35cf0d

Browse files
committed
Rename CursesTextAttrConstant and CursesTextAttrConstants tp CursesTextAttribute and CursesTextAttributes.
1 parent 9888ac8 commit e35cf0d

File tree

5 files changed

+29
-31
lines changed

5 files changed

+29
-31
lines changed

visualdialog/__init__.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11

2-
"""
3-
A library to make easier dialog box in terminal.
4-
"""
2+
"""A library to make easier dialog box in terminal."""
53

64
__version__ = 0.7
75
__author__ = "Timéo Arnouts"

visualdialog/box.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import List, Literal, Sequence, Tuple, Union
1010

1111
from .utils import (CursesKey, CursesKeys,
12-
CursesTextAttrConstant, CursesTextAttrConstants,
12+
CursesTextAttribute, CursesTextAttributes,
1313
CursesWindow, TextAttr)
1414

1515

@@ -82,8 +82,8 @@ def __init__(
8282
width: int,
8383
title: str = "",
8484
title_colors_pair_nb: int = 0,
85-
title_text_attr: Union[CursesTextAttrConstant,
86-
CursesTextAttrConstants] = curses.A_BOLD,
85+
title_text_attr: Union[CursesTextAttribute,
86+
CursesTextAttributes] = curses.A_BOLD,
8787
downtime_chars: Sequence[str] = (",", ".", ":", ";", "!", "?"),
8888
downtime_chars_delay: int = 600):
8989
self.pos_x, self.pos_y = pos_x, pos_y

visualdialog/choices.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from typing import Any, Mapping, Tuple, Union
66

77
from .dialog import DialogBox
8-
from .utils import CursesTextAttrConstants, TextAttr, chunked
8+
from .utils import CursesTextAttributes, TextAttr, chunked
99

1010

1111
class ChoiceBox(DialogBox):

visualdialog/dialog.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
from typing import Any, Callable, List, Mapping, Sequence, Tuple, Union
1010

1111
from .box import BaseTextBox
12-
from .utils import (CursesTextAttrConstant, CursesTextAttrConstants,
12+
from .utils import (CursesTextAttribute, CursesTextAttributes,
1313
CursesWindow, TextAttr, chunked)
1414

1515

@@ -43,8 +43,8 @@ def __init__(
4343
width: int,
4444
title: str = "",
4545
title_colors_pair_nb: int = 0,
46-
title_text_attr: Union[CursesTextAttrConstant,
47-
CursesTextAttrConstants] = curses.A_BOLD,
46+
title_text_attr: Union[CursesTextAttribute,
47+
CursesTextAttributes] = curses.A_BOLD,
4848
downtime_chars: Sequence[str] = (",", ".", ":", ";", "!", "?"),
4949
downtime_chars_delay: int = 60,
5050
end_indicator: str = "►"):
@@ -74,8 +74,8 @@ def __exit__(self, type, value, traceback):
7474
def _display_end_indicator(
7575
self,
7676
win: CursesWindow,
77-
text_attr: CursesTextAttrConstants = (curses.A_BOLD,
78-
curses.A_BLINK)):
77+
text_attr: CursesTextAttributes= (curses.A_BOLD,
78+
curses.A_BLINK)):
7979
"""Displays an end indicator in the lower right corner of
8080
textbox.
8181
@@ -120,7 +120,7 @@ def _write_word_char_by_char(self,
120120
callback(*cargs)
121121

122122
def _write_word(self,
123-
win,
123+
win: CursesWindow,
124124
pos_x: int,
125125
pos_y: int,
126126
word: str,
@@ -142,14 +142,14 @@ def _write_word(self,
142142

143143
def _one_by_one(self,
144144
write_method: Callable,
145-
win,
145+
win: CursesWindow,
146146
text: str,
147147
colors_pair_nb: int,
148-
text_attr: Union[CursesTextAttrConstant,
149-
CursesTextAttrConstants],
148+
text_attr: Union[CursesTextAttribute,
149+
CursesTextAttributes],
150150
words_attr: Mapping[Sequence[str],
151-
Union[CursesTextAttrConstant,
152-
CursesTextAttrConstants]],
151+
Union[CursesTextAttribute,
152+
CursesTextAttributes]],
153153
word_delimiter: str,
154154
flash_screen: bool,
155155
delay: int,
@@ -207,11 +207,11 @@ def char_by_char(
207207
win: CursesWindow,
208208
text: str,
209209
colors_pair_nb: int = 0,
210-
text_attr: Union[CursesTextAttrConstant,
211-
CursesTextAttrConstants] = (),
210+
text_attr: Union[CursesTextAttribute,
211+
CursesTextAttributes] = (),
212212
words_attr: Mapping[Sequence[str],
213-
Union[CursesTextAttrConstant,
214-
CursesTextAttrConstants]] = {},
213+
Union[CursesTextAttribute,
214+
CursesTextAttributes]] = {},
215215
word_delimiter: str = " ",
216216
flash_screen: bool = False,
217217
delay: int = 40,
@@ -309,11 +309,11 @@ def word_by_word(
309309
win: CursesWindow,
310310
text: str,
311311
colors_pair_nb: int = 0,
312-
text_attr: Union[CursesTextAttrConstant,
313-
CursesTextAttrConstants] = (),
312+
text_attr: Union[CursesTextAttribute,
313+
CursesTextAttributes] = (),
314314
words_attr: Mapping[Sequence[str],
315-
Union[CursesTextAttrConstant,
316-
CursesTextAttrConstants]] = {},
315+
Union[CursesTextAttribute,
316+
CursesTextAttributes]] = {},
317317
word_delimiter: str = " ",
318318
flash_screen: bool = False,
319319
delay: int = 150,

visualdialog/utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# 2020 Timéo Arnouts <[email protected]>
33

44
__all__ = ["CursesWindow",
5-
"CursesTextAttrConstant",
6-
"CursesTextAttrConstants",
5+
"CursesTextAttribute",
6+
"CursesTextAttributes",
77
"CursesKey",
88
"CursesKeys",
99
"CursesWindow",
@@ -23,8 +23,8 @@
2323

2424
#: curses text attribute constants are integers.
2525
#: See https://docs.python.org/3/library/curses.html?#constants
26-
CursesTextAttrConstant = int
27-
CursesTextAttrConstants = Sequence[CursesTextAttrConstant]
26+
CursesTextAttribute = int
27+
CursesTextAttributes = Sequence[CursesTextAttribute]
2828

2929

3030
def chunked(seq: Sequence,
@@ -50,7 +50,7 @@ class TextAttr(ContextDecorator):
5050
"""
5151
def __init__(self,
5252
win: CursesWindow,
53-
*attributes: Iterable[CursesTextAttrConstant]):
53+
*attributes: CursesTextAttribute):
5454
self.win = win
5555
self.attributes = attributes
5656

0 commit comments

Comments
 (0)