Fix spliiter positions in Layouts.

This commit is contained in:
Stephen Boddy 2013-09-02 16:54:07 +02:00
parent 27555740b3
commit 7f49bcfab9
3 changed files with 8 additions and 4 deletions

View File

@ -257,6 +257,9 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
position = ':'.join([str(x) for x in position])
layout['position'] = position
if hasattr(self, 'ratio'):
layout['ratio'] = self.ratio
if hasattr(self, 'get_size'):
layout['size'] = self.get_size()

View File

@ -350,9 +350,10 @@ class Paned(Container):
self.get_child1().create_layout(children[keys[0]])
self.get_child2().create_layout(children[keys[1]])
# Store the position for later
if layout['position']:
self.position = int(layout['position'])
# Set the position with ratio. For some reason more reliable than by pos.
if layout.has_key('ratio'):
self.ratio = float(layout['ratio'])
self.set_position_by_ratio()
def grab_focus(self):
"""We don't want focus, we want a Terminal to have it"""

View File

@ -262,7 +262,6 @@ class Terminator(Borg):
raise(ValueError)
dbg('Creating a window')
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:
@ -275,6 +274,7 @@ class Terminator(Borg):
window.resize(winx, winy)
if layout[windef].has_key('title'):
window.title.force_title(layout[windef]['title'])
window.create_layout(layout[windef])
def layout_done(self):
"""Layout operations have finished, record that fact"""