Skip to content

TabularEditor triggering column size recompute #1434

Open

Description

@JackDra

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?

Activity

  1. kitchoi commented on Dec 9, 2020

    @kitchoi
    Contributor

    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.

  2. corranwebster commented on Dec 10, 2020

    @corranwebster
    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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions