Kludge the layout creation until it works
This commit is contained in:
parent
8610a845bc
commit
2164f32ddb
|
@ -198,7 +198,7 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
|
|||
|
||||
return(terminals)
|
||||
|
||||
def describe_layout(self, count, parent, global_layout):
|
||||
def describe_layout(self, count, parent, global_layout, child_order):
|
||||
"""Describe our current layout"""
|
||||
layout = {}
|
||||
maker = Factory()
|
||||
|
@ -209,6 +209,7 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
|
|||
|
||||
layout['type'] = mytype
|
||||
layout['parent'] = parent
|
||||
layout['order'] = child_order
|
||||
|
||||
if hasattr(self, 'get_position'):
|
||||
position = self.get_position()
|
||||
|
@ -224,9 +225,11 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
|
|||
|
||||
global_layout[name] = layout
|
||||
|
||||
child_order = 0
|
||||
for child in self.get_children():
|
||||
if hasattr(child, 'describe_layout'):
|
||||
count = child.describe_layout(count, name, global_layout)
|
||||
count = child.describe_layout(count, name, global_layout, child_order)
|
||||
child_order = child_order + 1
|
||||
|
||||
return(count)
|
||||
|
||||
|
|
|
@ -205,13 +205,29 @@ class Paned(Container):
|
|||
err('incorrect number of children for Paned: %s' % layout)
|
||||
return
|
||||
|
||||
keys = []
|
||||
|
||||
# FIXME: This seems kinda ugly. All we want here is to know the order
|
||||
# of children based on child['order']
|
||||
try:
|
||||
child_order_map = {}
|
||||
for child in children:
|
||||
key = children[child]['order']
|
||||
child_order_map[key] = child
|
||||
map_keys = child_order_map.keys()
|
||||
map_keys.sort()
|
||||
for map_key in map_keys:
|
||||
keys.append(child_order_map[map_key])
|
||||
except KeyError:
|
||||
# We've failed to figure out the order. At least give the terminals
|
||||
# in the wrong order
|
||||
keys = children.keys()
|
||||
|
||||
num = 0
|
||||
keys = children.keys()
|
||||
keys.sort()
|
||||
for child_key in keys:
|
||||
child = children[child_key]
|
||||
if child['type'] == 'Terminal':
|
||||
continue
|
||||
pass
|
||||
elif child['type'] == 'VPaned':
|
||||
if num == 0:
|
||||
terminal = self.get_child1()
|
||||
|
|
|
@ -1216,11 +1216,12 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
|
|||
if self.config['icon_bell'] == True:
|
||||
self.titlebar.icon_bell()
|
||||
|
||||
def describe_layout(self, count, parent, global_layout):
|
||||
def describe_layout(self, count, parent, global_layout, child_order):
|
||||
"""Describe our layout"""
|
||||
layout = {}
|
||||
layout['type'] = 'Terminal'
|
||||
layout['parent'] = parent
|
||||
layout['order'] = child_order
|
||||
name = 'terminal%d' % count
|
||||
count = count + 1
|
||||
global_layout[name] = layout
|
||||
|
|
|
@ -309,7 +309,7 @@ class Terminator(Borg):
|
|||
count = 0
|
||||
for window in self.windows:
|
||||
parent = ''
|
||||
count = window.describe_layout(count, parent, layout)
|
||||
count = window.describe_layout(count, parent, layout, 0)
|
||||
|
||||
return(layout)
|
||||
|
||||
|
|
Loading…
Reference in New Issue