Build out support for containers to report a position to the layout. This now works for Windows, but will require significantly more work for Paneds
This commit is contained in:
parent
d51d9cd700
commit
64a0f70c41
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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):
|
||||
|
|
|
@ -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"""
|
||||
|
|
Loading…
Reference in New Issue