def make_desktop(self, layout, widgetDict=None):
        if widgetDict is None:
            widgetDict = {}

        def process_common_params(widget, inparams):
            params = Bunch.Bunch(name=None, height=-1, width=-1,
                                 xpos=-1, ypos=-1, spacing=None,
                                 wexp=None, hexp=None)
            params.update(inparams)

            if params.name:
                widgetDict[params.name] = widget

            wexp, hexp = params.wexp, params.hexp

            # User is specifying the size of the widget
            if isinstance(widget, Widgets.WidgetBase):

                if params.spacing is not None:
                    widget.set_spacing(params.spacing)

                # directive to size widget
                if (params.width >= 0) or (params.height >= 0):
                    if params.width < 0:
                        width = widget.get_size()[0]
                        if wexp is None:
                            wexp = 8
                    else:
                        width = params.width
                        if wexp is None:
                            wexp = 1|4
                    if params.height < 0:
                        height = widget.get_size()[1]
                        if hexp is None:
                            hexp = 8
                    else:
                        height = params.height
                        if hexp is None:
                            hexp = 1|4
                    widget.resize(width, height)

                # specify expansion policy of widget
                if (wexp is not None) or (hexp is not None):
                    if wexp is None:
                        wexp = 0
                    if hexp is None:
                        hexp = 0
                    widget.cfg_expand(wexp, hexp)

                # User wants to place window somewhere
                if params.xpos >= 0:
                    widget.move(params.xpos, params.ypos)

        def make_widget(kind, paramdict, args, pack):
            kind = kind.lower()

            # Process workspace parameters
            params = Bunch.Bunch(name=None, title=None, height=-1,
                                 width=-1, group=1, show_tabs=True,
                                 show_border=False, scrollable=True,
                                 detachable=False, wstype='tabs',
                                 tabpos='top')
            params.update(paramdict)

            if kind == 'widget':
                widget = args[0]

            elif kind == 'ws':
                group = int(params.group)
                ws = self.make_ws(params.name, group=group,
                                      show_tabs=params.show_tabs,
                                      show_border=params.show_border,
                                      detachable=params.detachable,
                                      tabpos=params.tabpos,
                                      wstype=params.wstype,
                                      scrollable=params.scrollable)
                widget = ws.widget
                #debug(widget)

            # If a title was passed as a parameter, then make a frame to
            # wrap the widget using the title.
            if params.title:
                fr = Widgets.Frame(title=params.title)
                fr.set_widget(widget)
                pack(fr)
            else:
                pack(widget)

            #process_common_params(widget, params)

            if (kind in ('ws', 'mdi', 'grid', 'stack')) and (len(args) > 0):
                # <-- Workspace specified a sub-layout.  We expect a list
                # of tabname, layout pairs--iterate over these and add them
                # to the workspace as tabs.
                for tabname, layout in args[0]:
                    def pack(w):
                        # ?why should group be the same as parent group?
                        self.add_tab(params.name, w, group,
                                     tabname, tabname.lower())

                    make(layout, pack)

            process_common_params(widget, params)

            #return widget

        # Horizontal adjustable panel
        def hpanel(params, cols, pack):
            if len(cols) >= 2:
                widget = Widgets.Splitter(orientation='horizontal')
                process_common_params(widget, params)

                sizes = []
                for col in cols:
                    make(col, lambda w: widget.add_widget(w))

                    # collect widths to set width of panes
                    params = col[1]
                    if 'width' in params:
                        sizes.append(params['width'])

                if len(sizes) == len(cols):
                    widget.set_sizes(sizes)

            elif len(cols) == 1:
                widget = Widgets.HBox()
                widget.set_border_width(0)
                process_common_params(widget, params)

                make(cols[0], lambda w: widget.add_widget(w, stretch=1))
                #widget.show()

            pack(widget)

        # Vertical adjustable panel
        def vpanel(params, rows, pack):
            if len(rows) >= 2:
                widget = Widgets.Splitter(orientation='vertical')
                process_common_params(widget, params)

                sizes = []
                for row in rows:
                    make(row, lambda w: widget.add_widget(w))

                    # collect heights to set height of panes
                    params = row[1]
                    if 'height' in params:
                        sizes.append(params['height'])

                if len(sizes) == len(rows):
                    widget.set_sizes(sizes)

            elif len(rows) == 1:
                widget = Widgets.VBox()
                widget.set_border_width(0)
                process_common_params(widget, params)

                make(rows[0], lambda w: widget.add_widget(w, stretch=1))
                #widget.show()

            pack(widget)

        # Horizontal fixed array
        def hbox(params, cols, pack):
            widget = Widgets.HBox()
            widget.set_border_width(0)
            widget.set_spacing(0)

            for dct in cols:
                if isinstance(dct, dict):
                    stretch = dct.get('stretch', 0)
                    col = dct.get('col', None)
                else:
                    # assume a list defining the col
                    stretch = 0
                    col = dct
                if col is not None:
                    make(col, lambda w: widget.add_widget(w,
                                                          stretch=stretch))
            process_common_params(widget, params)
            pack(widget)

        # Vertical fixed array
        def vbox(params, rows, pack):
            widget = Widgets.VBox()
            widget.set_border_width(0)
            widget.set_spacing(0)

            for dct in rows:
                if isinstance(dct, dict):
                    stretch = dct.get('stretch', 0)
                    row = dct.get('row', None)
                else:
                    # assume a list defining the row
                    stretch = 0
                    row = dct
                if row is not None:
                    make(row, lambda w: widget.add_widget(w,
                                                          stretch=stretch))
            process_common_params(widget, params)
            pack(widget)

        # Sequence of separate top-level items
        def seq(params, cols, pack):
            def mypack(w):
                w_top = self.app.make_window()
                #w_top.cfg_expand(8, 8)
                # Ask the size of the widget that wants to get packed
                # and resize the top-level to fit
                wd, ht = w.get_size()
                w_top.resize(wd, ht)
                w_top.set_widget(w)
                self.toplevels.append(w_top)
                w_top.show()

            for dct in cols:
                if isinstance(dct, dict):
                    stretch = dct.get('stretch', 0)
                    col = dct.get('col', None)
                else:
                    # assume a list defining the col
                    stretch = 0
                    col = dct
                if col is not None:
                    make(col, mypack)

            widget = Widgets.Label("Placeholder")
            pack(widget)

        def make(constituents, pack):
            kind = constituents[0]
            params = constituents[1]
            if len(constituents) > 2:
                rest = constituents[2:]
            else:
                rest = []

            if kind == 'vpanel':
                vpanel(params, rest, pack)
            elif kind == 'hpanel':
                hpanel(params, rest, pack)
            elif kind == 'vbox':
                vbox(params, rest, pack)
            elif kind == 'hbox':
                hbox(params, rest, pack)
            elif kind == 'seq':
                seq(params, rest, pack)
            elif kind in ('ws', 'mdi', 'widget'):
                make_widget(kind, params, rest, pack)

        make(layout, lambda w: None)


    ##### WORKSPACES #####
dataset/ETHPy150Open ejeschke/ginga/ginga/gw/Desktop.py/Desktop.make_desktop/original