I was just implementing password protected folders with the new skin/GUI code and found what could simply be my misunderstanding the functionality of the InputBox or perhaps design/usability issues.
What I have done to src/mediamenu.py is the following:
Index: src/mediamenu.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/mediamenu.py,v
retrieving revision 1.41
diff -u -r1.41 mediamenu.py
--- src/mediamenu.py 15 Mar 2003 17:19:44 -0000 1.41
+++ src/mediamenu.py 29 Mar 2003 23:35:50 -0000
@@ -150,6 +150,14 @@
import image.interface
import games.interface
+from osd import SynchronizedObject
+import osd
+osd = osd.get_singleton()
+from item import Item
+
+import gui.InputBox as InputBox
+import gui.AlertBox as AlertBox
+
# XML support
from xml.utils import qp_xml
@@ -429,6 +441,11 @@
return items
+ def test_func(self, word=None):
+ if word:
+ # test "word" to what's in self.dir+'/.password' and somehow
+ # signal whether the input matched the file contents
+
def cwd(self, arg=None, menuw=None):
"""
make a menu item for each file in the directory
@@ -439,6 +456,15 @@
if string.find(self.dir, media.mountdir) == 0:
util.mount(self.dir)
self.media = media
+
+ if os.path.isfile(self.dir+'/.password'):
+ print 'password protected dir'
+ pb = InputBox('Password Protected Folder', self.test_func)
+ osd.focused_app.add_child(pb)
+ osd.focused_app = pb
+ pb.show()
+ # how do I get signalled from test_func as to whether the
+ # user got it correct or not, without using yucky global vars?
try:
files = ([ os.path.join(self.dir, fname)
So I have the InputBox popping up, but as you can see by the comments
in both the added sections, how do I pass values back and forth
between InputBox()'s caller and InputBox()'s callback? I think in
most situations, InputBox()'s caller wants to know the value that was
entered.
The second issue I have with InputBox is that there is no way to allow
the input of a password without everybody sitting there watching
seeing it as well. Instead of displaying the character inputted, an
ansterisk (or something generic) should be displayed.
Third issue: the use of repeating the numeric keys to input alphas
like a telephone dial pad is neat, but inputting numbers is not so
intuitive. IMHO, the phoneChars matrix should look like this:
{
1 : ["1"],
2 : ["2", "A", "B", "C"],
3 : ["3", "D", "E", "F"],
4 : ["4", "G", "H", "I"],
5 : ["5", "J", "K", "L"],
6 : ["6", "M", "N", "O"],
7 : ["7", "P", "Q", "R", "S"],
8 : ["8", "T", "U", "V"],
9 : ["9", "W", "X", "Y", "Z"],
0 : ["0", "-", " "],
}
So that the first press of a numeric key produces that digit and
subsequent presses start to cycle through the alphas back to the
digit.
It may be that a new subclass of InputBox should be created, say
PasswordInput(), which displays asterisks, and as well, only allows
the input of numerics, because if you are displaying asterisks, it's
not really practical to have multiple presses of a key mean something
different.
I would also propose since there is only one value for a key, that the
cursor be moved along to the next digit automatically on the entering
of a value rather than with the LEFT/RIGHT events. Those events
should still move the cursor back and forth, but it should move from
one input digit to the next automatically.
Any thots on any/all of this?
b.
--
Brian J. Murrell
pgp00000.pgp
Description: PGP signature
