def _prepare_toplevel_for_item(self, layout):
        if isinstance(layout, PaneItem):
            dock_widget = self._get_dock_widget(layout)
            if dock_widget is None:
                logger.warning('Cannot retrieve dock widget for pane %r'
                               % layout.id)
            else:
                if layout.width > 0:
                    dock_widget.widget().setFixedWidth(layout.width)
                if layout.height > 0:
                    dock_widget.widget().setFixedHeight(layout.height)
            return dock_widget

        elif isinstance(layout, LayoutContainer):
            return self._prepare_toplevel_for_item(layout.items[0])

        else:
            raise MainWindowLayoutError("Leaves of layout must be PaneItems")
Returns a sized toplevel QDockWidget for a LayoutItem.
dataset/ETHPy150Open enthought/pyface/pyface/ui/qt4/tasks/main_window_layout.py/MainWindowLayout._prepare_toplevel_for_item