Create a layout if requested, otherwise create a default one or just open a window

This commit is contained in:
Chris Jones 2010-02-17 20:57:05 +01:00
parent 4fcf72a5ba
commit 71919fce55
3 changed files with 24 additions and 0 deletions

View File

@ -59,6 +59,8 @@ if __name__ == '__main__':
except (KeyError,ValueError), ex: except (KeyError,ValueError), ex:
err('layout creation failed, creating a window ("%s")' % ex) err('layout creation failed, creating a window ("%s")' % ex)
TERMINATOR.new_window() TERMINATOR.new_window()
finally:
TERMINATOR.layout_done()
if OPTIONS.debug > 2: if OPTIONS.debug > 2:
import terminatorlib.debugserver as debugserver import terminatorlib.debugserver as debugserver

View File

@ -1030,6 +1030,10 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
shell = None shell = None
command = None command = None
if self.terminator.doing_layout == True:
dbg('still laying out, refusing to spawn a child')
return
self.vte.grab_focus() self.vte.grab_focus()
options = self.config.options_get() options = self.config.options_get()
@ -1200,6 +1204,10 @@ for %s (%s)' % (name, urlplugin.__class__.__name__))
def create_layout(self, layout): def create_layout(self, layout):
"""Apply our layout""" """Apply our layout"""
if layout.has_key('command') and layout['command'] != '':
options = self.config.options_get()
options.command = layout['command']
self.config.options_set(options)
print "Terminal::create_layout: Unimplemented. %s" % layout print "Terminal::create_layout: Unimplemented. %s" % layout
# There now begins a great list of keyboard event handlers # There now begins a great list of keyboard event handlers

View File

@ -23,6 +23,8 @@ class Terminator(Borg):
origcwd = None origcwd = None
doing_layout = None
groupsend = None groupsend = None
groupsend_type = {'all':0, 'group':1, 'off':2} groupsend_type = {'all':0, 'group':1, 'off':2}
@ -48,6 +50,8 @@ class Terminator(Borg):
if not self.keybindings: if not self.keybindings:
self.keybindings = Keybindings() self.keybindings = Keybindings()
self.keybindings.configure(self.config['keybindings']) self.keybindings.configure(self.config['keybindings'])
if not self.doing_layout:
self.doing_layout = False
def register_window(self, window): def register_window(self, window):
"""Register a new window widget""" """Register a new window widget"""
@ -108,6 +112,8 @@ class Terminator(Borg):
layout = None layout = None
objects = {} objects = {}
self.doing_layout = True
layout = self.config.layout_get_config(layoutname) layout = self.config.layout_get_config(layoutname)
if not layout: if not layout:
# User specified a non-existent layout. default to one Terminal # User specified a non-existent layout. default to one Terminal
@ -160,6 +166,14 @@ class Terminator(Borg):
window, terminal = self.new_window() window, terminal = self.new_window()
window.create_layout(layout[windef]) window.create_layout(layout[windef])
def layout_done(self):
"""Layout operations have finished, record that fact"""
self.doing_layout = False
for terminal in self.terminals:
if not terminal.pid:
terminal.spawn_child()
def reconfigure(self): def reconfigure(self):
"""Update configuration for the whole application""" """Update configuration for the whole application"""