def coerce_layout(thing): """ Coerce a variety of objects into a docklayout. Parameters ---------- thing : dict, basetring, dockitem, dockarea, split, or tabs Something that can be coerced into a dock layout. """ if isinstance(thing, basestring): thing = dockitem(thing) if isinstance(thing, (dockitem, docksplit, docktabs)): return docklayout(dockarea(thing)) if isinstance(thing, dockarea): return docklayout(thing) msg = "cannot coerce '%s' to a docklayout" raise TypeError(msg % type(thing).__name__)
def coerce_layout(thing): """ Coerce a variety of objects into a docklayout. Parameters ---------- thing : dict, basetring, dockitem, dockarea, split, or tabs Something that can be coerced into a dock layout. """ if thing is None: return docklayout(None) if isinstance(thing, basestring): thing = dockitem(thing) if isinstance(thing, (dockitem, docksplit, docktabs)): return docklayout(dockarea(thing)) if isinstance(thing, dockarea): return docklayout(thing) msg = "cannot coerce '%s' to a 'docklayout'" raise TypeError(msg % type(thing).__name__)
def _save_container(widget): """ The save handler for a QDockContainer layout widget. """ return dockitem(widget.objectName())