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

TabularEditor triggering column size recompute #1434

Open
JackDra opened this issue Dec 9, 2020 · 2 comments · May be fixed by #1709
Open

TabularEditor triggering column size recompute #1434

JackDra opened this issue Dec 9, 2020 · 2 comments · May be fixed by #1709

Comments

@JackDra
Copy link
Contributor

JackDra commented Dec 9, 2020

Would like to link a trait listener to the TabularEditor that triggers a recompute of the column widths. I tried refresh and update, and both seemed not to recompute the column widths.

Specifically, I want to call _TableView resizeColumnsToContents within traitsui/qt4/tabular_editor.py whenever update_editor of TabularEditor (traitsui/qt4/tabular_editor.py) is triggered using the update trait listener on traitsui’s TabularEditor .

Or there could be a new listener update_column_widths in the traitsui TabularEditor that triggers resizeColumnsToContents?

@kitchoi
Copy link
Contributor

kitchoi commented Dec 9, 2020

From offline discussion, the use case can be illustrated with the NumPy_array_tabular_editor_demo.py in the examples.

Say the format for a number is changed such that the displayed text is shorter, one may want to be able to resize the columns so that more columns can be fit in the view.

From me: This may have to be an option that one can opt-in, though, as in some context, it may be desirable to keep the column sizes static.

@corranwebster
Copy link
Contributor

One thing to keep in mind is that users can manually re-size columns, and this is tracked. We will need to decide whether the right behaviour is to override or preserve these (or maybe there needs to be an option to do both)?

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

Successfully merging a pull request may close this issue.

4 participants