set window layout
433078
def set_layout(wlayout, callback):
    ''''''
    global display_size
    global window_list
    global loaded_layout
    global pending_load
    global vehiclename
    #if not wlayout.name in window_list:
    #    print("layout %s" % wlayout)
    if not wlayout.name in window_list and loaded_layout is not None and wlayout.name in loaded_layout:
        callback(loaded_layout[wlayout.name])
    window_list[wlayout.name] = ManagedWindow(wlayout, callback)
    display_size = wlayout.dsize
    if pending_load:
        pending_load = False
        load_layout(vehiclename)
1093201
function setupWindow(win, conn) {
  win.on('inputChar', function (c, i) {
    if (i === nc.keys.ESC) {
      var items = {};
      for (var i=0; i<connections.length; i++) {
        items[connections[i].client.opt.server] = connections[i].wins.status;
        for (var j=0,chans=Object.keys(connections[i].wins.channels); j<chans.length; j++)
          items['  ' + chans[j]] = connections[i].wins.channels[chans[j]];
        for (var j=0,queries=Object.keys(connections[i].wins.queries); j<queries.length; j++)
          items['  Q:' + queries[j]] = connections[i].wins.queries[queries[j]];
      }
      widgets.ListBox(items,
        {
          title: 'Windows',
          height: Math.min(Object.keys(items).length+2, nc.lines-2),
          style: {
            colors: {
              bg: 'blue',
              fg: 'white'
            }
          }
        }, function(window) {
          if (window)
            window.top();
          nc.redraw();
      });
    } else if (i === nc.keys.BACKSPACE && win.curx > 0) {
      win.inbuffer = win.inbuffer.substring(0, win.curx - 1) + win.inbuffer.substring(win.curx);
      win.delch(win.height-1, win.curx - 1);
      win.refresh();
    } else if (i === nc.keys.DEL) {
      win.inbuffer = win.inbuffer.substring(0, win.curx) + win.inbuffer.substring(win.curx + 1);
      win.delch(win.height-1, win.curx);
      win.refresh();
    } else if (i === nc.keys.LEFT && win.curx > 0) {
      win.cursor(win.height-1, win.curx-1);
      win.refresh();
    } else if (i === nc.keys.RIGHT && win.curx < win.inbuffer.length) {
      win.cursor(win.height-1, win.curx+1);
      win.refresh();
    } else if (i === nc.keys.END) {
      win.cursor(win.height-1, win.inbuffer.length);
      win.refresh();
    } else if (i === nc.keys.HOME) {
      win.cursor(win.height-1, 0);
      win.refresh();
	  } else if (i === nc.keys.NEWLINE) {
	    if (win.inbuffer.length) {
	      if (win.inbuffer[0] === '/') {
  	      var cmd = win.inbuffer.substring(1).split(' ', 1).join('').trim(),
  	          args = win.inbuffer.substring(win.inbuffer.indexOf(cmd)+cmd.length+1).trim();
	        switch (cmd.toLowerCase()) {
            case 'j':
	          case 'join':
              if (args.length) {
                if (args[0] !== '#' && args[0] !== '&'
                    && args[0] !== '+' && args[0] !== '!')
                  args = "#" + args;
                if (args.length > 1 && !conn.wins.channels[args])
                  conn.client.join(args);
              }
	          break;
            case 'part':
              var name = getWinName(win, conn);
              if (name[0] === '#' || name[0] === '&'
                  || name[0] === '+' || name[0] === '!') {
                conn.client.part(name);
                delete conn.wins.channels[name];
              }
            break;
	          case 'msg':
	            var who = args.substring(0, args.indexOf(' ')),
	                message = args.substring(args.indexOf(' ')+1);
	            if (!who.length || !message.length)
	              appendLine(win, 'Invalid arguments');
	            else {
	              conn.client.say(who, message);
	              appendLine(win, '* ->' + who + ': ' + message);
	            }
	          break;
	          case 'me':
	            if (win !== conn.wins.status) {
	              if (args.length) {
                  var key = getWinName(win, conn);
	                conn.client.say(key, CTCP_DELIM + 'ACTION ' + args + CTCP_DELIM);
  	              appendLine(win, '* ' + conn.client.nick + ' ' + args, COLOR_ACTION);
  	            }
	            } else
	              appendLine(win, 'That command is only valid on channel and query windows');
	          break;
            case 'whois':
              if (args.length) {
                conn.client.send('WHOIS', args, false);
              }
            break;
            case 'nick':
              if (args.length) {
                var newnick = args.split(' ', 1).join('');
                if (newnick) {
                  conn.client.prevnick = conn.client.nick;
                  conn.client.send("NICK", newnick);
                  conn.client.nick = newnick;
                }
              }
            break;
            case 'away':
              conn.client.send('AWAY', (args.length ? args : 'I am away'));
              appendLine(conn.wins.status, '* You have been marked as being away', nc.attrs.BOLD);
            break;
            case 'back':
              conn.client.send('AWAY');
              appendLine(conn.wins.status, '* You are no longer marked as being away', nc.attrs.BOLD);
            break;
            case 'exit':
	          case 'quit':
	            if (args.length)
  	            conn.client.disconnect(args);
  	          else
  	            conn.client.disconnect();
	            cleanup();
	          break;
	          case 'close':
	            if (win === conn.wins.status)
	              conn.client.disconnect();
	            else {
                var key = getWinName(win, conn);
                if (key[0] === '#' || key[0] === '&'
                    || key[0] === '+' || key[0] === '!') {
                  conn.client.part(key);
                  delete conn.wins.channels[key];
                } else
                  delete conn.wins.queries[key];
	            }
              win.close();
              nc.redraw();
              if (nc.numwins === 1)
                cleanup();
              return;
	          break;
	          case 'query':
	            var to = args.split(' ', 1).join('');
              if (!conn.wins.queries[to.toLowerCase()]) {
                var query = new nc.Window(nc.lines, nc.cols);
                setupWindow(query, conn);
                updateHeader(query, 'Query: ' + to, {pos: 'center'});
                conn.wins.queries[to.toLowerCase()] = query;
              }
	          break;
            case 'connect':
            break;
            case 'server':
            break;
            case 'whowas':
            break;
            case 'who':
            break;
            case 'info':
            break;
            case 'banlist':
            break;
            case 'notice':
            break;
            case 'invite':
            break;
            case 'ctcp':
            break;
	          default:
  	          appendLine(win, 'Unknown command: ' + cmd);
	        }
	      } else if (win.inbuffer.length && win !== conn.wins.status) {
          var key = getWinName(win, conn);
	        conn.client.say(key, win.inbuffer);
	        appendLine(win, '<' + conn.client.nick + '> ' + win.inbuffer);
	      }
	      win.inbuffer = "";
	      win.cursor(win.height-1, 0);
	      win.clrtoeol();
	      win.refresh();
	    }
	  } else if (i >= 32 && i <= 126 && win.curx < win.width-1) {
	    win.inbuffer = win.inbuffer.slice(0, win.curx) + c + win.inbuffer.slice(win.curx);

	    if (win.curx < win.inbuffer.length) {
	      win.insch(i);
	      win.cursor(win.height - 1, win.curx + 1);
	    } else {
	      win.addch(i);
	    }
	    
	    win.refresh();
	  }
  });
  win.scrollok(true);
  win.hline(win.height-2, 0, win.width);
  win.setscrreg(1, win.height-3); // Leave one line at the top for the header
  win.cursor(win.height-1, 0);
  win.refresh();
  win.inbuffer = "";
}
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"));
  }
303419
def init_layout(self):
        
        d = self.declaration
        self.create_notification()
        if d.show:
            self.set_show(d.show)
993214
def resize(self, width, height):
        """"""
        SetWindowPos(self._hwnd, None, 0, 0, width, height, SWP_NOMOVE)
59697
private WindowManager.LayoutParams createLayoutParams() {
        WindowManager.LayoutParams layoutParams = getWindow().getAttributes();
        layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
        layoutParams.height = ViewGroup.LayoutParams.MATCH_PARENT;
        return layoutParams;
    }
888482
def setWindowTitle(self, newTitle=''):
        """"""
        title = 'Rampage - ' + newTitle
        super(MainWindow, self).setWindowTitle(title)
769540
public function setupLayout()
    {
        if (isset($this->layout) && !is_null($this->layout)) {
            $data = array();
            // Enter here data that have to be accessible everywhere
            $this->layout = view($this->layout, $data);
        }
    }
57977
def _set_view(self):
        """"""
        if self.logarithmic:
            view_class = HorizontalLogView
        else:
            view_class = HorizontalView

        self.view = view_class(
            self.width - self.margin_box.x, self.height - self.margin_box.y,
            self._box
        )
235668
private RelativeLayout.LayoutParams createLayoutParams() {
        Rect windowDimensions = new Rect();
        Window window = getWindow();
        assert window != null;
        window.getDecorView().getWindowVisibleDisplayFrame(windowDimensions);
        int leftInset = isFitsSystemWindowsLeft() && isFullscreen() && systemWindowInsets != null ?
                systemWindowInsets.left : 0;
        int topInset = isFitsSystemWindowsTop() && isFullscreen() && systemWindowInsets != null ?
                systemWindowInsets.top : 0;
        int rightInset =
                isFitsSystemWindowsRight() && isFullscreen() && systemWindowInsets != null ?
                        systemWindowInsets.right : 0;
        int bottomInset =
                isFitsSystemWindowsBottom() && isFullscreen() && systemWindowInsets != null ?
                        systemWindowInsets.bottom : 0;
        int leftMargin = getLeftMargin() - getWindowInsetLeft() + leftInset;
        int topMargin = getTopMargin() - getWindowInsetTop() + topInset;
        int rightMargin = getRightMargin() - getWindowInsetRight() + rightInset;
        int bottomMargin = getBottomMargin() - getWindowInsetBottom() + bottomInset;
        int width =
                getLayoutDimension(getWidth(), leftMargin + rightMargin, windowDimensions.right);
        int height =
                getLayoutDimension(getHeight(), topMargin + bottomMargin, windowDimensions.bottom);
        RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(width, height);
        layoutParams.leftMargin = leftMargin;
        layoutParams.topMargin = topMargin;
        layoutParams.rightMargin = rightMargin;
        layoutParams.bottomMargin = bottomMargin;

        if ((getGravity() & Gravity.CENTER_HORIZONTAL) == Gravity.CENTER_HORIZONTAL) {
            layoutParams.addRule(RelativeLayout.CENTER_HORIZONTAL, RelativeLayout.TRUE);
        }

        if ((getGravity() & Gravity.CENTER_VERTICAL) == Gravity.CENTER_VERTICAL) {
            layoutParams.addRule(RelativeLayout.CENTER_VERTICAL, RelativeLayout.TRUE);
        }

        if ((getGravity() & Gravity.LEFT) == Gravity.LEFT) {
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE);
        }

        if ((getGravity() & Gravity.TOP) == Gravity.TOP) {
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE);
        }

        if ((getGravity() & Gravity.RIGHT) == Gravity.RIGHT) {
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_RIGHT, RelativeLayout.TRUE);
        }

        if ((getGravity() & Gravity.BOTTOM) == Gravity.BOTTOM) {
            layoutParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM, RelativeLayout.TRUE);
        }

        return layoutParams;
    }
337920
def quick_layout_settings(self):
        """"""
        get = CONF.get
        set_ = CONF.set

        section = 'quick_layouts'

        names = get(section, 'names')
        order = get(section, 'order')
        active = get(section, 'active')

        dlg = self.dialog_layout_settings(self, names, order, active)
        if dlg.exec_():
            set_(section, 'names', dlg.names)
            set_(section, 'order', dlg.order)
            set_(section, 'active', dlg.active)
            self.quick_layout_set_menu()
763720
def setup_default_layouts(self, index, settings):
        """"""
        self.setUpdatesEnabled(False)

        first_spyder_run = bool(self.first_spyder_run)  # Store copy

        if first_spyder_run:
            self.set_window_settings(*settings)
        else:
            if self.last_plugin:
                if self.last_plugin.ismaximized:
                    self.maximize_dockwidget(restore=True)

            if not (self.isMaximized() or self.maximized_flag):
                self.showMaximized()

            min_width = self.minimumWidth()
            max_width = self.maximumWidth()
            base_width = self.width()
            self.setFixedWidth(base_width)

        # IMPORTANT: order has to be the same as defined in the config file
        MATLAB, RSTUDIO, VERTICAL, HORIZONTAL = range(self.DEFAULT_LAYOUTS)

        # Define widgets locally
        editor = self.editor
        console_ipy = self.ipyconsole
        console_int = self.console
        outline = self.outlineexplorer
        explorer_project = self.projects
        explorer_file = self.explorer
        explorer_variable = self.variableexplorer
        plots = self.plots
        history = self.historylog
        finder = self.findinfiles
        help_plugin = self.help
        helper = self.onlinehelp
        plugins = self.thirdparty_plugins

        # Stored for tests
        global_hidden_widgets = [finder, console_int, explorer_project,
                                 helper] + plugins
        global_hidden_toolbars = [self.source_toolbar, self.edit_toolbar,
                                  self.search_toolbar]
        # Layout definition
        # --------------------------------------------------------------------
        # Layouts are organized by columns, each column is organized by rows.
        # Widths have to add 1.0 (except if hidden), height per column has to
        # add 1.0 as well

        # Spyder Default Initial Layout
        s_layout = {
            'widgets': [
                # Column 0
                [[explorer_project]],
                # Column 1
                [[editor]],
                # Column 2
                [[outline]],
                # Column 3
                [[help_plugin, explorer_variable, plots,     # Row 0
                  helper, explorer_file, finder] + plugins,
                 [console_int, console_ipy, history]]        # Row 1
                ],
            'width fraction': [0.05,            # Column 0 width
                               0.55,            # Column 1 width
                               0.05,            # Column 2 width
                               0.45],           # Column 3 width
            'height fraction': [[1.0],          # Column 0, row heights
                                [1.0],          # Column 1, row heights
                                [1.0],          # Column 2, row heights
                                [0.46, 0.54]],  # Column 3, row heights
            'hidden widgets': [outline] + global_hidden_widgets,
            'hidden toolbars': [],
        }

        # RStudio
        r_layout = {
            'widgets': [
                # column 0
                [[editor],                            # Row 0
                 [console_ipy, console_int]],         # Row 1
                # column 1
                [[explorer_variable, plots, history,  # Row 0
                  outline, finder] + plugins,
                 [explorer_file, explorer_project,    # Row 1
                  help_plugin, helper]]
                ],
            'width fraction': [0.55,            # Column 0 width
                               0.45],           # Column 1 width
            'height fraction': [[0.55, 0.45],   # Column 0, row heights
                                [0.55, 0.45]],  # Column 1, row heights
            'hidden widgets': [outline] + global_hidden_widgets,
            'hidden toolbars': [],
        }

        # Matlab
        m_layout = {
            'widgets': [
                # column 0
                [[explorer_file, explorer_project],
                 [outline]],
                # column 1
                [[editor],
                 [console_ipy, console_int]],
                # column 2
                [[explorer_variable, plots, finder] + plugins,
                 [history, help_plugin, helper]]
                ],
            'width fraction': [0.10,            # Column 0 width
                               0.45,            # Column 1 width
                               0.45],           # Column 2 width
            'height fraction': [[0.55, 0.45],   # Column 0, row heights
                                [0.55, 0.45],   # Column 1, row heights
                                [0.55, 0.45]],  # Column 2, row heights
            'hidden widgets': global_hidden_widgets,
            'hidden toolbars': [],
        }

        # Vertically split
        v_layout = {
            'widgets': [
                # column 0
                [[editor],                                  # Row 0
                 [console_ipy, console_int, explorer_file,  # Row 1
                  explorer_project, help_plugin, explorer_variable, plots,
                  history, outline, finder, helper] + plugins]
                ],
            'width fraction': [1.0],            # Column 0 width
            'height fraction': [[0.55, 0.45]],  # Column 0, row heights
            'hidden widgets': [outline] + global_hidden_widgets,
            'hidden toolbars': [],
        }

        # Horizontally split
        h_layout = {
            'widgets': [
                # column 0
                [[editor]],                                 # Row 0
                # column 1
                [[console_ipy, console_int, explorer_file,  # Row 0
                  explorer_project, help_plugin, explorer_variable, plots,
                  history, outline, finder, helper] + plugins]
                ],
            'width fraction': [0.55,      # Column 0 width
                               0.45],     # Column 1 width
            'height fraction': [[1.0],    # Column 0, row heights
                                [1.0]],   # Column 1, row heights
            'hidden widgets': [outline] + global_hidden_widgets,
            'hidden toolbars': []
        }

        # Layout selection
        layouts = {
            'default': s_layout,
            RSTUDIO: r_layout,
            MATLAB: m_layout,
            VERTICAL: v_layout,
            HORIZONTAL: h_layout,
        }

        layout = layouts[index]

        # Remove None from widgets layout
        widgets_layout = layout['widgets']
        widgets_layout_clean = []
        for column in widgets_layout:
            clean_col = []
            for row in column:
                clean_row = [w for w in row if w is not None]
                if clean_row:
                    clean_col.append(clean_row)
            if clean_col:
                widgets_layout_clean.append(clean_col)

        # Flatten widgets list
        widgets = []
        for column in widgets_layout_clean:
            for row in column:
                for widget in row:
                    widgets.append(widget)

        # Make every widget visible
        for widget in widgets:
            widget.toggle_view(True)
            widget.toggle_view_action.setChecked(True)

        # We use both directions to ensure proper update when moving from
        # 'Horizontal Split' to 'Spyder Default'
        # This also seems to help on random cases where the display seems
        # 'empty'
        for direction in (Qt.Vertical, Qt.Horizontal):
            # Arrange the widgets in one direction
            for idx in range(len(widgets) - 1):
                first, second = widgets[idx], widgets[idx+1]
                if first is not None and second is not None:
                    self.splitDockWidget(first.dockwidget, second.dockwidget,
                                         direction)

        # Arrange the widgets in the other direction
        for column in widgets_layout_clean:
            for idx in range(len(column) - 1):
                first_row, second_row = column[idx], column[idx+1]
                self.splitDockWidget(first_row[0].dockwidget,
                                     second_row[0].dockwidget,
                                     Qt.Vertical)

        # Tabify
        for column in widgets_layout_clean:
            for row in column:
                for idx in range(len(row) - 1):
                    first, second = row[idx], row[idx+1]
                    self.tabify_plugins(first, second)

                # Raise front widget per row
                row[0].dockwidget.show()
                row[0].dockwidget.raise_()

        # Set dockwidget widths
        width_fractions = layout['width fraction']
        if len(width_fractions) > 1:
            _widgets = [col[0][0].dockwidget for col in widgets_layout]
            self.resizeDocks(_widgets, width_fractions, Qt.Horizontal)

        # Set dockwidget heights
        height_fractions = layout['height fraction']
        for idx, column in enumerate(widgets_layout_clean):
            if len(column) > 1:
                _widgets = [row[0].dockwidget for row in column]
                self.resizeDocks(_widgets, height_fractions[idx], Qt.Vertical)

        # Hide toolbars
        hidden_toolbars = global_hidden_toolbars + layout['hidden toolbars']
        for toolbar in hidden_toolbars:
            if toolbar is not None:
                toolbar.close()

        # Hide widgets
        hidden_widgets = layout['hidden widgets']
        for widget in hidden_widgets:
            if widget is not None:
                widget.dockwidget.close()

        if first_spyder_run:
            self.first_spyder_run = False
        else:
            self.setMinimumWidth(min_width)
            self.setMaximumWidth(max_width)

            if not (self.isMaximized() or self.maximized_flag):
                self.showMaximized()

        self.setUpdatesEnabled(True)
        self.sig_layout_setup_ready.emit(layout)

        return layout
686710
def set_window_settings(self, hexstate, window_size, prefs_dialog_size,
                            pos, is_maximized, is_fullscreen):
        """"""
        self.setUpdatesEnabled(False)
        self.window_size = QSize(window_size[0], window_size[1]) # width,height
        self.prefs_dialog_size = QSize(prefs_dialog_size[0],
                                       prefs_dialog_size[1]) # width,height
        self.window_position = QPoint(pos[0], pos[1]) # x,y
        self.setWindowState(Qt.WindowNoState)
        self.resize(self.window_size)
        self.move(self.window_position)

        # Window layout
        if hexstate:
            self.restoreState( QByteArray().fromHex(
                    str(hexstate).encode('utf-8')) )
            # [Workaround for Issue 880]
            # QDockWidget objects are not painted if restored as floating
            # windows, so we must dock them before showing the mainwindow.
            for widget in self.children():
                if isinstance(widget, QDockWidget) and widget.isFloating():
                    self.floating_dockwidgets.append(widget)
                    widget.setFloating(False)

        # Is fullscreen?
        if is_fullscreen:
            self.setWindowState(Qt.WindowFullScreen)
        self.__update_fullscreen_action()

        # Is maximized?
        if is_fullscreen:
            self.maximized_flag = is_maximized
        elif is_maximized:
            self.setWindowState(Qt.WindowMaximized)
        self.setUpdatesEnabled(True)
1323015
function () {
        var self = this, statusbar = self.statusbar, layoutRect, width, x, needsRecalc;

        if (self._fullscreen) {
          self.layoutRect(DomUtils.getWindowSize());
          self.layoutRect().contentH = self.layoutRect().innerH;
        }

        self._super();

        layoutRect = self.layoutRect();

        // Resize window based on title width
        if (self.settings.title && !self._fullscreen) {
          width = layoutRect.headerW;
          if (width > layoutRect.w) {
            x = layoutRect.x - Math.max(0, width / 2);
            self.layoutRect({ w: width, x: x });
            needsRecalc = true;
          }
        }

        // Resize window based on statusbar width
        if (statusbar) {
          statusbar.layoutRect({ w: self.layoutRect().innerW }).recalc();

          width = statusbar.layoutRect().minW + layoutRect.deltaW;
          if (width > layoutRect.w) {
            x = layoutRect.x - Math.max(0, width - layoutRect.w);
            self.layoutRect({ w: width, x: x });
            needsRecalc = true;
          }
        }

        // Recalc body and disable auto resize
        if (needsRecalc) {
          self.recalc();
        }
      }
1347582
private void setWidth(int width) {
        contentParams.width = options.fullScreenPeek() ? screenWidth : width;
        content.setLayoutParams(contentParams);
    }
445383
public void setExtent( Window win ) {
        w = win.getWest();
        e = win.getEast();
        n = win.getNorth();
        s = win.getSouth();
        rows = win.getRows();
        cols = win.getCols();
        fixResolution();
        fixRowsAndCols();
    }
925684
def SetSize(self, rect):
        

        grid = self.main_window.grid
        key = grid.actions.cursor

        drawn_rect = grid.grid_renderer._get_drawn_rect(grid, key, rect)

        self._tc.SetDimensions(drawn_rect.x, drawn_rect.y,
                               drawn_rect.width+2, drawn_rect.height+2,
                               wx.SIZE_ALLOW_MINUS_ONE)
        self._tc.Layout()