Restore the command line -p option to specify a particular profile. This is then enforced as the default for new terminals
This commit is contained in:
parent
622604d9b5
commit
c64d71b809
@ -225,7 +225,7 @@ class Config(object):
|
|||||||
|
|
||||||
def __init__(self, profile='default'):
|
def __init__(self, profile='default'):
|
||||||
self.base = ConfigBase()
|
self.base = ConfigBase()
|
||||||
self.profile = profile
|
self.set_profile(profile)
|
||||||
self.inhibited = False
|
self.inhibited = False
|
||||||
|
|
||||||
def __getitem__(self, key):
|
def __getitem__(self, key):
|
||||||
@ -240,8 +240,12 @@ class Config(object):
|
|||||||
"""Get our profile"""
|
"""Get our profile"""
|
||||||
return(self.profile)
|
return(self.profile)
|
||||||
|
|
||||||
def set_profile(self, profile):
|
def set_profile(self, profile, force=False):
|
||||||
"""Set our profile (which usually means change it)"""
|
"""Set our profile (which usually means change it)"""
|
||||||
|
options = self.options_get()
|
||||||
|
if not force and options and options.profile and profile == 'default':
|
||||||
|
dbg('overriding default profile to %s' % options.profile)
|
||||||
|
profile = options.profile
|
||||||
dbg('Config::set_profile: Changing profile to %s' % profile)
|
dbg('Config::set_profile: Changing profile to %s' % profile)
|
||||||
self.profile = profile
|
self.profile = profile
|
||||||
if not self.base.profiles.has_key(profile):
|
if not self.base.profiles.has_key(profile):
|
||||||
|
@ -66,6 +66,8 @@ command to execute inside the terminal, and its arguments')
|
|||||||
parser.add_option('-r', '--role', dest='role', help='Set a custom \
|
parser.add_option('-r', '--role', dest='role', help='Set a custom \
|
||||||
WM_WINDOW_ROLE property on the window')
|
WM_WINDOW_ROLE property on the window')
|
||||||
parser.add_option('-l', '--layout', dest='layout', help='Select a layout')
|
parser.add_option('-l', '--layout', dest='layout', help='Select a layout')
|
||||||
|
parser.add_option('-p', '--profile', dest='profile', help='Use a \
|
||||||
|
different profile as the default')
|
||||||
parser.add_option('-d', '--debug', action='count', dest='debug',
|
parser.add_option('-d', '--debug', action='count', dest='debug',
|
||||||
help='Enable debugging information (twice for debug server)')
|
help='Enable debugging information (twice for debug server)')
|
||||||
parser.add_option('--debug-classes', action='store', dest='debug_classes',
|
parser.add_option('--debug-classes', action='store', dest='debug_classes',
|
||||||
@ -73,7 +75,7 @@ WM_WINDOW_ROLE property on the window')
|
|||||||
parser.add_option('--debug-methods', action='store', dest='debug_methods',
|
parser.add_option('--debug-methods', action='store', dest='debug_methods',
|
||||||
help='Comma separated list of methods to limit debugging to')
|
help='Comma separated list of methods to limit debugging to')
|
||||||
for item in ['--sm-client-id', '--sm-config-prefix', '--screen', '-n',
|
for item in ['--sm-client-id', '--sm-config-prefix', '--screen', '-n',
|
||||||
'--no-gconf', '-p', '--profile' ]:
|
'--no-gconf' ]:
|
||||||
parser.add_option(item, dest='dummy', action='store',
|
parser.add_option(item, dest='dummy', action='store',
|
||||||
help=SUPPRESS_HELP)
|
help=SUPPRESS_HELP)
|
||||||
|
|
||||||
@ -113,6 +115,9 @@ WM_WINDOW_ROLE property on the window')
|
|||||||
if options.layout is None:
|
if options.layout is None:
|
||||||
options.layout = 'default'
|
options.layout = 'default'
|
||||||
|
|
||||||
|
if options.profile and options.profile not in configobj.list_profiles():
|
||||||
|
options.profile = None
|
||||||
|
|
||||||
configobj.options_set(options)
|
configobj.options_set(options)
|
||||||
|
|
||||||
if util.DEBUG == True:
|
if util.DEBUG == True:
|
||||||
|
@ -159,10 +159,14 @@ class Terminal(gtk.VBox):
|
|||||||
if self.config['http_proxy'] and self.config['http_proxy'] != '':
|
if self.config['http_proxy'] and self.config['http_proxy'] != '':
|
||||||
os.putenv('http_proxy', self.config['http_proxy'])
|
os.putenv('http_proxy', self.config['http_proxy'])
|
||||||
|
|
||||||
def set_profile(self, _widget, profile):
|
def force_set_profile(self, widget, profile):
|
||||||
|
"""Forcibly set our profile"""
|
||||||
|
self.set_profile(widget, profile, True)
|
||||||
|
|
||||||
|
def set_profile(self, _widget, profile, force=False):
|
||||||
"""Set our profile"""
|
"""Set our profile"""
|
||||||
if profile != self.config.get_profile():
|
if profile != self.config.get_profile():
|
||||||
self.config.set_profile(profile)
|
self.config.set_profile(profile, force)
|
||||||
self.reconfigure()
|
self.reconfigure()
|
||||||
|
|
||||||
def get_profile(self):
|
def get_profile(self):
|
||||||
|
@ -172,7 +172,7 @@ class TerminalPopupMenu(object):
|
|||||||
item = gtk.RadioMenuItem(group, profile.capitalize())
|
item = gtk.RadioMenuItem(group, profile.capitalize())
|
||||||
if profile == current:
|
if profile == current:
|
||||||
item.set_active(True)
|
item.set_active(True)
|
||||||
item.connect('activate', terminal.set_profile, profile)
|
item.connect('activate', terminal.force_set_profile, profile)
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
|
||||||
self.add_encoding_items(menu)
|
self.add_encoding_items(menu)
|
||||||
|
Loading…
Reference in New Issue
Block a user