Package: python-newt
Version: 0.51.6-31
Severity: normal
Tags: patch

Hi,

Function EntryWindow does not work with preset values:

screen = SnackScreen()
foo = EntryWindow(screen, 'Grml2hd options dialog', 'Please give me the 
configuriation for grml2hd',
        [('Target Partition: ','/dev/hda1'),
        ('Filesystem type: ', 'ext3'),
        ('Location of mbr: ', '/dev/hda'),
        ('System user: ', 'grml')])
screen.finish()

Traceback (most recent call last):                                              
                     
  File "./grml2hd.py", line 10, in ?
    [('Target Partition: ','/dev/hda1'),
  File "/usr/lib/python2.3/site-packages/snack.py", line 796, in EntryWindow
    sg.setField(e, 1, count, anchorLeft = 1)
  File "/usr/lib/python2.3/site-packages/snack.py", line 388, in setField
    if (what.__dict__.has_key('g')):
AttributeError: 'str' object has no attribute '__dict__'

The problem is, that if prompt is of type Tuple, no Entry will be
created and the plain string is used in setField call.

Patch (also as attachment):

--- /usr/lib/python2.3/site-packages/snack.py»··2005-09-09 08:03:55.000000000 
+0200
+++ snack.py»···2005-11-23 01:30:25.205584500 +0100
@@ -789,6 +789,7 @@ def EntryWindow(screen, title, text, pro
     for n in prompts:
         if (type(n) == types.TupleType):
             (n, e) = n
+            e = Entry(entryWidth, e)
         else:
             e = Entry(entryWidth)

greetings,
Michael Gebetsroither

-- System Information:
Debian Release: testing/unstable
Architecture: i386 (i686)
Shell:  /bin/sh linked to /bin/bash
Kernel: Linux 2.6.12
Locale: LANG=en_US.ISO-8859-15, LC_CTYPE=en_US.ISO-8859-15 (charmap=ISO-8859-15)
-- 
/*The only secure computer is one that's unplugged, locked in a
safe, and buried 20 feet under the ground in a secret location...
and i'm not even too sure about that one.*/
--- /usr/lib/python2.3/site-packages/snack.py   2005-09-09 08:03:55.000000000 
+0200
+++ snack.py    2005-11-23 01:30:25.205584500 +0100
@@ -789,6 +789,7 @@ def EntryWindow(screen, title, text, pro
     for n in prompts:
         if (type(n) == types.TupleType):
             (n, e) = n
+            e = Entry(entryWidth, e)
         else:
             e = Entry(entryWidth)
 

Reply via email to