Layouts with more than two tabs would fail to load. Fixes LP #646826

This commit is contained in:
Chris Jones 2011-08-21 00:38:50 +01:00
parent 9fc2115699
commit b0f5ab21b9
2 changed files with 8 additions and 0 deletions

View File

@ -105,6 +105,7 @@ class Notebook(Container, gtk.Notebook):
def split_axis(self, widget, vertical=True, cwd=None, sibling=None, widgetfirst=True): def split_axis(self, widget, vertical=True, cwd=None, sibling=None, widgetfirst=True):
"""Split the axis of a terminal inside us""" """Split the axis of a terminal inside us"""
dbg('called for widget: %s' % widget)
order = None order = None
page_num = self.page_num(widget) page_num = self.page_num(widget)
if page_num == -1: if page_num == -1:
@ -143,6 +144,7 @@ class Notebook(Container, gtk.Notebook):
def add(self, widget): def add(self, widget):
"""Add a widget to the container""" """Add a widget to the container"""
dbg('adding a new tab')
self.newtab(widget=widget) self.newtab(widget=widget)
def remove(self, widget): def remove(self, widget):
@ -172,6 +174,7 @@ class Notebook(Container, gtk.Notebook):
def newtab(self, debugtab=False, widget=None, cwd=None): def newtab(self, debugtab=False, widget=None, cwd=None):
"""Add a new tab, optionally supplying a child widget""" """Add a new tab, optionally supplying a child widget"""
dbg('making a new tab')
maker = Factory() maker = Factory()
top_window = self.get_toplevel() top_window = self.get_toplevel()

View File

@ -228,6 +228,7 @@ class Window(Container, gtk.Window):
cwd = widget.get_cwd() cwd = widget.get_cwd()
maker = Factory() maker = Factory()
if not self.is_child_notebook(): if not self.is_child_notebook():
dbg('Making a new Notebook')
notebook = maker.make('Notebook', window=self) notebook = maker.make('Notebook', window=self)
self.get_child().newtab(debugtab, cwd=cwd) self.get_child().newtab(debugtab, cwd=cwd)
@ -770,6 +771,10 @@ class Window(Container, gtk.Window):
self.split_axis(terminal, False) self.split_axis(terminal, False)
elif child['type'] == 'Notebook': elif child['type'] == 'Notebook':
self.tab_new() self.tab_new()
i = 2
while i < len(child['children']):
self.tab_new()
i = i + 1
elif child['type'] == 'Terminal': elif child['type'] == 'Terminal':
pass pass
else: else: