[tor-commits] [nyx/master] Drop unused getstr() arguments
atagar at torproject.org
atagar at torproject.org
Mon Feb 15 14:45:09 UTC 2016
commit cc60ec1a0e8be6990ab2499929cb7d0fea9bad8f
Author: Damian Johnson <atagar at torproject.org>
Date: Sun Feb 14 16:01:47 2016 -0800
Drop unused getstr() arguments
We only use this method one place so tempted to get rid of it alltogether, but
for now dropping the arguments we don't use. We could probably drop these
curses.A_NORMAL bits but not sure, so leaving it alone for now.
---
nyx/util/panel.py | 18 +++++-------------
1 file changed, 5 insertions(+), 13 deletions(-)
diff --git a/nyx/util/panel.py b/nyx/util/panel.py
index 10727c8..283a16a 100644
--- a/nyx/util/panel.py
+++ b/nyx/util/panel.py
@@ -624,7 +624,7 @@ class Panel(object):
return x, y
- def getstr(self, y, x, initial_text = '', text_format = None, max_width = None):
+ def getstr(self, y, x, initial_text = ''):
"""
Provides a text field where the user can input a string, blocking until
they've done so and returning the result. If the user presses escape then
@@ -639,13 +639,8 @@ class Panel(object):
y - vertical location
x - horizontal location
initial_text - starting text in this field
- text_format - format used for the text
- max_width - maximum width for the text field
"""
- if not text_format:
- text_format = curses.A_NORMAL
-
# makes cursor visible
try:
@@ -657,20 +652,17 @@ class Panel(object):
display_width = self.get_preferred_size()[1]
- if max_width:
- display_width = min(display_width, max_width + x)
-
input_subwindow = self.parent.subwin(1, display_width - x, self.top + y, self.left + x)
# blanks the field's area, filling it with the font in case it's hilighting
input_subwindow.clear()
- input_subwindow.bkgd(' ', text_format)
+ input_subwindow.bkgd(' ', curses.A_NORMAL)
# prepopulates the initial text
if initial_text:
- input_subwindow.addstr(0, 0, initial_text[:display_width - x - 1], text_format)
+ input_subwindow.addstr(0, 0, initial_text[:display_width - x - 1], curses.A_NORMAL)
# Displays the text field, blocking until the user's done. This closes the
# text panel and returns user_input to the initial text if the user presses
@@ -680,9 +672,9 @@ class Panel(object):
validator = BasicValidator()
- textbox.win.attron(text_format)
+ textbox.win.attron(curses.A_NORMAL)
user_input = textbox.edit(lambda key: validator.validate(key, textbox)).strip()
- textbox.win.attroff(text_format)
+ textbox.win.attroff(curses.A_NORMAL)
if textbox.lastcmd == curses.ascii.BEL:
user_input = None
More information about the tor-commits
mailing list