Skip to content

buffers: thread: Fix Urwid set_focus align - #1715

Open
kbingham wants to merge 1 commit into
pazz:masterfrom
kbingham:FixUrwidAlign
Open

kbingham wants to merge 1 commit into
pazz:masterfrom
kbingham:FixUrwidAlign

Conversation

@kbingham

@kbingham kbingham commented May 8, 2026

Copy link
Copy Markdown
Contributor

An update to urwid results in the valign parameter no longer being recognised or supported. Drop it.

An update to urwid results in the valign parameter no longer being
recognised or supported. Drop it.

Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
@kbingham

kbingham commented May 8, 2026

Copy link
Copy Markdown
Contributor Author

Without this, I get the following trace in the debug log:

DEBUG:thread:Tbuffer: auto remove unread tag from msg?
DEBUG:thread:Tbuffer: No, cursor on summary
DEBUG:_raw_display_base:Drawing screen with size (115, 56)
DEBUG:thread:MT expand
DEBUG:utils:unquoted header: |Laurent Pinchart <laurent.pinchart@ideasonboard.com>|
DEBUG:utils:unquoted header: |libcamera-devel@lists.libcamera.org|
DEBUG:utils:unquoted header: |[PATCH 0/3] ipa: libipa: Avoid code duplication in V4L2Params|
DEBUG:utils:Content-Transfer-Encoding: "8bit"
DEBUG:utils:command: less /tmp/tt621z5s
DEBUG:utils:parms: ()
DEBUG:helper:Calling ['less', '/tmp/tt621z5s']
DEBUG:thread:setting focus to ('20260507213721.2137448-1-laurent.pinchart@ideasonboard.com', (0,)) 
ERROR:ui:Traceback (most recent call last):
  File "/home/kbingham/iob/alot/alot/ui.py", line 722, in apply_command
    cmd.apply(self)
  File "/home/kbingham/iob/alot/alot/commands/search.py", line 55, in apply
    tb.unfold_matching(query)
  File "/home/kbingham/iob/alot/alot/buffers/thread.py", line 344, in unfold_matching
    self.set_focus(first)
  File "/home/kbingham/iob/alot/alot/buffers/thread.py", line 183, in set_focus
    self.body.set_focus(pos, valign='top')
TypeError: TreeBox.set_focus() got an unexpected keyword argument 'valign'

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes the valign='top' argument from self.body.set_focus(pos) in the thread buffer because newer Urwid versions no longer accept the valign keyword on set_focus.

Changes:

  • Drop unsupported valign='top' kwarg from ListBox.set_focus call in thread buffer.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lucc

lucc commented May 31, 2026

Copy link
Copy Markdown
Collaborator

I could not really reproduce this. But I am using nix and had to pick a nixpkgs PR in order to test this. Or could it be that my alot config/theme does not use this code path?

What exactly did you do when you get the exception? (which os, how did you install, how did you update, ...)

I did

cd ~/nixpkgs
hub pr checkout 506794 # the pr that updates urwid from 3.0.4 to 4.0 in nixpkgs
cd ~/alot
sed -i 's/version = .*/version = "dev";/' flake.nix # otherwise nix fails on my if I use --override-input
nix build --override-input nixpkgs ~/nixpkgs
result/bin/alot

I don't get an exception.

@kbingham

kbingham commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

I could not really reproduce this. But I am using nix and had to pick a nixpkgs PR in order to test this. Or could it be that my alot config/theme does not use this code path?

What exactly did you do when you get the exception? (which os, how did you install, how did you update, ...)

I did

cd ~/nixpkgs
hub pr checkout 506794 # the pr that updates urwid from 3.0.4 to 4.0 in nixpkgs
cd ~/alot
sed -i 's/version = .*/version = "dev";/' flake.nix # otherwise nix fails on my if I use --override-input
nix build --override-input nixpkgs ~/nixpkgs
result/bin/alot

I don't get an exception.

I have the following:

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 24.04.4 LTS
Release:	24.04
Codename:	noble

$ apt list --installed python3-urwid
Listing... Done
python3-urwid/noble,now 2.6.10-1 amd64 [installed]

@kbingham

kbingham commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

hrm - maybe it's not an update, but that I'm on a version of urwid that simply doesn't have that parameter ?

@lucc

lucc commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

I checked again and I don't get the exception with either the alot version from the nix flake and also not with an updated version on my home machine. They use urwid 2.6.16 and urwid 3.0.5 respectively.

Can you update the library on your system or check the git log or changelog of urwid between 2.6.10 and 2.6.16.

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

Successfully merging this pull request may close these issues.

3 participants