From 6d6d73568debe54f2c88d289ebf45afbbede1370 Mon Sep 17 00:00:00 2001 From: Przemek Wesolek Date: Sat, 5 Nov 2011 16:49:01 +0100 Subject: [PATCH 1/3] New terminal inherits the current one's profile. --- terminatorlib/notebook.py | 4 +++- terminatorlib/paned.py | 2 ++ terminatorlib/window.py | 8 +++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index bef0caf9..da8b2fd2 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -195,7 +195,7 @@ class Notebook(Container, gtk.Notebook): children.append(self.get_nth_page(page)) return(children) - def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None): + def newtab(self, debugtab=False, widget=None, cwd=None, metadata=None, profile=None): """Add a new tab, optionally supplying a child widget""" dbg('making a new tab') maker = Factory() @@ -256,6 +256,8 @@ class Notebook(Container, gtk.Notebook): self.show_all() if maker.isinstance(widget, 'Terminal'): widget.grab_focus() + if profile: + widget.force_set_profile(None, profile) def wrapcloseterm(self, widget): """A child terminal has closed""" diff --git a/terminatorlib/paned.py b/terminatorlib/paned.py index 2349a529..44abe25b 100755 --- a/terminatorlib/paned.py +++ b/terminatorlib/paned.py @@ -60,6 +60,8 @@ class Paned(Container): sibling = self.maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if sibling: + sibling.force_set_profile(None, widget.get_profile()) self.add(container) self.show_all() diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 8fb4fbf7..da1b2544 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -219,6 +219,7 @@ class Window(Container, gtk.Window): def tab_new(self, widget=None, debugtab=False, _param1=None, _param2=None): """Make a new tab""" cwd = None + profile = None if self.get_property('term_zoomed') == True: err("You can't create a tab while a terminal is maximised/zoomed") @@ -226,11 +227,13 @@ class Window(Container, gtk.Window): if widget: cwd = widget.get_cwd() + profile = widget.get_profile() + maker = Factory() if not self.is_child_notebook(): dbg('Making a new Notebook') notebook = maker.make('Notebook', window=self) - self.get_child().newtab(debugtab, cwd=cwd) + self.get_child().newtab(debugtab, cwd=cwd, profile=profile) def on_delete_event(self, window, event, data=None): """Handle a window close request""" @@ -425,6 +428,9 @@ class Window(Container, gtk.Window): sibling = maker.make('Terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if sibling: + sibling.force_set_profile(None, widget.get_profile()) + self.add(container) container.show_all() From f5cd4b053d9936bed1f44c19d451367fa609d6a9 Mon Sep 17 00:00:00 2001 From: Przemek Wesolek Date: Sat, 5 Nov 2011 16:58:39 +0100 Subject: [PATCH 2/3] Inheriting profile on a split in tabbed pane. --- terminatorlib/notebook.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index da8b2fd2..1d0ae76f 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -136,6 +136,8 @@ class Notebook(Container, gtk.Notebook): sibling = maker.make('terminal') sibling.set_cwd(cwd) sibling.spawn_child() + if sibling: + sibling.force_set_profile(None, widget.get_profile()) self.insert_page(container, None, page_num) self.set_tab_reorderable(container, True) From cef607817d12d9a64cda62f680c23cce2fa1cd89 Mon Sep 17 00:00:00 2001 From: Przemek Wesolek Date: Wed, 16 Nov 2011 21:38:24 +0100 Subject: [PATCH 3/3] Moved profile setting on new tab a bit earlier, before show_all() call. --- terminatorlib/notebook.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/terminatorlib/notebook.py b/terminatorlib/notebook.py index 1d0ae76f..9c9b20d6 100755 --- a/terminatorlib/notebook.py +++ b/terminatorlib/notebook.py @@ -208,6 +208,8 @@ class Notebook(Container, gtk.Notebook): if cwd: widget.set_cwd(cwd) widget.spawn_child(debugserver=debugtab) + if profile: + widget.force_set_profile(None, profile) signals = {'close-term': self.wrapcloseterm, 'split-horiz': self.split_horiz, @@ -258,8 +260,6 @@ class Notebook(Container, gtk.Notebook): self.show_all() if maker.isinstance(widget, 'Terminal'): widget.grab_focus() - if profile: - widget.force_set_profile(None, profile) def wrapcloseterm(self, widget): """A child terminal has closed"""