Merge a branch from Przemek Wesolek which allows for retaining profile choice across splits/tabs. Closes LP#884329

This commit is contained in:
Chris Jones 2012-10-18 16:56:34 -07:00
commit d1835cecf1
7 changed files with 59 additions and 3 deletions

View File

@ -115,6 +115,11 @@ Controls how much to reduce the colour values of fonts in terminals that do not
factor. A font colour that was RGB(200,200,200) with an inactive_color_offset of 0.5 would set inactive terminals to
RGB(100,100,100).
.TP
.B always_split_with_profile
Controls whether splits/tabs will continue to use the profile of their peer terminal. If set to False, they will always use
the default profile.
Default value: \fBFalse\fR
.TP
.B enabled_plugins
A list of plugins which should be loaded by default. All other plugin classes will be ignored. The default value includes two
plugins related to Launchpad, which are enabled by default to provide continuity with earlier releases where these were the

View File

@ -105,6 +105,7 @@ DEFAULTS = {
'LaunchpadCodeURLHandler',
'APTURLHandler'],
'suppress_multiple_term_dialog': False,
'always_split_with_profile': False,
},
'keybindings': {
'zoom_in' : '<Control>plus',

View File

@ -136,6 +136,8 @@ class Notebook(Container, gtk.Notebook):
sibling = maker.make('terminal')
sibling.set_cwd(cwd)
sibling.spawn_child()
if self.config['always_split_with_profile']:
sibling.force_set_profile(None, widget.get_profile())
self.insert_page(container, None, page_num)
self.set_tab_reorderable(container, True)
@ -195,7 +197,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()
@ -206,6 +208,8 @@ class Notebook(Container, gtk.Notebook):
if cwd:
widget.set_cwd(cwd)
widget.spawn_child(debugserver=debugtab)
if profile and self.config['always_split_with_profile']:
widget.force_set_profile(None, profile)
signals = {'close-term': self.wrapcloseterm,
'split-horiz': self.split_horiz,

View File

@ -50,6 +50,8 @@ class Paned(Container):
sibling = self.maker.make('terminal')
sibling.set_cwd(cwd)
sibling.spawn_child()
if self.config['always_split_with_profile']:
sibling.force_set_profile(None, widget.get_profile())
self.add(container)
self.show_all()

View File

@ -382,7 +382,7 @@
<object class="GtkTable" id="global_config_table">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="n_rows">15</property>
<property name="n_rows">16</property>
<property name="n_columns">2</property>
<property name="column_spacing">6</property>
<child>
@ -857,6 +857,36 @@
<property name="bottom_attach">15</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label34">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Re-use profiles for new terminals</property>
</object>
<packing>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="always_split_with_profile">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_action_appearance">False</property>
<property name="xalign">0</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_always_split_with_profile_toggled" swapped="no"/>
</object>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">15</property>
<property name="bottom_attach">16</property>
<property name="x_options">GTK_EXPAND</property>
<property name="y_options">GTK_EXPAND</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>

View File

@ -238,6 +238,9 @@ class PrefsEditor:
#Hide size text from the title bar
widget = guiget('title_hide_sizetextcheck')
widget.set_active(self.config['title_hide_sizetext'])
#Always split with profile
widget = guiget('always_split_with_profile')
widget.set_active(self.config['always_split_with_profile'])
## Profile tab
# Populate the profile list
@ -610,6 +613,11 @@ class PrefsEditor:
self.config['title_hide_sizetext'] = widget.get_active()
self.config.save()
def on_always_split_with_profile_toggled(self, widget):
"""Always split with profile setting changed"""
self.config['always_split_with_profile'] = widget.get_active()
self.config.save()
def on_allow_bold_checkbutton_toggled(self, widget):
"""Allow bold setting changed"""
self.config['allow_bold'] = widget.get_active()

View File

@ -248,6 +248,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")
@ -255,11 +256,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"""
@ -456,6 +459,9 @@ class Window(Container, gtk.Window):
sibling = maker.make('Terminal')
sibling.set_cwd(cwd)
sibling.spawn_child()
if self.config['always_split_with_profile']:
sibling.force_set_profile(None, widget.get_profile())
self.add(container)
container.show_all()