From fa307323c56fe93a39ea0007b26c4eba5eb68d0d Mon Sep 17 00:00:00 2001 From: webbrain-one <295484252+webbrain-one@users.noreply.github.com> Date: Wed, 29 Jul 2026 21:25:48 +0300 Subject: [PATCH] Fix error when tabbing to attachment list Fixes #130. Prevents wxAssertionError caused by an invalid item index when focusing on items in the attachment list. --- addon/globalPlugins/AIHub/attachment_ui.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/addon/globalPlugins/AIHub/attachment_ui.py b/addon/globalPlugins/AIHub/attachment_ui.py index e67be48..35dce06 100644 --- a/addon/globalPlugins/AIHub/attachment_ui.py +++ b/addon/globalPlugins/AIHub/attachment_ui.py @@ -54,7 +54,8 @@ def _attachment_list_end_refresh(self, list_ctrl, *, focus_prompt_if_empty=True) if focus_prompt_if_empty: self.promptTextCtrl.SetFocus() return - list_ctrl.SetItemState(0, wx.LIST_STATE_FOCUSED, wx.LIST_STATE_FOCUSED) + list_ctrl.SetFocus() + list_ctrl.Select(0) def _list_ctrl_selected_indices(self, list_ctrl): out = []