Previous split_axis() changes were insufficient. Apply the changes across all of the Containers and improve the implementation generally
This commit is contained in:
parent
94a568ee1c
commit
9b6cdcd4ac
|
@ -71,7 +71,7 @@ class Container(object):
|
||||||
"""Split this container vertically"""
|
"""Split this container vertically"""
|
||||||
return(self.split_axis(widget, False))
|
return(self.split_axis(widget, False))
|
||||||
|
|
||||||
def split_axis(self, widget, vertical=True, sibling=None):
|
def split_axis(self, widget, vertical=True, sibling=None, siblinglast=None):
|
||||||
"""Default axis splitter. This should be implemented by subclasses"""
|
"""Default axis splitter. This should be implemented by subclasses"""
|
||||||
raise NotImplementedError('split_axis')
|
raise NotImplementedError('split_axis')
|
||||||
|
|
||||||
|
|
|
@ -52,8 +52,9 @@ class Notebook(Container, gtk.Notebook):
|
||||||
self.set_tab_pos(pos)
|
self.set_tab_pos(pos)
|
||||||
self.set_show_tabs(not self.config['hide_tabbar'])
|
self.set_show_tabs(not self.config['hide_tabbar'])
|
||||||
|
|
||||||
def split_axis(self, widget, vertical=True, sibling=None):
|
def split_axis(self, widget, vertical=True, sibling=None, siblinglast=False):
|
||||||
"""Split the axis of a terminal inside us"""
|
"""Split the axis of a terminal inside us"""
|
||||||
|
order = None
|
||||||
page_num = self.page_num(widget)
|
page_num = self.page_num(widget)
|
||||||
if page_num == -1:
|
if page_num == -1:
|
||||||
err('Notebook::split_axis: %s not found in Notebook' % widget)
|
err('Notebook::split_axis: %s not found in Notebook' % widget)
|
||||||
|
@ -76,8 +77,12 @@ class Notebook(Container, gtk.Notebook):
|
||||||
self.set_tab_label(container, label)
|
self.set_tab_label(container, label)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
container.add(widget)
|
order = [widget, sibling]
|
||||||
container.add(sibling)
|
if siblinglast is True:
|
||||||
|
order.reverse
|
||||||
|
|
||||||
|
for terminal in order:
|
||||||
|
container.add(terminal)
|
||||||
self.set_current_page(page_num)
|
self.set_current_page(page_num)
|
||||||
|
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
|
@ -43,8 +43,7 @@ class Paned(Container):
|
||||||
def split_axis(self, widget, vertical=True, sibling=None,
|
def split_axis(self, widget, vertical=True, sibling=None,
|
||||||
siblinglast=False):
|
siblinglast=False):
|
||||||
"""Default axis splitter. This should be implemented by subclasses"""
|
"""Default axis splitter. This should be implemented by subclasses"""
|
||||||
first = None
|
order = None
|
||||||
second = None
|
|
||||||
|
|
||||||
maker = Factory()
|
maker = Factory()
|
||||||
|
|
||||||
|
@ -61,15 +60,12 @@ class Paned(Container):
|
||||||
self.add(container)
|
self.add(container)
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
|
order = [widget, sibling]
|
||||||
if siblinglast is True:
|
if siblinglast is True:
|
||||||
first = widget
|
order.reverse()
|
||||||
second = sibling
|
|
||||||
else:
|
|
||||||
first = sibling
|
|
||||||
second = widget
|
|
||||||
|
|
||||||
container.add(first)
|
for terminal in order:
|
||||||
container.add(second)
|
container.add(terminal)
|
||||||
|
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
|
|
|
@ -288,8 +288,9 @@ class Window(Container, gtk.Window):
|
||||||
if len(self.get_children()) == 0:
|
if len(self.get_children()) == 0:
|
||||||
self.emit('destroy')
|
self.emit('destroy')
|
||||||
|
|
||||||
def split_axis(self, widget, vertical=True, sibling=None):
|
def split_axis(self, widget, vertical=True, sibling=None, siblinglast=False):
|
||||||
"""Split the window"""
|
"""Split the window"""
|
||||||
|
order = None
|
||||||
maker = Factory()
|
maker = Factory()
|
||||||
self.remove(widget)
|
self.remove(widget)
|
||||||
|
|
||||||
|
@ -304,7 +305,11 @@ class Window(Container, gtk.Window):
|
||||||
self.add(container)
|
self.add(container)
|
||||||
container.show_all()
|
container.show_all()
|
||||||
|
|
||||||
for term in [widget, sibling]:
|
order = [widget, sibling]
|
||||||
|
if siblinglast is True:
|
||||||
|
order.reverse()
|
||||||
|
|
||||||
|
for term in order:
|
||||||
container.add(term)
|
container.add(term)
|
||||||
container.show_all()
|
container.show_all()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue