handle layout command
332
def cmd_layout(self, args):
        ''''''
        from MAVProxy.modules.lib import win_layout
        if len(args) < 1:
            print("usage: layout <save|load>")
            return
        if args[0] == "load":
            win_layout.load_layout(self.mpstate.settings.vehicle_name)
        elif args[0] == "save":
            win_layout.save_layout(self.mpstate.settings.vehicle_name)
177017
def feature_handler(self, cmd):
        """"""
        feature = cmd.feature_name
        if feature not in commands.FEATURE_NAMES:
            self.warning("feature %s is not supported - parsing may fail"
                % (feature,))
1305909
public void layout(float layoutX, float layoutY, float layoutWidth, float layoutHeight) {
        if (sizeInvalid)
            computeSize();

        float hpadding = w(padLeft) + w(padRight);
        float vpadding = h(padTop) + h(padBottom);

        float totalExpandWidth = 0, totalExpandHeight = 0;
        for (int i = 0; i < columns; i++)
            totalExpandWidth += expandWidth[i];
        for (int i = 0; i < rows; i++)
            totalExpandHeight += expandHeight[i];

        // Size columns and rows between min and pref size using (preferred -
        // min) size to weight distribution of extra space.
        float[] localColumnWeightedWidth;
        float totalGrowWidth = tablePrefWidth - tableMinWidth;
        if (totalGrowWidth == 0)
            localColumnWeightedWidth = columnMinWidth;
        else {
            float extraWidth = Math.min(totalGrowWidth, Math.max(0, layoutWidth - tableMinWidth));
            localColumnWeightedWidth = this.columnWeightedWidth = ensureSize(this.columnWeightedWidth, columns);
            for (int i = 0; i < columns; i++) {
                float growWidth = columnPrefWidth[i] - columnMinWidth[i];
                float growRatio = growWidth / (float) totalGrowWidth;
                localColumnWeightedWidth[i] = columnMinWidth[i] + extraWidth * growRatio;
            }
        }

        float[] localRowWeightedHeight;
        float totalGrowHeight = tablePrefHeight - tableMinHeight;
        if (totalGrowHeight == 0)
            localRowWeightedHeight = rowMinHeight;
        else {
            localRowWeightedHeight = this.rowWeightedHeight = ensureSize(this.rowWeightedHeight, rows);
            float extraHeight = Math.min(totalGrowHeight, Math.max(0, layoutHeight - tableMinHeight));
            for (int i = 0; i < rows; i++) {
                float growHeight = rowPrefHeight[i] - rowMinHeight[i];
                float growRatio = growHeight / (float) totalGrowHeight;
                localRowWeightedHeight[i] = rowMinHeight[i] + extraHeight * growRatio;
            }
        }

        // Determine widget and cell sizes (before expand or fill).
        for (int i = 0, n = cells.size(); i < n; i++) {
            Cell<C, T> c = cells.get(i);
            if (c.ignore)
                continue;

            float spannedWeightedWidth = 0;
            for (int column = c.column, nn = column + c.colspan; column < nn; column++)
                spannedWeightedWidth += localColumnWeightedWidth[column];
            float weightedHeight = localRowWeightedHeight[c.row];

            float prefWidth = w(c.prefWidth, c);
            float prefHeight = h(c.prefHeight, c);
            float minWidth = w(c.minWidth, c);
            float minHeight = h(c.minHeight, c);
            float maxWidth = w(c.maxWidth, c);
            float maxHeight = h(c.maxHeight, c);
            if (prefWidth < minWidth)
                prefWidth = minWidth;
            if (prefHeight < minHeight)
                prefHeight = minHeight;
            if (maxWidth > 0 && prefWidth > maxWidth)
                prefWidth = maxWidth;
            if (maxHeight > 0 && prefHeight > maxHeight)
                prefHeight = maxHeight;

            c.widgetWidth = Math.min(spannedWeightedWidth - c.computedPadLeft - c.computedPadRight, prefWidth);
            c.widgetHeight = Math.min(weightedHeight - c.computedPadTop - c.computedPadBottom, prefHeight);

            if (c.colspan == 1)
                columnWidth[c.column] = Math.max(columnWidth[c.column], spannedWeightedWidth);
            rowHeight[c.row] = Math.max(rowHeight[c.row], weightedHeight);
        }

        // Distribute remaining space to any expanding columns/rows.
        if (totalExpandWidth > 0) {
            float extra = layoutWidth - hpadding;
            for (int i = 0; i < columns; i++)
                extra -= columnWidth[i];
            float used = 0;
            int lastIndex = 0;
            for (int i = 0; i < columns; i++) {
                if (expandWidth[i] == 0)
                    continue;
                float amount = extra * expandWidth[i] / totalExpandWidth;
                columnWidth[i] += amount;
                used += amount;
                lastIndex = i;
            }
            columnWidth[lastIndex] += extra - used;
        }
        if (totalExpandHeight > 0) {
            float extra = layoutHeight - vpadding;
            for (int i = 0; i < rows; i++)
                extra -= rowHeight[i];
            float used = 0;
            int lastIndex = 0;
            for (int i = 0; i < rows; i++) {
                if (expandHeight[i] == 0)
                    continue;
                float amount = extra * expandHeight[i] / totalExpandHeight;
                rowHeight[i] += amount;
                used += amount;
                lastIndex = i;
            }
            rowHeight[lastIndex] += extra - used;
        }

        // Distribute any additional width added by colspanned cells to the
        // columns spanned.
        for (int i = 0, n = cells.size(); i < n; i++) {
            Cell<C, T> c = cells.get(i);
            if (c.ignore)
                continue;
            if (c.colspan == 1)
                continue;

            float extraWidth = 0;
            for (int column = c.column, nn = column + c.colspan; column < nn; column++)
                extraWidth += localColumnWeightedWidth[column] - columnWidth[column];
            extraWidth -= Math.max(0, c.computedPadLeft + c.computedPadRight);

            extraWidth /= c.colspan;
            if (extraWidth > 0) {
                for (int column = c.column, nn = column + c.colspan; column < nn; column++)
                    columnWidth[column] += extraWidth;
            }
        }

        // Determine table size.
        float tableWidth = hpadding, tableHeight = vpadding;
        for (int i = 0; i < columns; i++)
            tableWidth += columnWidth[i];
        for (int i = 0; i < rows; i++)
            tableHeight += rowHeight[i];

        // Position table within the container.
        float x = layoutX + w(padLeft);
        if ((align & RIGHT) != 0)
            x += layoutWidth - tableWidth;
        else if ((align & LEFT) == 0) // Center
            x += (layoutWidth - tableWidth) / 2;

        float y = layoutY + w(padTop);
        if ((align & BOTTOM) != 0)
            y += layoutHeight - tableHeight;
        else if ((align & TOP) == 0) // Center
            y += (layoutHeight - tableHeight) / 2;

        // Position widgets within cells.
        float currentX = x, currentY = y;
        for (int i = 0, n = cells.size(); i < n; i++) {
            Cell<C, T> c = cells.get(i);
            if (c.ignore)
                continue;

            float spannedCellWidth = 0;
            for (int column = c.column, nn = column + c.colspan; column < nn; column++)
                spannedCellWidth += columnWidth[column];
            spannedCellWidth -= c.computedPadLeft + c.computedPadRight;

            currentX += c.computedPadLeft;

            if (c.fillX > 0) {
                c.widgetWidth = spannedCellWidth * c.fillX;
                float maxWidth = w(c.maxWidth, c);
                if (maxWidth > 0)
                    c.widgetWidth = Math.min(c.widgetWidth, maxWidth);
            }
            if (c.fillY > 0) {
                c.widgetHeight = rowHeight[c.row] * c.fillY - c.computedPadTop - c.computedPadBottom;
                float maxHeight = h(c.maxHeight, c);
                if (maxHeight > 0)
                    c.widgetHeight = Math.min(c.widgetHeight, maxHeight);
            }

            if ((c.align & LEFT) != 0)
                c.widgetX = currentX;
            else if ((c.align & RIGHT) != 0)
                c.widgetX = currentX + spannedCellWidth - c.widgetWidth;
            else
                c.widgetX = currentX + (spannedCellWidth - c.widgetWidth) / 2;

            if ((c.align & TOP) != 0)
                c.widgetY = currentY + c.computedPadTop;
            else if ((c.align & BOTTOM) != 0)
                c.widgetY = currentY + rowHeight[c.row] - c.widgetHeight - c.computedPadBottom;
            else
                c.widgetY = currentY + (rowHeight[c.row] - c.widgetHeight + c.computedPadTop - c.computedPadBottom) / 2;

            if (c.endRow) {
                currentX = x;
                currentY += rowHeight[c.row];
            } else
                currentX += spannedCellWidth + c.computedPadRight;
        }

        // Draw debug widgets and bounds.
        if (debug == Debug.none)
            return;
        toolkit.clearDebugRectangles(this);
        currentX = x;
        currentY = y;
        if (debug == Debug.table || debug == Debug.all) {
            toolkit.addDebugRectangle(this, Debug.table, layoutX, layoutY, layoutWidth, layoutHeight);
            toolkit.addDebugRectangle(this, Debug.table, x, y, tableWidth - hpadding, tableHeight - vpadding);
        }
        for (int i = 0, n = cells.size(); i < n; i++) {
            Cell<C, T> c = cells.get(i);
            if (c.ignore)
                continue;

            // Widget bounds.
            if (debug == Debug.widget || debug == Debug.all)
                toolkit.addDebugRectangle(this, Debug.widget, c.widgetX, c.widgetY, c.widgetWidth, c.widgetHeight);

            // Cell bounds.
            float spannedCellWidth = 0;
            for (int column = c.column, nn = column + c.colspan; column < nn; column++)
                spannedCellWidth += columnWidth[column];
            spannedCellWidth -= c.computedPadLeft + c.computedPadRight;
            currentX += c.computedPadLeft;
            if (debug == Debug.cell || debug == Debug.all) {
                toolkit.addDebugRectangle(this, Debug.cell, currentX, currentY + c.computedPadTop, spannedCellWidth, rowHeight[c.row] - c.computedPadTop - c.computedPadBottom);
            }

            if (c.endRow) {
                currentX = x;
                currentY += rowHeight[c.row];
            } else
                currentX += spannedCellWidth + c.computedPadRight;
        }
    }
1254822
def handle_request(self, request, app, model, pk):
        """"""
        ModelClass = self.get_model_class()
        object = ModelClass.objects.get(id=pk)

        tab_code = request.GET.get('tab')
        model_alias = request.GET.get('model_alias')
        model_alias = model_alias if model_alias else '{}.{}'.format(app, model)

        # TODO permission check

        item = tabs.get_tab(model_alias, object, tab_code)

        return item.get_layout(object).render(request)
22898
def clearLayout(layout):
    """"""
    while layout.count():
        child = layout.takeAt(0)
        child.widget().deleteLater()
183086
function change_layout(cls) {
    $("body").toggleClass(cls);
    AdminLTE.layout.fixSidebar();
    //Fix the problem with right sidebar and layout boxed
    if (cls == "layout-boxed")
      AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
    if ($('body').hasClass('fixed') && cls == 'fixed') {
      AdminLTE.pushMenu.expandOnHover();
      AdminLTE.layout.activate();
    }
    AdminLTE.controlSidebar._fix($(".control-sidebar-bg"));
    AdminLTE.controlSidebar._fix($(".control-sidebar"));
  }
491483
protected function handleLayoutFile(&$layoutFiles, $path)
    {
        $aliased = Yii::getAlias($path, false);
        $filePath = $aliased ? $aliased : $path;
        
        if (is_dir($filePath)) {
            foreach ($this->getFilesFromFolder($filePath) as $file) {
                $handler = $this->importLayoutFile($file, $path);
                if ($handler) {
                    $layoutFiles[] = $handler;
                }
            }
        } else {
            $handler = $this->importLayoutFile($filePath, $path);
            if ($handler) {
                $layoutFiles[] = $handler;
            }
        }
    }
623690
def set_layout(layout)
      case layout
      when Array
        $log.error  "NIL in window constructor" if layout.include? nil
        raise ArgumentError, "Nil in window constructor" if layout.include? nil
        # NOTE this is just setting, and not replacing zero with max values
        @height, @width, @top, @left = *layout
        raise ArgumentError, "Nil in window constructor" if @top.nil? || @left.nil?

        @layout = { :height => @height, :width => @width, :top => @top, :left => @left }
      when Hash
        @layout = layout

        [:height, :width, :top, :left].each do |name|
          instance_variable_set("@#{name}", @layout[name])
        end
      end
    end
884128
def do_layout(payload, layouts)
      self.output = _renderer.tap do |renderer|
        renderer.layouts = layouts
        renderer.payload = payload
      end.run

      Jekyll.logger.debug "Post-Render Hooks:", relative_path
      Jekyll::Hooks.trigger hook_owner, :post_render, self
    ensure
      @_renderer = nil # this will allow the modifications above to disappear
    end
876530
function updateLayout() {
      var layout = generator.layoutTemplate(newpage);
      $layout.html(generator.renderLayout(newpage));
      $layout.attr('data-render-layout', layout);
      log('jqueryview updateLayout', path, query, hash);
      generator.emit('update-view', path, query, hash, window, $layout);
    }
