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

Generate extra TableEditor menus dynamically #1966

Merged
merged 5 commits into from
Jan 12, 2023

Conversation

corranwebster
Copy link
Contributor

@corranwebster corranwebster commented Nov 23, 2022

This removes the empty_menu, header_menu and related traits. As a result there is a small chance of backwards incompatibility, however:

The fixes #1947

Checklist

  • Add a news fragment if this PR is news-worthy for end users. (see docs/releases/README.rst)

This removes the empty_menu, header_menu and related traits.  As a result there
is a small chance of backwards incompatibility, however:

- there are no uses of these traits found in a quick search of the Enthought
  codebase
- any code using these traits is likely buggy, as discovered in #1947

The fixes #1947
empty_menu = editor._create_empty_menu()
if empty_menu is not None:
event.accept()
empty_menu.exec_(position)
else:
editor.header_row = row
Copy link
Member

Choose a reason for hiding this comment

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

Is there other code which is dependent on this mutation of header_row? Otherwise I would think it's better to pass row to _create_header_menu.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, unfortunately. It's used by most of the handler methods for the default menu Actions (_on_context_insert, _on_context_remove, etc.)

traitsui/qt4/table_editor.py Outdated Show resolved Hide resolved
@corranwebster corranwebster merged commit 2255730 into main Jan 12, 2023
@corranwebster corranwebster deleted the fix/table-editor-extra-menus branch January 12, 2023 11:24
corranwebster added a commit that referenced this pull request Jan 12, 2023
This removes the `empty_menu`, `header_menu` and related traits. As a
result there is a small chance of backwards incompatibility, however:

- there are no uses of these traits found in a quick search of the
Enthought codebase
- any code using these traits is likely buggy, as discovered in #1947

The fixes #1947
corranwebster added a commit that referenced this pull request Jan 12, 2023
This removes the `empty_menu`, `header_menu` and related traits. As a
result there is a small chance of backwards incompatibility, however:

- there are no uses of these traits found in a quick search of the
Enthought codebase
- any code using these traits is likely buggy, as discovered in #1947

The fixes #1947
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.

Table Editor Right Click Exception
2 participants