def set_layout(self, layout, window): """ Applies a DockLayout to the window. """ logger.debug("set_layout: %s" % layout) if hasattr(layout, "perspective"): self._set_layout_from_aui(layout, window) return # Perform the layout. This will assign fixed sizes to the dock widgets # to enforce size constraints specified in the PaneItems. for name, direction in AREA_MAP.iteritems(): sublayout = getattr(layout, name) if sublayout: self.set_layout_for_area(sublayout, direction) self._add_dock_panes(window)
def set_layout(self, layout, window): """ Applies a DockLayout to the window. """ logger.debug("set_layout: %s" % layout) if hasattr(layout, "perspective"): self._set_layout_from_aui(layout, window) return # Perform the layout. This will assign fixed sizes to the dock widgets # to enforce size constraints specified in the PaneItems. for name, direction in AREA_MAP.items(): sublayout = getattr(layout, name) if sublayout: self.set_layout_for_area(sublayout, direction) self._add_dock_panes(window)
def set_layout(self, layout): """ Applies a DockLayout to the window. """ # Remove all existing dock widgets. for child in self.control.children(): if isinstance(child, QtGui.QDockWidget): child.hide() self.control.removeDockWidget(child) # Perform the layout. This will assign fixed sizes to the dock widgets # to enforce size constraints specified in the PaneItems. for name, q_dock_area in AREA_MAP.iteritems(): sublayout = getattr(layout, name) if sublayout: self.set_layout_for_area(sublayout, q_dock_area, _toplevel_call=False) # Remove the fixed sizes once Qt activates the layout. QtCore.QTimer.singleShot(0, self._reset_fixed_sizes)
def get_layout(self, layout, include_sizes=True): """ Get the layout by adding sublayouts to the specified DockLayout. """ for name, q_dock_area in AREA_MAP.iteritems(): sublayout = self.get_layout_for_area(q_dock_area, include_sizes) setattr(layout, name, sublayout)