diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 1ba9fc64..613f990b 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -467,6 +467,7 @@ class ConfigBase(Borg): section['parent'] = 'string' section['profile'] = 'string(default=default)' section['command'] = 'string(default="")' + section['position'] = 'string(default="")' configspecdata['layouts'] = {} configspecdata['layouts']['__many__'] = {} configspecdata['layouts']['__many__']['__many__'] = section diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 7bfe63f2..286a8ca9 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -201,6 +201,13 @@ the %s will also close all terminals within it.') % (reqtype, reqtype)) layout['type'] = mytype layout['parent'] = parent + + if hasattr(self, 'get_position'): + position = self.get_position() + if hasattr(position, '__iter__'): + position = ':'.join([str(x) for x in position]) + layout['position'] = position + name = 'child%d' % count count = count + 1 diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index aca38337..ea431b6c 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -223,6 +223,10 @@ class Paned(Container): self.get_child1().create_layout(children[keys[0]]) self.get_child2().create_layout(children[keys[1]]) + # FIXME: We need a delayed call to set_position, probably on realizing + # this widget, but it probably needs to start at the deepest widget and + # work back up. Fun. + class HPaned(Paned, gtk.HPaned): """Merge gtk.HPaned into our base Paned Container""" def __init__(self): diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 506fa4a1..6089d325 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -134,6 +134,12 @@ class Terminator(Borg): hierarchy[obj] = {} hierarchy[obj]['type'] = 'Window' hierarchy[obj]['children'] = {} + + # Copy any additional keys + for objkey in layout[obj].keys(): + if layout[obj][objkey] != '' and not hierarchy[obj].has_key(objkey): + hierarchy[obj][objkey] = layout[obj][objkey] + objects[obj] = hierarchy[obj] del(layout[obj]) else: @@ -165,6 +171,10 @@ class Terminator(Borg): raise(ValueError) window, terminal = self.new_window() window.create_layout(layout[windef]) + if layout[windef].has_key('position'): + parts = layout[windef]['position'].split(':') + if len(parts) == 2: + window.move(int(parts[0]), int(parts[1])) def layout_done(self): """Layout operations have finished, record that fact"""