enthought / enthought/traitsui

Groups do not participate in Grid layouts

Open
#474 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

If there is a `VGrid` or `HGrid` which includes one or more `Groups` then the groups are laid out vertically rather than in a grid:
```
from traits.api import HasTraits, Str
from traitsui.api import View, VGrid, HFlow, HGroup, VGroup, Item

class Test(HasTraits):
s = Str()

traits_view = View(
VGrid(
VGroup(
Item('s', label='one'),
Item('s', label='two'),
),
VGroup(
Item('s', label='one'),
Item('s', label='two'),
label='foo',
),
VGroup(
Item('s', label='one'),
Item('s', label='two'),
Item('s', label='three'),
),
VGroup(
Item('s', label='four'),
Item('s', label='five'),
),
columns=3,
),
resizable=True,
)

t = Test()
t.configure_traits()
```
This displays as:
screen shot 2018-08-01 at 9 59 49 am

For comparison, Groups do participate in `HGroup` and `VGroup` layout.

Also note that because of the way that `ShadowGroups` are created, mixing `Group` and `Item` elements in a `Grid` produces even more unexpected results:
```
View(
VGrid(
VGroup(
Item('s', label='one'),
Item('s', label='two'),
),
VGroup(
Item('s', label='one'),
Item('s', label='two'),
label='foo',
#show_border=True
),
VGroup(
Item('s', label='one'),
Item('s', label='two'),
Item('s', label='three'),
),
VGroup(
Item('s', label='four'),
Item('s', label='five'),
),
#label='bar',
#show_border=True,
columns=3,
),
resizable=True,
)
```
gives
screen shot 2018-08-01 at 10 03 45 am

That is, the runs of items are accumulated into `ShadowGroups` which are seem to inherit the `grid` layout.

Plus as a secondary issue, the code for creating the groups (in the various `ui_panel.py` modules) is fairly horrible.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the supplied VGrid and HGrid examples, including the mixed Group and Item case. Inspect the group-creation code in the various ui_panel.py modules and how ShadowGroups receive their layout. Done means Groups participate in Grid layouts correctly and mixed Group/Item grids no longer produce the unexpected arrangement described.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
desktop, frontend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.