I was trying to enable BigText to have focus and wanted to use AttrMap to wrap
it. Here is a quick code:
---
import urwid
class MyBigText(urwid.BigText):
_selectable = True
palette = [
('bigtext', 'white', 'dark gray'),
('bigtext focus', 'light red', 'white'),
]
font = urwid.HalfBlock5x4Font()
btxt = MyBigText('My Big Text', font)
#if urwid.AttrMap.pack.__func__ is urwid.Widget.pack.__func__:
# urwid.AttrMap.pack = property(lambda self:self._original_widget.pack)
btxt_m = urwid.AttrMap(btxt, 'bigtext', 'bigtext focus')
btxt_p = urwid.Padding(btxt_m, width='clip')
#btxt_f = urwid.Filler(btxt_p, height=font.height)
btxt_f = urwid.Filler(btxt_p)
loop = urwid.MainLoop(btxt_f, palette=palette)
loop.run()
---
It results this error:
File "/usr/lib64/python2.6/site-packages/urwid/widget.py", line 241, in pack
raise NotImplementedError('Fixed widgets must override'
NotImplementedError: Fixed widgets must override Widget.size()
(And I believe this message is outdated, I think it meant "Widget.pack()"
instead of "size()")
If uncomment the Filler line and comment the second Filler, it will result:
File "/usr/lib64/python2.6/site-packages/urwid/decoration.py", line 547, in
padding_values
width, ignore = self._original_widget.pack(focus=focus)
TypeError: pack() takes at least 2 non-keyword arguments (1 given)
I am new to Urwid, still trying to learn how it works, but I believe that there
is a missing definition of pack() in AttrMap, which is done by the commented the
if clause above. If uncomment that part, the code runs as I expect. I think it's
just a simple missing for pack() since other methods seem to be called
correctly, <http://excess.org/urwid/browser/urwid/decoration.py#L207>. And if
this is the case, then WidgetWrap may have the same issue,
<http://excess.org/urwid/browser/urwid/widget.py#L1305>.
PS. I wanted to create a bug report but the website's login/register functions
looks gone (404 error). Also, I tried to search on Gmane, but the search
function didn't seem to work, I apologizes if this issue has been answered.
_______________________________________________
Urwid mailing list
[email protected]
http://lists.excess.org/mailman/listinfo/urwid