Open chigozienri opened 4 years ago
@nicolasap-dm points to these locations as being the potential sources of error -
https://github.com/enthought/traitsui/blob/94da89c3199d033f231990dd3c783253a6260dd6/traitsui/qt4/ui_panel.py#L631-L635 https://github.com/enthought/traitsui/blob/ca847133947e5ad41f6bb55942c5c9ed64d80bbe/traitsui/item.py#L91-L93
(I haven't followed the whole logic there, so they may be completely misguided. On the surface, however, the snippets look relevant.)
Looking into this a bit it seems as though the separator is there, it just gets covered by a subsequent group(?).
The last separator which is followed by a Label is shown even though it comes after a group. Also if you remove one of the separators between groups you can see that the 2 groups are shown closer together. i.e. the Item("-")
is there separating the groups, but the corresponding sunken line is not visible
Note, as a workaround I believe moving the separator inside the group "fixes" this: ie replacing
Group(Label('Caverns')),
Item('_'),
with
Group(
Label('Caverns'),
Item('_'),
),
yields
I believe the error here is really whenever a separator is the only Item in a Group (even an implicit group).
In practice this would occur is you have Item('_')
directly between two groups, or did something like Group(Item('_'))
. In this scenario we end up setting up a QGridLayout with just the QtGui.QFrame.HLine
in it. See:
https://github.com/enthought/traitsui/blob/20f73e83b1424dd86b28de4537c2fe35beca331c/traitsui/qt4/ui_panel.py#L1008-L1043
With nothing else in the layout I believe what is happening is the HLine effectively has no length. It is still there though, and we can see this because if we remove a separator between groups the 2 groups are shown much closer together:
So the separators are there but the line isn't visible.
Unfortunately I am not seeing an easy / clean way to fix this... I think the best solution is to just pull the separator up into the end of the first group rather than between 2 groups.
If this workaround solves the problem, I think it is safe to close this issue
Item('_')
does not produce a visible separator when immediately underneath aGroup
To replicate: