1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 """Defines a field that is used to enter secret text information like
17 passwords."""
18
19 from muntjac.ui.abstract_text_field import AbstractTextField
20 from muntjac.data.property import IProperty
21
22
24 """A field that is used to enter secret text information like passwords.
25 The entered text is not displayed on the screen.
26 """
27
28 CLIENT_WIDGET = None
29
31 """Constructs a PasswordField with caption and/or value/data source.
32
33 @param args: tuple of the form
34 - ()
35 - (caption)
36 1. the caption for the field
37 - (dataSource)
38 1. the property data source for the field
39 - (caption, dataSource)
40 1. the caption for the field
41 2. the property data source for the field
42 - (caption, value)
43 1. the caption for the field
44 2. the value for the field
45 """
46 super(PasswordField, self).__init__()
47
48 nargs = len(args)
49 if nargs == 0:
50 self.setValue('')
51 elif nargs == 1:
52 if isinstance(args[0], IProperty):
53 dataSource, = args
54 self.setPropertyDataSource(dataSource)
55 else:
56 caption, = args
57 PasswordField.__init__(self)
58 self.setCaption(caption)
59 elif nargs == 2:
60 if isinstance(args[1], IProperty):
61 caption, dataSource = args
62 PasswordField.__init__(self, dataSource)
63 self.setCaption(caption)
64 else:
65 caption, value = args
66 self.setValue(value)
67 self.setCaption(caption)
68 else:
69 raise ValueError, 'too many arguments'
70