enthought/traitsui — pull request #185 by mdickinson (2014-11-20 13:45:49+00:00)
Title: Set the 'shadow' trait first on a ShadowGroup to avoid DelegationErrors.

Running some tests from another TraitsUI-using project with `PYTHONHASHSEED=random`, we saw a number of tracebacks resembling that below.

This PR works around those tracebacks by always setting the `shadow` trait of a `ShadowGroup` before any other traits.

```
Traceback (most recent call last):
File "geophysics/addon/ui/adapter/tests/three_d_element/properties_view/properties_view_tests.py", line 73, in test_visible
ui = adapter.edit_traits()
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traits/traits/has_traits.py", line 1859, in edit_traits
handler, id, scrollable, args )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/view.py", line 433, in ui
ui.ui( parent, kind )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/ui.py", line 221, in ui
self.rebuild( self, parent )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/toolkit.py", line 154, in ui_live
ui_live.ui_live( ui, parent )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_live.py", line 39, in ui_live
_ui_dialog(ui, parent, BaseDialog.NONMODAL)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_live.py", line 59, in _ui_dialog
BaseDialog.display_ui(ui, parent, style)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_base.py", line 445, in display_ui
ui.owner.init(ui, parent, style)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_live.py", line 177, in init
self.add_contents(panel(ui), bbox)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 231, in panel
panel = _GroupPanel(content[0], ui).control
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 570, in __init__
layout = self._add_groups(content, inner)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 649, in _add_groups
panel = _GroupPanel(subgroup, self.ui).control
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 572, in __init__
layout = self._add_items(content, inner)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 840, in _add_items
editor.prepare(inner)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/editor.py", line 158, in prepare
self.update_editor()
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/instance_editor.py", line 319, in update_editor
self.resynch_editor()
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/instance_editor.py", line 380, in resynch_editor
self.factory.id )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/view.py", line 433, in ui
ui.ui( parent, kind )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/ui.py", line 221, in ui
self.rebuild( self, parent )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/toolkit.py", line 140, in ui_subpanel
ui_panel.ui_subpanel( ui, parent )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 79, in ui_subpanel
_ui_panel_for(ui, parent, True)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 85, in _ui_panel_for
ui.control = control = _Panel(ui, parent, is_subpanel).control
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 143, in __init__
self.control = panel(ui)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 231, in panel
panel = _GroupPanel(content[0], ui).control
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 570, in __init__
layout = self._add_groups(content, inner)
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 649, in _add_groups
panel = _GroupPanel(subgroup, self.ui).control
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/qt4/ui_panel.py", line 458, in __init__
content = group.get_content()
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/group.py", line 740, in get_content
self._flush_items( content, items )
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/group.py", line 783, in _flush_items
content = items ).set(
File "/Users/mdickinson/Enthought/Source/meta-geophysics/meta-ETS/traitsui/traitsui/group.py", line 210, in __init__
super( ViewSubElement, self ).__init__( **traits )
DelegationError: The 'show_border' attribute of a 'ShadowGroup' object has a delegate which does not have traits.
```