Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

option --reverse causes AttributeError with urwid 2.1.0 #99

Closed
pavoljuhas opened this issue Sep 16, 2020 · 1 comment
Closed

option --reverse causes AttributeError with urwid 2.1.0 #99

pavoljuhas opened this issue Sep 16, 2020 · 1 comment

Comments

@pavoljuhas
Copy link

I am getting AttributeError when trying to use the --reverse option.
This happens with urwid 2.1.0 installed from system package.

$ bin/urlscan --reverse /dev/null
Traceback (most recent call last):
  File "bin/urlscan", line 216, in <module>
    main()
  File "bin/urlscan", line 195, in main
    tui = urlchoose.URLChooser(urlscan.msgurls(msg),
  File ".../urlscan/urlchoose.py", line 226, in __init__
    self._reverse()
  File ".../urlscan/urlchoose.py", line 465, in _reverse
    fpo = self.top.body.focus_position
AttributeError: 'Padding' object has no attribute 'body'

The patch below seems to fix this, please consider applying.

fix-reverse-body-attr.patch

diff --git a/urlscan/urlchoose.py b/urlscan/urlchoose.py
index 9e9c1e5..6b2ec7a 100644
--- a/urlscan/urlchoose.py
+++ b/urlscan/urlchoose.py
@@ -462,7 +462,7 @@ class URLChooser:
     def _reverse(self):
         """ R """
         # Reverse items
-        fpo = self.top.body.focus_position
+        fpo = self.top.base_widget.body.focus_position
         if self.compact is True:
             self.items.reverse()
         else:
@@ -475,8 +475,8 @@ class URLChooser:
                 else:
                     rev.insert(2, item)
             self.items = rev
-        self.top.body = urwid.ListBox(self.items)
-        self.top.body.focus_position = self._cur_focus(fpo)
+        self.top.base_widget.body = urwid.ListBox(self.items)
+        self.top.base_widget.body.focus_position = self._cur_focus(fpo)
 
     def _context(self):
         """ c """
@firecat53
Copy link
Owner

Good catch and thanks so much for the patch!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants