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

@ -256,6 +256,9 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
if hasattr(position, '__iter__'): if hasattr(position, '__iter__'):
position = ':'.join([str(x) for x in position]) position = ':'.join([str(x) for x in position])
layout['position'] = position layout['position'] = position
if hasattr(self, 'ratio'):
layout['ratio'] = self.ratio
if hasattr(self, 'get_size'): if hasattr(self, 'get_size'):
layout['size'] = 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_child1().create_layout(children[keys[0]])
self.get_child2().create_layout(children[keys[1]]) self.get_child2().create_layout(children[keys[1]])
# Store the position for later # Set the position with ratio. For some reason more reliable than by pos.
if layout['position']: if layout.has_key('ratio'):
self.position = int(layout['position']) self.ratio = float(layout['ratio'])
self.set_position_by_ratio()
def grab_focus(self): def grab_focus(self):
"""We don't want focus, we want a Terminal to have it""" """We don't want focus, we want a Terminal to have it"""

View File

@ -262,7 +262,6 @@ class Terminator(Borg):
raise(ValueError) raise(ValueError)
dbg('Creating a window') dbg('Creating a window')
window, terminal = self.new_window() window, terminal = self.new_window()
window.create_layout(layout[windef])
if layout[windef].has_key('position'): if layout[windef].has_key('position'):
parts = layout[windef]['position'].split(':') parts = layout[windef]['position'].split(':')
if len(parts) == 2: if len(parts) == 2:
@ -275,6 +274,7 @@ class Terminator(Borg):
window.resize(winx, winy) window.resize(winx, winy)
if layout[windef].has_key('title'): if layout[windef].has_key('title'):
window.title.force_title(layout[windef]['title']) window.title.force_title(layout[windef]['title'])
window.create_layout(layout[windef])
def layout_done(self): def layout_done(self):
"""Layout operations have finished, record that fact""" """Layout operations have finished, record that fact"""