New terminal inherits the current one's profile.

This commit is contained in:
Przemek Wesolek 2011-11-05 16:49:01 +01:00
parent 8163977b68
commit 6d6d73568d
3 changed files with 12 additions and 2 deletions

View File

@ -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"""

View File

@ -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()

View File

@ -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()