nucleic / enaml

Declarative User Interfaces for Python
http://enaml.readthedocs.io/en/latest/
Other
1.53k stars 130 forks source link

[DOC] What's the way to get a dynamic "spreadsheet" like view #526

Open Kochise opened 1 year ago

Kochise commented 1 year ago

I'd like to have a kinda row/column view and populate each cell with graphical and interactive elements, not just text.

Ideally it would have a top search field for each column, pretty much like in https://github.com/frmdstryr/smd-search

Have you an idea to start with ? Maybe something in https://github.com/nucleic/enaml/tree/main/examples/dynamic

Regards.

MatthieuDartiailh commented 1 year ago

Do you simply need a grid generated on the fly or do you also want the column width/row height adjustment one would expect from a spreadsheet ?

Kochise commented 1 year ago

Hi, grid generated "on the fly" with row's height depending on cells' content.

No need for manual adjustment.

Typical "mock-up" would be a "3 columns" approach :

| Scene      (add) [search] | ZigBee     (add) [search] | Bluetooth  (add) [search] |
| ------------------------- | ------------------------- | ------------------------- |
| Precommissioned           | Toto                      | Titi                      |
| ------------------------- | ------------------------- | ------------------------- |
| Machine 1 (scan)          | (2/100, bandwidth %)      | (0/16)                    |
|                           | [Tata] (rssi)             |                           |
|                           |  +- Attribute             |                           |
|                           |  '- Method                |                           |
|                           | 0xE2200000 (drag'n drop)  |                           |
| ------------------------- | ------------------------- | ------------------------- |
| Machine 2 (scan)          |                           |                           |
| ------------------------- | ------------------------- | ------------------------- |

First row ("Precommissioned") is fixed, but following rows ("Machine X") are dynamic, upon clicking on "Scene (add)" button.

Then the columns' content might differ regarding the paired devices.

Content may include current status, picture of the device, tree-view of the Attributes/Methods, etc.

Hence keeping track of the UI content with the associated data have to be performed as well.

Regards.

MatthieuDartiailh commented 1 year ago

I do not have the time to spin a full example but overriding layout_constaints like it is done in examples/layout/advanced/override_layout_constraints.enaml should get you what you are looking for.

Kochise commented 1 year ago

Ok, will try that, thank for the hint.