Skip to content

Commit b967aaf

Browse files
committed
Rename length variable to height.
1 parent e074bc0 commit b967aaf

File tree

4 files changed

+20
-18
lines changed

4 files changed

+20
-18
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ from visualdialog import DialogBox
7373

7474

7575
x, y = (0, 0)
76-
length, width = (35, 6)
76+
height, width = (35, 6)
7777

7878
def main(stdscr):
7979
curses.curs_set(False)
8080

8181
textbox = DialogBox(x, y,
82-
length, width,
82+
height, width,
8383
title="Demo")
8484
textbox.char_by_char(stdscr,
8585
"Hello world")
@@ -116,6 +116,8 @@ You can also generate the documentation in **Latex**, **Texinfo** or **man-pages
116116

117117
We would love for you to contribute to improve **Visual-dialog**.
118118

119+
For major changes, please open an issue first to discuss what you would like to change.
120+
119121
Take a look at our [contributing guide](CONTRIBUTING.md) to get started.
120122
You can also help by reporting **bugs**.
121123

examples/confrontation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,27 +20,27 @@ def main(stdscr):
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, length = 6, 35 # Width and length (in character).
23+
width, height = 6, 35 # Width and height (in character).
2424

2525
max_y, max_x = stdscr.getmaxyx()
2626

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

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

3737
april_may = DialogBox(center_x, bottom_y,
38-
length, width,
38+
height, width,
3939
title="April",
4040
title_colors_pair_nb=2)
4141

4242
miles_edgeworth = DialogBox(right_x, bottom_y,
43-
length, width,
43+
height, width,
4444
title="Edgeworth",
4545
title_colors_pair_nb=3)
4646

visualdialog/box.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class BaseTextBox:
6161
:param pos_y: y position of the dialog box in ``curses`` window
6262
object on which methods will have effects.
6363
64-
:param length: Length of the dialog box in ``curses`` window object
64+
:param height: Height of the dialog box in ``curses`` window object
6565
on which methods will have effects.
6666
6767
:param width: Width of the dialog box in ``curses`` window object on
@@ -97,7 +97,7 @@ def __init__(
9797
self,
9898
pos_x: int,
9999
pos_y: int,
100-
length: int,
100+
height: int,
101101
width: int,
102102
title: str = "",
103103
title_colors_pair_nb: int = 0,
@@ -107,7 +107,7 @@ def __init__(
107107
List[str]] = (",", ".", ":", ";", "!", "?"),
108108
downtime_chars_delay: Number = .6):
109109
self.pos_x, self.pos_y = pos_x, pos_y
110-
self.length, self.width = length, width
110+
self.height, self.width = height, width
111111

112112
self.title_offsetting_y = 2 if title else 0
113113

@@ -116,7 +116,7 @@ def __init__(
116116
# Compensation for the upper border of the dialog box.
117117
self.text_pos_y = pos_y + self.title_offsetting_y + 1
118118

119-
self.nb_char_max_line = length - 4
119+
self.nb_char_max_line = height - 4
120120
self.nb_lines_max = width - 2
121121

122122
self.title = title
@@ -149,9 +149,9 @@ def position(self) -> Tuple[int]:
149149
def dimensions(self) -> Tuple[int]:
150150
"""Returns a tuple contains dimensions of ``TextBox``.
151151
152-
:returns: Length and width of ``TextBox``.
152+
:returns: Height and width of ``TextBox``.
153153
"""
154-
return self.length, self.width
154+
return self.height, self.width
155155

156156
def framing_box(self, win: CursesWindow):
157157
"""Displays dialog box borders and his title.
@@ -184,7 +184,7 @@ def framing_box(self, win: CursesWindow):
184184
self.pos_y + self.title_offsetting_y,
185185
self.pos_x,
186186
self.pos_y + self.title_offsetting_y + self.width,
187-
self.pos_x + self.length)
187+
self.pos_x + self.height)
188188

189189
def getkey(self, win: CursesWindow):
190190
"""Blocks execution as long as a key contained in

visualdialog/dialog.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(
6363
self,
6464
pos_x: int,
6565
pos_y: int,
66-
length: int,
66+
height: int,
6767
width: int,
6868
title: str = "",
6969
title_colors_pair_nb: int = 0,
@@ -75,13 +75,13 @@ def __init__(
7575
end_indicator: str = "►"):
7676
BaseTextBox.__init__(self,
7777
pos_x, pos_y,
78-
length, width,
78+
height, width,
7979
title,
8080
title_colors_pair_nb, title_text_attr,
8181
downtime_chars, downtime_chars_delay)
8282

8383
self.end_indicator_char = end_indicator
84-
self.end_indicator_pos_x = self.pos_x + self.length - 2
84+
self.end_indicator_pos_x = self.pos_x + self.height - 2
8585

8686
if self.title:
8787
self.end_indicator_pos_y = self.pos_y + self.width + 1

0 commit comments

Comments
 (0)