>
> Looks good, but I can see wanting a mask of "" (don't show anything when
> users enter input). Change the default to mask=None and treat mask=""
> as hiding all input and I'll take the patch.
Fixed in the attachment (second patch on top of the old one, should be
fine for git as that's what it wants ;) ...).
-nik
>From 4c2099ea4dda3c679e0b8fd71ebbc4046048c730 Mon Sep 17 00:00:00 2001
From: Dominik George <[email protected]>
Date: Mon, 20 Dec 2010 18:45:52 +0100
Subject: [PATCH 2/2] Modified masking to accept empty mask.
Signed-off-by: Dominik George <[email protected]>
---
urwid/widget.py | 6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/urwid/widget.py b/urwid/widget.py
index 742ce56..0cbc69c 100644
--- a/urwid/widget.py
+++ b/urwid/widget.py
@@ -715,7 +715,7 @@ class Edit(Text):
def __init__(self, caption="", edit_text="", multiline=False,
align=LEFT, wrap=SPACE, allow_tab=False,
- edit_pos=None, layout=None, mask=""):
+ edit_pos=None, layout=None, mask=None):
"""
caption -- markup for caption preceeding edit_text
edit_text -- text string for editing
@@ -725,7 +725,7 @@ class Edit(Text):
allow_tab -- True: 'tab' inserts 1-8 spaces False: return it
edit_pos -- initial position for cursor, None:at end
layout -- layout object
- mask -- character to mask away text with, empty means no masking
+ mask -- character to mask away text with, None means no masking
>>> Edit()
<Edit selectable flow widget '' edit_pos=0>
@@ -773,7 +773,7 @@ class Edit(Text):
('u...@host:~$ ls', [('bright', 13)])
"""
- if self._mask == "":
+ if self._mask is None:
return self._caption + self._edit_text, self._attrib
else:
return self._caption + (self._mask * len(self._edit_text)), self._attrib
--
1.7.1
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid