'Setup editorstack\'s layout'

def setup_editorstack(self, parent, layout):

    menu_btn = create_toolbutton(self, icon=ima.icon('tooloptions'), tip=_('Options'))
    self.menu = QMenu(self)
    menu_btn.setMenu(self.menu)
    menu_btn.setPopupMode(menu_btn.InstantPopup)
    self.menu.aboutToShow.connect(self.__setup_menu)
    corner_widgets = {Qt.TopRightCorner: [menu_btn]}
    self.tabs = BaseTabs(self, menu=self.menu, menu_use_tooltips=True, corner_widgets=corner_widgets)
    self.tabs.tabBar().setObjectName('plugin-tab')
    self.tabs.set_close_function(self.close_file)
    self.tabs.setMovable(True)
    self.stack_history.refresh()
    if (hasattr(self.tabs, 'setDocumentMode') and (not (sys.platform == 'darwin'))):
        self.tabs.setDocumentMode(True)
    self.tabs.currentChanged.connect(self.current_changed)
    if (sys.platform == 'darwin'):
        tab_container = QWidget()
        tab_container.setObjectName('tab-container')
        tab_layout = QHBoxLayout(tab_container)
        tab_layout.setContentsMargins(0, 0, 0, 0)
        tab_layout.addWidget(self.tabs)
        layout.addWidget(tab_container)
    else:
        layout.addWidget(self.tabs)
