From 71919fce55b749523b12a13566910fb52957b984 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Wed, 17 Feb 2010 20:57:05 +0100 Subject: [PATCH] Create a layout if requested, otherwise create a default one or just open a window --- terminator | 2 ++ terminatorlib/terminal.py | 8 ++++++++ terminatorlib/terminator.py | 14 ++++++++++++++ 3 files changed, 24 insertions(+) diff --git a/terminator b/terminator index 7cd86a2f..8710c9c4 100755 --- a/terminator +++ b/terminator @@ -59,6 +59,8 @@ if __name__ == '__main__': except (KeyError,ValueError), ex: err('layout creation failed, creating a window ("%s")' % ex) TERMINATOR.new_window() + finally: + TERMINATOR.layout_done() if OPTIONS.debug > 2: import terminatorlib.debugserver as debugserver diff --git a/terminatorlib/terminal.py b/terminatorlib/terminal.py index 3e284c8e..d2f9889c 100755 --- a/terminatorlib/terminal.py +++ b/terminatorlib/terminal.py @@ -1030,6 +1030,10 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) shell = None command = None + if self.terminator.doing_layout == True: + dbg('still laying out, refusing to spawn a child') + return + self.vte.grab_focus() options = self.config.options_get() @@ -1200,6 +1204,10 @@ for %s (%s)' % (name, urlplugin.__class__.__name__)) def create_layout(self, 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 # There now begins a great list of keyboard event handlers diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 471b9880..506fa4a1 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -23,6 +23,8 @@ class Terminator(Borg): origcwd = None + doing_layout = None + groupsend = None groupsend_type = {'all':0, 'group':1, 'off':2} @@ -48,6 +50,8 @@ class Terminator(Borg): if not self.keybindings: self.keybindings = Keybindings() self.keybindings.configure(self.config['keybindings']) + if not self.doing_layout: + self.doing_layout = False def register_window(self, window): """Register a new window widget""" @@ -108,6 +112,8 @@ class Terminator(Borg): layout = None objects = {} + self.doing_layout = True + layout = self.config.layout_get_config(layoutname) if not layout: # User specified a non-existent layout. default to one Terminal @@ -160,6 +166,14 @@ class Terminator(Borg): window, terminal = self.new_window() 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): """Update configuration for the whole application"""