Skip to content

Commit e71ef0e

Browse files
authored
Some fix according pep8
2 parents 3d4aaa8 + 06c4e73 commit e71ef0e

File tree

10 files changed

+54
-58
lines changed

10 files changed

+54
-58
lines changed

doc/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575

7676
texinfo_documents = [
7777
(master_doc, "Visual-dialog", "Visual-dialog Documentation",
78-
author, "Visual-dialog", "A library to make easier dialog box in terminal.",
78+
author, "Visual-dialog",
79+
"A library to make easier dialog box in terminal.",
7980
"Miscellaneous"),
8081
]

examples/confrontation.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# confrontation.py
2-
#
3-
# A concrete example exploiting the possibilities of Visual-dialog.
2+
# A concrete example exploiting the possibilities of Visual-dialog.
43

54
import curses
65

@@ -11,28 +10,29 @@
1110
# 10 and 32 correspond to enter and space keys.
1211
PASS_DIALOG_KEY = (10, 32)
1312

13+
1414
def main(stdscr):
15-
# Makes the cursor invisible.
15+
# Makes the cursor invisible.
1616
curses.curs_set(False)
1717

1818
# Definition of several colors pairs.
1919
curses.init_pair(1, curses.COLOR_BLUE, curses.COLOR_BLACK)
2020
curses.init_pair(2, curses.COLOR_MAGENTA, curses.COLOR_BLACK)
2121
curses.init_pair(3, curses.COLOR_RED, curses.COLOR_BLACK)
2222

23-
width, height = 6, 35 # Width and height (in character).
23+
width, height = 6, 35 # Width and height (in character).
2424

2525
max_y, max_x = stdscr.getmaxyx()
2626

27-
left_x = 2 # Left alignment.
28-
right_x = max_x - height - 4 # Calculation of right alignment.
29-
center_x = max_x // 2 - height // 2 # Calculation of center alignment.
30-
bottom_y = max_y - width - 4 # Calculation of bottom alignment.
27+
left_x = 2 # Left alignment.
28+
right_x = max_x - height - 4 # Calculation of right alignment.
29+
center_x = max_x//2 - height//2 # Calculation of center alignment.
30+
bottom_y = max_y - width - 4 # Calculation of bottom alignment.
3131

3232
phoenix_wright = DialogBox(left_x, bottom_y,
3333
height, width,
3434
title="Phoenix",
35-
title_colors_pair_nb=1) # Title and color_pair used to colored title.
35+
title_colors_pair_nb=1) # Title and color_pair used to colored title.
3636

3737
april_may = DialogBox(center_x, bottom_y,
3838
height, width,
@@ -44,14 +44,14 @@ def main(stdscr):
4444
title="Edgeworth",
4545
title_colors_pair_nb=3)
4646

47-
# Definition of accepted key codes to pass a dialog.
47+
# Definition of accepted key codes to pass a dialog.
4848
phoenix_wright.confirm_dialog_key = PASS_DIALOG_KEY
4949
april_may.confirm_dialog_key = PASS_DIALOG_KEY
5050
miles_edgeworth.confirm_dialog_key = PASS_DIALOG_KEY
5151

5252
phoenix_wright.char_by_char(stdscr,
5353
"This testimony is a pure invention !",
54-
delay=0.03) # Set delay between writting each characters to 0.03 seconde.
54+
delay=0.03) # Set delay between writting each characters to 0.03 seconde.
5555

5656
phoenix_wright.char_by_char(stdscr,
5757
"You're lying April May !",

examples/monologue.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# monologue.py
2-
#
3-
# A simple example of how to use Visual-dialog.
2+
# A simple example of how to use Visual-dialog.
43

54
import curses
65

@@ -12,6 +11,7 @@
1211
ENTER_KEY = 10
1312
SPACE_KEY = 32
1413

14+
1515
def main(stdscr):
1616
replys = (
1717
"Hello world",
@@ -20,27 +20,27 @@ def main(stdscr):
2020
"See doc for more informations."
2121
)
2222

23-
# Makes the cursor invisible.
23+
# Makes the cursor invisible.
2424
curses.curs_set(False)
2525

2626
# Definition of several colors pairs.
2727
curses.init_pair(1, curses.COLOR_GREEN, curses.COLOR_BLACK)
2828
curses.init_pair(2, curses.COLOR_CYAN, curses.COLOR_BLACK)
2929

30-
textbox = DialogBox(1, 1, # Position 1;1 in stdscr.
31-
40, 6, # Length and width of textbox (in character).
32-
title="Tim-ats-d", # Title of textbox.
30+
textbox = DialogBox(1, 1, # Position 1;1 in stdscr.
31+
40, 6, # Length and width of textbox (in character).
32+
title="Tim-ats-d", # Title of textbox.
3333
title_colors_pair_nb=1) # Curses color_pair used to colored title.
3434

35-
# Definition of accepted key codes to pass a dialog.
35+
# Definition of accepted key codes to pass a dialog.
3636
textbox.confirm_dialog_key = (ENTER_KEY, SPACE_KEY)
3737

3838
# Iterate on each sentence contained in replys.
3939
for reply in replys:
4040
textbox.char_by_char(stdscr,
4141
reply,
42-
2, # Display text colored with color pair 2.
43-
delay=0.04) # Set delay between writting each characters to 0.04 seconde.
42+
2, # Display text colored with color pair 2.
43+
delay=0.04) # Set delay between writting each characters to 0.04 seconde.
4444

4545

4646
# Execution of main function.

examples/text_attributes.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# text_attributes.py
2-
#
32
# An example showing the possibilities of text formatting.
43

54
import curses
@@ -12,8 +11,9 @@
1211
ENTER_KEY = 10
1312
SPACE_KEY = 32
1413

14+
1515
def main(stdscr):
16-
# Makes the cursor invisible.
16+
# Makes the cursor invisible.
1717
curses.curs_set(False)
1818

1919
# Definition of several colors pairs.
@@ -23,13 +23,13 @@ def main(stdscr):
2323
demo_textbox = DialogBox(1, 1,
2424
40, 6,
2525
title="Demo",
26-
title_colors_pair_nb=1, # Display title colored with color pair 1.
27-
title_text_attr=curses.A_UNDERLINE) # curse text attributes that will be applied to the title.
26+
title_colors_pair_nb=1, # Display title colored with color pair 1.
27+
title_text_attr=curses.A_UNDERLINE) # curse text attributes that will be applied to the title.
2828
demo_textbox.confirm_dialog_key = (ENTER_KEY, SPACE_KEY)
2929

30-
# A key/value dictionary containing the text and the attributes
31-
# with which it will be displayed.
32-
# You can pass one or more curses text attributes arguments as a tuple.
30+
# A key/value dictionary containing the text and the attributes
31+
# with which it will be displayed.
32+
# You can pass one or more curses text attributes arguments as a tuple.
3333
sentences = {
3434
"An important text.": curses.A_BOLD,
3535
"An action performed by a character.": curses.A_ITALIC,
@@ -43,8 +43,8 @@ def main(stdscr):
4343
for text, attributes in sentences.items():
4444
demo_textbox.char_by_char(stdscr,
4545
text,
46-
2, # Display text colored with color pair 2.
47-
text_attr=attributes) # Pass attributes to text.
46+
2, # Display text colored with color pair 2.
47+
text_attr=attributes) # Pass attributes to text.
4848

4949

5050
# Execution of main function.

examples/word.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# words.py
2-
#
3-
# An example of using the word_by_word method from text boxes.
2+
# An example of using the word_by_word method from text boxes.
43

54
import curses
65

@@ -12,28 +11,29 @@
1211
ENTER_KEY = 10
1312
SPACE_KEY = 32
1413

15-
def main(stdscr):
16-
instructions = (
17-
"Instead of the char_by_char method, word_by_word displays the "
18-
"given text word by word.",
19-
"It can be useful to make robots talk for example."
20-
)
14+
instructions = (
15+
"Instead of the char_by_char method, word_by_word displays the "
16+
"given text word by word.",
17+
"It can be useful to make robots talk for example."
18+
)
19+
2120

22-
# Makes the cursor invisible.
21+
def main(stdscr):
22+
# Makes the cursor invisible.
2323
curses.curs_set(False)
2424

25-
textbox = DialogBox(1, 1, # Position 1;1 in stdscr.
26-
40, 6, # Length and width of textbox (in character).
27-
title="Robot") # Title of textbox.
25+
textbox = DialogBox(1, 1, # Position 1;1 in stdscr.
26+
40, 6, # Length and width of textbox (in character).
27+
title="Robot") # Title of textbox.
2828

29-
# Definition of accepted key codes to pass a dialog.
29+
# Definition of accepted key codes to pass a dialog.
3030
textbox.confirm_dialog_key = (ENTER_KEY, SPACE_KEY)
3131

32-
# Iterate on each sentence contained in replys.
32+
# Iterate on each sentence contained in instructions.
3333
for instruction in instructions:
3434
textbox.word_by_word(stdscr,
3535
instruction,
36-
delay=0.2) # Set delay between writting each words to 0.1 seconde.
36+
delay=0.2) # Set delay between writting each words to 0.1 seconde.
3737

3838

3939
# Execution of main function.

tests/test.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# test.py
2-
#
3-
# This file contains the tests used to debug the library.
2+
# This file contains the tests used to debug the library.
43

54
import curses
65

visualdialog/box.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# box.py
2-
#
32
# 2020 Timéo Arnouts <[email protected]>
43

54
__all__ = ["BaseTextBox"]

visualdialog/choices.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# choices.py
2-
#
32
# 2020 Timéo Arnouts <[email protected]>
43

54
import curses

visualdialog/dialog.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# dialog.py
2-
#
32
# 2020 Timéo Arnouts <[email protected]>
43

54
__all__ = ["DialogBox"]
@@ -80,10 +79,10 @@ def __exit__(self, type, value, traceback):
8079
...
8180

8281
def _display_end_indicator(
83-
self,
84-
win: CursesWindow,
85-
text_attr: CursesTextAttributesConstants = (curses.A_BOLD,
86-
curses.A_BLINK)):
82+
self,
83+
win: CursesWindow,
84+
text_attr: CursesTextAttributesConstants = (curses.A_BOLD,
85+
curses.A_BLINK)):
8786
"""Displays an end indicator in the lower right corner of
8887
textbox.
8988

visualdialog/utils.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
# utils.py
2-
#
32
# 2020 Timéo Arnouts <[email protected]>
43

54
from contextlib import ContextDecorator
@@ -11,12 +10,12 @@
1110
CursesWindow = _curses.window
1211

1312
#: curses text attribute constants are integers.
14-
#: See https://docs.python.org/3/library/curses.html?#constants
13+
#: See https://docs.python.org/3/library/curses.html?#constants
1514
CursesTextAttributesConstant = int
1615
CursesTextAttributesConstants = Union[Tuple[int], List[int]]
1716

18-
#: curses key constants are integers.
19-
#: See https://docs.python.org/3/library/curses.html?#constants
17+
#: curses key constants are integers.
18+
#: See https://docs.python.org/3/library/curses.html?#constants
2019
CursesKeyConstant = int
2120
CursesKeyConstants = Union[Tuple[int], List[int]]
2221

0 commit comments

Comments
 (0)