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

AttributeError: 'NoneType' object has no attribute 'grab_focus' #1137

Open
SqAtx opened this issue Sep 11, 2024 · 2 comments
Open

AttributeError: 'NoneType' object has no attribute 'grab_focus' #1137

SqAtx opened this issue Sep 11, 2024 · 2 comments
Labels
bug reproducible-in-git Issues that affect the current dev version

Comments

@SqAtx
Copy link
Contributor

SqAtx commented Sep 11, 2024

Repro:

  • Open GTG
  • Press Ctrl-B

Context: Global generic exception

Traceback (most recent call last):
  File "/home/kevin/src/gtg/.local_build/install/lib/python3/dist-packages/GTG/gtk/browser/main_window.py", line 833, in focus_sidebar
    self.tagtreeview.grab_focus()
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'grab_focus'

GTG: 0.7-dev-bd58425d
Flatpak: False
Snap: False
Display Name: wayland-0
Desktop: ubuntu:GNOME

lxml: True
caldav: True
liblarch: False
Cheetah3: False
dbus-python: False
pdflatex: False
pypdftk: False

OS: Ubuntu 24.04 LTS
Python: CPython 3.12.3
GLib: 2.80.0
PyGLib: 3.48.2
PyGObject: 3.48.2
GTK: 4.2.14

@SqAtx SqAtx added the bug label Sep 11, 2024
@SqAtx SqAtx added the reproducible-in-git Issues that affect the current dev version label Sep 14, 2024
@SqAtx
Copy link
Contributor Author

SqAtx commented Sep 14, 2024

It looks like e96a8f8 handled a similar case, with the justification that "tagtreeview is None if it's hidden". But the left side bar isn't hidden when I do CTRL-B.

Given

~/src/gtg$ ag focus_sidebar
GTG/gtk/browser/main_window.py
208:            ('focus_sidebar', self.focus_sidebar, ('win.focus_sidebar', ['<ctrl>B'])),
830:    def focus_sidebar(self, action, param):

I'm wondering if this shortcut and associated action shouldn't just have been removed but have been forgotten?

I haven't been able to see where self.tagtreeview is supposed to be set, and I'm starting to wonder if I'm not actually staring at a pile of dead code :) I don't have time to investigate right now but it looks a lot like the code related to the tag pane now lives at https://github.com/getting-things-gnome/gtg/blob/master/GTG/gtk/browser/sidebar.py? Like

def get_selected_tags(self, nospecial=False):
has been replaced with
def selected_tags(self, names_only: bool = False) -> list:
, for example?

@SqAtx
Copy link
Contributor Author

SqAtx commented Sep 15, 2024

I'm wondering if this shortcut and associated action shouldn't just have been removed but have been forgotten?

I tried Ctrl-B in 0.6 and it does focus the tag side panel. Probably to allow navigation by keyboard. So my statement was incorrect, and this is indeed a regression - it's just that self.tagtreeview.grab_focus() is no longer the way to focus the panel.

There is probably still a lot of cleanup to do around tagtreeview, but that can be done separately. We'll also need to verify all the other shortcuts in 0.7 - Ctrl-B might not be the only one that got broken.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug reproducible-in-git Issues that affect the current dev version
Projects
None yet
Development

No branches or pull requests

1 participant