694620
def main(argv=None):
    '''
    
    '''
    # Prep argparse
    ap = argparse.ArgumentParser(
        description='Basic query options for Python HID-IO Layouts repository',
    )
    ap.add_argument('--list', action='store_true', help='List available layout aliases.')
    ap.add_argument('--get', metavar='NAME', help='Retrieve the given layout, and return the JSON data')

    # Parse arguments
    args = ap.parse_args(argv)

    # Create layouts context manager
    mgr = Layouts()

    # Check if generating a list
    if args.list:
        for name in mgr.list_layouts():
            print(name)

    # Retrieve JSON layout
    if args.get is not None:
        layout = mgr.get_layout(args.get)
        print(json.dumps(layout.json()))
1276229
function render(file, layout, context, partials, callback) {
  try {
    const data = mustache.render(layout, context, partials);
    async.nextTick(callback, null, data);
  } catch (error) {
    console.error(`${file.path}: Could not render the layout`);
    async.nextTick(callback, error);
  }
}
1329859
def do_layout(payload, layouts)
      pre_render if respond_to?(:pre_render) && hooks

      if respond_to?(:merge_payload) && hooks
        old_do_layout(merge_payload(payload.dup), layouts)
      else
        old_do_layout(payload, layouts)
      end

      post_render if respond_to?(:post_render) && hooks
    end
831268
function layoutNode (root) {
  var rootNode = createNode(root);
  computeLayout(rootNode);
  walkNode(rootNode);
  return rootNode;
}
843993
def handle(self):
        
        self.output = PyStratumStyle(self.input, self.output)

        config_file = self.argument('config_file')
        sources = self.argument('file_names')

        status = self.run_command(config_file, sources)

        return status
12024
function executeCommand(command, circles, current, position) {
            var circle = circles[current],
                transformed = false;

            switch (command) {
                case 'increase-x':
                    circle.x += 10;
                    transformed = true;
                    break;
                case 'decrease-x':
                    circle.x -= 10;
                    transformed = true;
                    break;
                case 'increase-y':
                    circle.y += 10;
                    transformed = true;
                    break;
                case 'decrease-y':
                    circle.y -= 10;
                    transformed = true;
                    break;
                case 'increase-r':
                    circle.r += 10;
                    transformed = true;
                    break;
                case 'decrease-r':
                    circle.r -= 10;
                    transformed = true;
                    break;
                case 'bring-to-front':
                    bringToFront(circles, circle, current);
                    break;
                case 'send-to-back':
                    sendToBack(circles, circle, current);
                    break;
                case 'new-circle':
                    newCircle(position, circles, TOOLBAR_HEIGHT);
                    break;
                case 'random-circle':
                    randomCircle(circles, TOOLBAR_HEIGHT);
                    break;
                case 'remove-circle':
                    removeCircle(circles, current);
                    break;
                case 'move':
                    moveCircles(circles, position);
                    break;
                case 'clear':
                    clear(circles);
                    break;
            }

            if (transformed) {
                circle.x = Math.max(circle.x, 10);
                circle.y = Math.max(circle.y, 10);
                circle.r = Math.max(circle.r, 10);
            }

            return circles;
        }
402080
protected function renderCommand(BlockLayout $layout, Command $command)
    {
        $description = $command->getConfig()->getDescription();
        $name = '<c1>'.$command->getName().'</c1>';

        $layout->add(new LabeledParagraph($name, $description));
    }