2020-04-05 14:36:06 +00:00
|
|
|
#!/usr/bin/env python
|
2010-01-22 22:53:23 +00:00
|
|
|
"""Preferences Editor for Terminator.
|
|
|
|
|
|
|
|
Load a UIBuilder config file, display it,
|
|
|
|
populate it with our current config, then optionally read that back out and
|
|
|
|
write it to a config file
|
|
|
|
|
|
|
|
"""
|
2008-08-21 23:19:18 +00:00
|
|
|
|
2010-01-09 17:49:14 +00:00
|
|
|
import os
|
2014-09-19 14:10:43 +00:00
|
|
|
from gi.repository import GObject, Gtk, Gdk
|
2009-12-27 00:59:44 +00:00
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
from .util import dbg, err
|
|
|
|
from . import config
|
|
|
|
from .keybindings import Keybindings, KeymapError
|
|
|
|
from .translation import _
|
|
|
|
from .encoding import TerminatorEncoding
|
|
|
|
from .terminator import Terminator
|
|
|
|
from .plugin import PluginRegistry
|
|
|
|
from .version import APP_NAME
|
2008-08-21 23:19:18 +00:00
|
|
|
|
2010-04-13 22:17:52 +00:00
|
|
|
def color2hex(widget):
|
|
|
|
"""Pull the colour values out of a Gtk ColorPicker widget and return them
|
|
|
|
as 8bit hex values, sinces its default behaviour is to give 16bit values"""
|
|
|
|
widcol = widget.get_color()
|
|
|
|
return('#%02x%02x%02x' % (widcol.red>>8, widcol.green>>8, widcol.blue>>8))
|
|
|
|
|
2010-01-10 00:35:38 +00:00
|
|
|
# FIXME: We need to check that we have represented all of Config() below
|
2010-01-03 17:53:25 +00:00
|
|
|
class PrefsEditor:
|
2010-01-22 22:53:23 +00:00
|
|
|
"""Class implementing the various parts of the preferences editor"""
|
2010-01-09 17:42:59 +00:00
|
|
|
config = None
|
2010-06-20 21:41:55 +00:00
|
|
|
registry = None
|
2010-06-21 21:44:09 +00:00
|
|
|
plugins = None
|
2010-01-10 00:20:24 +00:00
|
|
|
keybindings = None
|
2010-01-09 17:42:59 +00:00
|
|
|
window = None
|
2017-06-24 02:02:38 +00:00
|
|
|
calling_window = None
|
|
|
|
term = None
|
2010-01-09 17:42:59 +00:00
|
|
|
builder = None
|
2010-03-05 22:20:48 +00:00
|
|
|
layouteditor = None
|
2010-02-05 00:16:24 +00:00
|
|
|
previous_layout_selection = None
|
2010-01-31 16:24:45 +00:00
|
|
|
previous_profile_selection = None
|
2015-06-19 01:48:12 +00:00
|
|
|
colorschemevalues = {'black_on_yellow': 0,
|
2010-01-08 23:51:45 +00:00
|
|
|
'black_on_white': 1,
|
|
|
|
'grey_on_black': 2,
|
|
|
|
'green_on_black': 3,
|
|
|
|
'white_on_black': 4,
|
|
|
|
'orange_on_black': 5,
|
2010-03-05 12:29:51 +00:00
|
|
|
'ambience': 6,
|
2013-02-16 00:10:45 +00:00
|
|
|
'solarized_light': 7,
|
|
|
|
'solarized_dark': 8,
|
2016-12-07 18:46:21 +00:00
|
|
|
'gruvbox_light': 9,
|
|
|
|
'gruvbox_dark': 10,
|
|
|
|
'custom': 11}
|
2010-04-15 11:31:49 +00:00
|
|
|
colourschemes = {'grey_on_black': ['#aaaaaa', '#000000'],
|
|
|
|
'black_on_yellow': ['#000000', '#ffffdd'],
|
|
|
|
'black_on_white': ['#000000', '#ffffff'],
|
|
|
|
'white_on_black': ['#ffffff', '#000000'],
|
|
|
|
'green_on_black': ['#00ff00', '#000000'],
|
|
|
|
'orange_on_black': ['#e53c00', '#000000'],
|
2013-02-16 00:10:45 +00:00
|
|
|
'ambience': ['#ffffff', '#300a24'],
|
|
|
|
'solarized_light': ['#657b83', '#fdf6e3'],
|
2016-12-07 18:46:21 +00:00
|
|
|
'solarized_dark': ['#839496', '#002b36'],
|
|
|
|
'gruvbox_light': ['#3c3836', '#fbf1c7'],
|
|
|
|
'gruvbox_dark': ['#ebdbb2', '#282828']}
|
2010-04-06 21:36:09 +00:00
|
|
|
palettevalues = {'tango': 0,
|
|
|
|
'linux': 1,
|
|
|
|
'xterm': 2,
|
|
|
|
'rxvt': 3,
|
|
|
|
'ambience': 4,
|
2013-02-16 00:10:45 +00:00
|
|
|
'solarized': 5,
|
2016-12-07 18:46:21 +00:00
|
|
|
'gruvbox_light': 6,
|
|
|
|
'gruvbox_dark': 7,
|
|
|
|
'custom': 8}
|
2010-04-13 22:17:52 +00:00
|
|
|
palettes = {'tango': '#000000:#cc0000:#4e9a06:#c4a000:#3465a4:\
|
|
|
|
#75507b:#06989a:#d3d7cf:#555753:#ef2929:#8ae234:#fce94f:#729fcf:\
|
|
|
|
#ad7fa8:#34e2e2:#eeeeec',
|
|
|
|
'linux': '#000000:#aa0000:#00aa00:#aa5500:#0000aa:\
|
|
|
|
#aa00aa:#00aaaa:#aaaaaa:#555555:#ff5555:#55ff55:#ffff55:#5555ff:\
|
|
|
|
#ff55ff:#55ffff:#ffffff',
|
2015-06-19 01:50:07 +00:00
|
|
|
'xterm': '#000000:#cd0000:#00cd00:#cdcd00:#0000ee:\
|
|
|
|
#cd00cd:#00cdcd:#e5e5e5:#7f7f7f:#ff0000:#00ff00:#ffff00:#5c5cff:\
|
2010-04-13 22:17:52 +00:00
|
|
|
#ff00ff:#00ffff:#ffffff',
|
|
|
|
'rxvt': '#000000:#cd0000:#00cd00:#cdcd00:#0000cd:\
|
|
|
|
#cd00cd:#00cdcd:#faebd7:#404040:#ff0000:#00ff00:#ffff00:#0000ff:\
|
|
|
|
#ff00ff:#00ffff:#ffffff',
|
|
|
|
'ambience': '#2e3436:#cc0000:#4e9a06:#c4a000:\
|
|
|
|
#3465a4:#75507b:#06989a:#d3d7cf:#555753:#ef2929:#8ae234:#fce94f:\
|
2013-02-16 00:10:45 +00:00
|
|
|
#729fcf:#ad7fa8:#34e2e2:#eeeeec',
|
|
|
|
'solarized': '#073642:#dc322f:#859900:#b58900:\
|
|
|
|
#268bd2:#d33682:#2aa198:#eee8d5:#002b36:#cb4b16:#586e75:#657b83:\
|
2016-12-07 18:46:21 +00:00
|
|
|
#839496:#6c71c4:#93a1a1:#fdf6e3',
|
|
|
|
'gruvbox_light': '#fbf1c7:#cc241d:#98971a:#d79921:\
|
|
|
|
#458588:#b16286:#689d6a:#7c6f64:#928374:#9d0006:#79740e:#b57614:\
|
|
|
|
#076678:#8f3f71:#427b58:#3c3836',
|
|
|
|
'gruvbox_dark': '#282828:#cc241d:#98971a:#d79921:\
|
|
|
|
#458588:#b16286:#689d6a:#a89984:#928374:#fb4934:#b8bb26:#fabd2f:\
|
|
|
|
#83a598:#d3869b:#8ec07c:#ebdbb2'}
|
2015-08-03 19:15:28 +00:00
|
|
|
keybindingnames = { 'zoom_in' : _('Increase font size'),
|
|
|
|
'zoom_out' : _('Decrease font size'),
|
|
|
|
'zoom_normal' : _('Restore original font size'),
|
|
|
|
'new_tab' : _('Create a new tab'),
|
|
|
|
'cycle_next' : _('Focus the next terminal'),
|
|
|
|
'cycle_prev' : _('Focus the previous terminal'),
|
|
|
|
'go_next' : _('Focus the next terminal'),
|
|
|
|
'go_prev' : _('Focus the previous terminal'),
|
|
|
|
'go_up' : _('Focus the terminal above'),
|
|
|
|
'go_down' : _('Focus the terminal below'),
|
|
|
|
'go_left' : _('Focus the terminal left'),
|
|
|
|
'go_right' : _('Focus the terminal right'),
|
|
|
|
'rotate_cw' : _('Rotate terminals clockwise'),
|
|
|
|
'rotate_ccw' : _('Rotate terminals counter-clockwise'),
|
|
|
|
'split_horiz' : _('Split horizontally'),
|
|
|
|
'split_vert' : _('Split vertically'),
|
|
|
|
'close_term' : _('Close terminal'),
|
|
|
|
'copy' : _('Copy selected text'),
|
|
|
|
'paste' : _('Paste clipboard'),
|
|
|
|
'toggle_scrollbar' : _('Show/Hide the scrollbar'),
|
|
|
|
'search' : _('Search terminal scrollback'),
|
|
|
|
'page_up' : _('Scroll upwards one page'),
|
|
|
|
'page_down' : _('Scroll downwards one page'),
|
|
|
|
'page_up_half' : _('Scroll upwards half a page'),
|
|
|
|
'page_down_half' : _('Scroll downwards half a page'),
|
|
|
|
'line_up' : _('Scroll upwards one line'),
|
|
|
|
'line_down' : _('Scroll downwards one line'),
|
|
|
|
'close_window' : _('Close window'),
|
|
|
|
'resize_up' : _('Resize the terminal up'),
|
|
|
|
'resize_down' : _('Resize the terminal down'),
|
|
|
|
'resize_left' : _('Resize the terminal left'),
|
|
|
|
'resize_right' : _('Resize the terminal right'),
|
|
|
|
'move_tab_right' : _('Move the tab right'),
|
|
|
|
'move_tab_left' : _('Move the tab left'),
|
2015-11-28 23:39:22 +00:00
|
|
|
'toggle_zoom' : _('Maximize terminal'),
|
2015-08-03 19:15:28 +00:00
|
|
|
'scaled_zoom' : _('Zoom terminal'),
|
|
|
|
'next_tab' : _('Switch to the next tab'),
|
|
|
|
'prev_tab' : _('Switch to the previous tab'),
|
|
|
|
'switch_to_tab_1' : _('Switch to the first tab'),
|
|
|
|
'switch_to_tab_2' : _('Switch to the second tab'),
|
|
|
|
'switch_to_tab_3' : _('Switch to the third tab'),
|
|
|
|
'switch_to_tab_4' : _('Switch to the fourth tab'),
|
|
|
|
'switch_to_tab_5' : _('Switch to the fifth tab'),
|
|
|
|
'switch_to_tab_6' : _('Switch to the sixth tab'),
|
|
|
|
'switch_to_tab_7' : _('Switch to the seventh tab'),
|
|
|
|
'switch_to_tab_8' : _('Switch to the eighth tab'),
|
|
|
|
'switch_to_tab_9' : _('Switch to the ninth tab'),
|
|
|
|
'switch_to_tab_10' : _('Switch to the tenth tab'),
|
|
|
|
'full_screen' : _('Toggle fullscreen'),
|
|
|
|
'reset' : _('Reset the terminal'),
|
|
|
|
'reset_clear' : _('Reset and clear the terminal'),
|
|
|
|
'hide_window' : _('Toggle window visibility'),
|
|
|
|
'group_all' : _('Group all terminals'),
|
|
|
|
'group_all_toggle' : _('Group/Ungroup all terminals'),
|
|
|
|
'ungroup_all' : _('Ungroup all terminals'),
|
|
|
|
'group_tab' : _('Group terminals in tab'),
|
|
|
|
'group_tab_toggle' : _('Group/Ungroup terminals in tab'),
|
|
|
|
'ungroup_tab' : _('Ungroup terminals in tab'),
|
|
|
|
'new_window' : _('Create a new window'),
|
|
|
|
'new_terminator' : _('Spawn a new Terminator process'),
|
|
|
|
'broadcast_off' : _('Don\'t broadcast key presses'),
|
|
|
|
'broadcast_group' : _('Broadcast key presses to group'),
|
|
|
|
'broadcast_all' : _('Broadcast key events to all'),
|
|
|
|
'insert_number' : _('Insert terminal number'),
|
|
|
|
'insert_padded' : _('Insert padded terminal number'),
|
|
|
|
'edit_window_title': _('Edit window title'),
|
2015-11-30 23:57:18 +00:00
|
|
|
'edit_terminal_title': _('Edit terminal title'),
|
|
|
|
'edit_tab_title' : _('Edit tab title'),
|
2015-08-03 19:15:28 +00:00
|
|
|
'layout_launcher' : _('Open layout launcher window'),
|
|
|
|
'next_profile' : _('Switch to next profile'),
|
2015-09-01 20:50:09 +00:00
|
|
|
'previous_profile' : _('Switch to previous profile'),
|
|
|
|
'help' : _('Open the manual')
|
2010-01-10 00:35:38 +00:00
|
|
|
}
|
|
|
|
|
2009-12-27 02:32:16 +00:00
|
|
|
def __init__ (self, term):
|
|
|
|
self.config = config.Config()
|
2013-08-29 17:43:24 +00:00
|
|
|
self.config.base.reload()
|
2009-12-27 02:32:16 +00:00
|
|
|
self.term = term
|
2017-06-24 02:02:38 +00:00
|
|
|
self.calling_window = self.term.get_toplevel()
|
|
|
|
self.calling_window.preventHide = True
|
2014-09-19 14:08:08 +00:00
|
|
|
self.builder = Gtk.Builder()
|
2015-08-03 18:22:15 +00:00
|
|
|
self.builder.set_translation_domain(APP_NAME)
|
2010-01-10 00:20:24 +00:00
|
|
|
self.keybindings = Keybindings()
|
2010-01-08 01:02:49 +00:00
|
|
|
try:
|
2015-06-19 01:48:12 +00:00
|
|
|
# Figure out where our library is on-disk so we can open our
|
2010-01-22 22:53:23 +00:00
|
|
|
(head, _tail) = os.path.split(config.__file__)
|
2010-01-09 17:49:14 +00:00
|
|
|
librarypath = os.path.join(head, 'preferences.glade')
|
|
|
|
gladefile = open(librarypath, 'r')
|
2010-01-08 01:02:49 +00:00
|
|
|
gladedata = gladefile.read()
|
2018-04-24 18:22:10 +00:00
|
|
|
except Exception as ex:
|
|
|
|
print("Failed to find preferences.glade")
|
|
|
|
print(ex)
|
2010-01-08 01:02:49 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
self.builder.add_from_string(gladedata)
|
|
|
|
self.window = self.builder.get_object('prefswin')
|
2013-10-29 13:57:01 +00:00
|
|
|
|
2015-08-03 18:33:10 +00:00
|
|
|
icon_theme = Gtk.IconTheme.get_default()
|
|
|
|
if icon_theme.lookup_icon('terminator-preferences', 48, 0):
|
|
|
|
self.window.set_icon_name('terminator-preferences')
|
|
|
|
else:
|
|
|
|
dbg('Unable to load Terminator preferences icon')
|
2014-09-19 14:08:08 +00:00
|
|
|
icon = self.window.render_icon(Gtk.STOCK_DIALOG_INFO, Gtk.IconSize.BUTTON)
|
2015-08-03 18:33:10 +00:00
|
|
|
self.window.set_icon(icon)
|
2013-10-29 13:57:01 +00:00
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
self.layouteditor = LayoutEditor(self.builder)
|
2010-01-08 01:02:49 +00:00
|
|
|
self.builder.connect_signals(self)
|
2010-03-05 22:20:48 +00:00
|
|
|
self.layouteditor.prepare()
|
2009-12-27 02:32:16 +00:00
|
|
|
self.window.show_all()
|
2010-03-10 12:52:25 +00:00
|
|
|
try:
|
|
|
|
self.config.inhibit_save()
|
|
|
|
self.set_values()
|
2018-04-24 18:22:10 +00:00
|
|
|
except Exception as e:
|
2010-03-10 12:52:25 +00:00
|
|
|
err('Unable to set values: %s' % e)
|
2010-06-03 15:37:58 +00:00
|
|
|
self.config.uninhibit_save()
|
2009-12-27 02:32:16 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_closebutton_clicked(self, _button):
|
2010-01-09 17:42:59 +00:00
|
|
|
"""Close the window"""
|
2010-01-10 23:58:05 +00:00
|
|
|
terminator = Terminator()
|
2010-01-11 10:28:47 +00:00
|
|
|
terminator.reconfigure()
|
2010-01-09 17:42:59 +00:00
|
|
|
self.window.destroy()
|
2017-06-24 02:02:38 +00:00
|
|
|
self.calling_window.preventHide = False
|
2010-01-09 17:42:59 +00:00
|
|
|
del(self)
|
|
|
|
|
2010-01-08 01:02:49 +00:00
|
|
|
def set_values(self):
|
|
|
|
"""Update the preferences window with all the configuration from
|
|
|
|
Config()"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
## Global tab
|
|
|
|
# Mouse focus
|
|
|
|
focus = self.config['focus']
|
|
|
|
active = 0
|
|
|
|
if focus == 'click':
|
|
|
|
active = 1
|
2010-01-13 23:13:19 +00:00
|
|
|
elif focus in ['sloppy', 'mouse']:
|
2010-01-08 01:02:49 +00:00
|
|
|
active = 2
|
|
|
|
widget = guiget('focuscombo')
|
|
|
|
widget.set_active(active)
|
|
|
|
# Terminal separator size
|
|
|
|
termsepsize = self.config['handle_size']
|
|
|
|
widget = guiget('handlesize')
|
2010-01-09 22:27:56 +00:00
|
|
|
widget.set_value(float(termsepsize))
|
2016-12-12 10:29:19 +00:00
|
|
|
widget = guiget('handlesize_value_label')
|
|
|
|
widget.set_text(str(termsepsize))
|
2020-06-21 18:35:50 +00:00
|
|
|
# Line Height
|
|
|
|
lineheightsize = self.config['line_height']
|
|
|
|
lineheightsize = round(float(lineheightsize),1)
|
|
|
|
widget = guiget('lineheight')
|
|
|
|
widget.set_value(lineheightsize)
|
|
|
|
widget = guiget('lineheight_value_label')
|
|
|
|
widget.set_text(str(lineheightsize))
|
2010-01-08 01:02:49 +00:00
|
|
|
# Window geometry hints
|
|
|
|
geomhint = self.config['geometry_hinting']
|
|
|
|
widget = guiget('wingeomcheck')
|
|
|
|
widget.set_active(geomhint)
|
|
|
|
# Window state
|
|
|
|
option = self.config['window_state']
|
|
|
|
if option == 'hidden':
|
|
|
|
active = 1
|
|
|
|
elif option == 'maximise':
|
|
|
|
active = 2
|
|
|
|
elif option == 'fullscreen':
|
|
|
|
active = 3
|
|
|
|
else:
|
|
|
|
active = 0
|
|
|
|
widget = guiget('winstatecombo')
|
|
|
|
widget.set_active(active)
|
|
|
|
# Window borders
|
|
|
|
widget = guiget('winbordercheck')
|
|
|
|
widget.set_active(not self.config['borderless'])
|
2016-12-12 11:27:56 +00:00
|
|
|
# Extra styling
|
|
|
|
widget = guiget('extrastylingcheck')
|
|
|
|
widget.set_active(self.config['extra_styling'])
|
2010-01-08 01:02:49 +00:00
|
|
|
# Tab bar position
|
|
|
|
option = self.config['tab_position']
|
|
|
|
widget = guiget('tabposcombo')
|
|
|
|
if option == 'bottom':
|
|
|
|
active = 1
|
|
|
|
elif option == 'left':
|
|
|
|
active = 2
|
|
|
|
elif option == 'right':
|
|
|
|
active = 3
|
2010-07-03 19:42:33 +00:00
|
|
|
elif option == 'hidden':
|
|
|
|
active = 4
|
2010-01-08 01:02:49 +00:00
|
|
|
else:
|
|
|
|
active = 0
|
|
|
|
widget.set_active(active)
|
2015-06-22 18:06:21 +00:00
|
|
|
# Broadcast default
|
|
|
|
option = self.config['broadcast_default']
|
|
|
|
widget = guiget('broadcastdefault')
|
|
|
|
if option == 'all':
|
|
|
|
active = 0
|
|
|
|
elif option == 'off':
|
|
|
|
active = 2
|
|
|
|
else:
|
|
|
|
active = 1
|
|
|
|
widget.set_active(active)
|
2020-04-29 05:57:15 +00:00
|
|
|
# Disable Ctrl+mousewheel zoom
|
|
|
|
widget = guiget('disablemousewheelzoom')
|
|
|
|
widget.set_active(self.config['disable_mousewheel_zoom'])
|
2011-11-20 12:09:54 +00:00
|
|
|
# scroll_tabbar
|
|
|
|
widget = guiget('scrolltabbarcheck')
|
|
|
|
widget.set_active(self.config['scroll_tabbar'])
|
|
|
|
# homogeneous_tabbar
|
|
|
|
widget = guiget('homogeneouscheck')
|
|
|
|
widget.set_active(self.config['homogeneous_tabbar'])
|
2010-07-21 22:17:34 +00:00
|
|
|
# DBus Server
|
|
|
|
widget = guiget('dbuscheck')
|
|
|
|
widget.set_active(self.config['dbus'])
|
2010-05-15 18:07:07 +00:00
|
|
|
#Hide from taskbar
|
|
|
|
widget = guiget('hidefromtaskbcheck')
|
|
|
|
widget.set_active(self.config['hide_from_taskbar'])
|
|
|
|
#Always on top
|
|
|
|
widget = guiget('alwaysontopcheck')
|
|
|
|
widget.set_active(self.config['always_on_top'])
|
|
|
|
#Hide on lose focus
|
|
|
|
widget = guiget('hideonlosefocuscheck')
|
|
|
|
widget.set_active(self.config['hide_on_lose_focus'])
|
|
|
|
#Show on all workspaces
|
|
|
|
widget = guiget('stickycheck')
|
|
|
|
widget.set_active(self.config['sticky'])
|
2011-08-21 00:07:11 +00:00
|
|
|
#Hide size text from the title bar
|
|
|
|
widget = guiget('title_hide_sizetextcheck')
|
|
|
|
widget.set_active(self.config['title_hide_sizetext'])
|
2012-10-18 23:56:34 +00:00
|
|
|
#Always split with profile
|
|
|
|
widget = guiget('always_split_with_profile')
|
|
|
|
widget.set_active(self.config['always_split_with_profile'])
|
2015-11-30 23:35:06 +00:00
|
|
|
# Putty paste style
|
|
|
|
widget = guiget('putty_paste_style')
|
|
|
|
widget.set_active(self.config['putty_paste_style'])
|
2020-06-19 05:15:13 +00:00
|
|
|
# Putty paste style source clipboard
|
|
|
|
if self.config['putty_paste_style_source_clipboard']:
|
|
|
|
widget = guiget('putty_paste_style_source_clipboard_radiobutton')
|
|
|
|
else:
|
|
|
|
widget = guiget('putty_paste_style_source_primary_radiobutton')
|
|
|
|
widget.set_active(True)
|
2015-11-30 23:35:06 +00:00
|
|
|
# Smart copy
|
|
|
|
widget = guiget('smart_copy')
|
|
|
|
widget.set_active(self.config['smart_copy'])
|
2015-07-10 19:37:35 +00:00
|
|
|
#Titlebar font selector
|
|
|
|
# Use system font
|
|
|
|
widget = guiget('title_system_font_checkbutton')
|
|
|
|
widget.set_active(self.config['title_use_system_font'])
|
|
|
|
self.on_title_system_font_checkbutton_toggled(widget)
|
|
|
|
# Font selector
|
|
|
|
widget = guiget('title_font_selector')
|
|
|
|
if self.config['title_use_system_font'] == True:
|
|
|
|
fontname = self.config.get_system_prop_font()
|
|
|
|
if fontname is not None:
|
|
|
|
widget.set_font_name(fontname)
|
|
|
|
else:
|
|
|
|
widget.set_font_name(self.config['title_font'])
|
2010-01-08 01:02:49 +00:00
|
|
|
|
|
|
|
## Profile tab
|
|
|
|
# Populate the profile list
|
|
|
|
widget = guiget('profilelist')
|
|
|
|
liststore = widget.get_model()
|
|
|
|
profiles = self.config.list_profiles()
|
|
|
|
self.profileiters = {}
|
|
|
|
for profile in profiles:
|
2010-01-30 15:33:37 +00:00
|
|
|
if profile == 'default':
|
|
|
|
editable = False
|
|
|
|
else:
|
|
|
|
editable = True
|
|
|
|
self.profileiters[profile] = liststore.append([profile, editable])
|
2010-01-08 01:02:49 +00:00
|
|
|
selection = widget.get_selection()
|
|
|
|
selection.connect('changed', self.on_profile_selection_changed)
|
|
|
|
selection.select_iter(self.profileiters['default'])
|
|
|
|
|
2010-01-09 17:42:59 +00:00
|
|
|
## Layouts tab
|
2010-02-05 00:16:24 +00:00
|
|
|
widget = guiget('layoutlist')
|
|
|
|
liststore = widget.get_model()
|
|
|
|
layouts = self.config.list_layouts()
|
|
|
|
self.layoutiters = {}
|
|
|
|
for layout in layouts:
|
|
|
|
if layout == 'default':
|
|
|
|
editable = False
|
|
|
|
else:
|
|
|
|
editable = True
|
|
|
|
self.layoutiters[layout] = liststore.append([layout, editable])
|
|
|
|
selection = widget.get_selection()
|
|
|
|
selection.connect('changed', self.on_layout_selection_changed)
|
2015-07-15 00:51:18 +00:00
|
|
|
terminator = Terminator()
|
|
|
|
if terminator.layoutname:
|
|
|
|
layout_to_highlight = terminator.layoutname
|
|
|
|
else:
|
|
|
|
layout_to_highlight = 'default'
|
|
|
|
selection.select_iter(self.layoutiters[layout_to_highlight])
|
2010-03-05 22:20:48 +00:00
|
|
|
# Now set up the selection changed handler for the layout itself
|
|
|
|
widget = guiget('LayoutTreeView')
|
|
|
|
selection = widget.get_selection()
|
|
|
|
selection.connect('changed', self.on_layout_item_selection_changed)
|
2010-01-09 17:42:59 +00:00
|
|
|
|
|
|
|
## Keybindings tab
|
2010-01-10 00:20:24 +00:00
|
|
|
widget = guiget('keybindingtreeview')
|
|
|
|
liststore = widget.get_model()
|
2014-09-19 14:08:08 +00:00
|
|
|
liststore.set_sort_column_id(0, Gtk.SortType.ASCENDING)
|
2010-01-10 00:20:24 +00:00
|
|
|
keybindings = self.config['keybindings']
|
|
|
|
for keybinding in keybindings:
|
|
|
|
keyval = 0
|
|
|
|
mask = 0
|
|
|
|
value = keybindings[keybinding]
|
|
|
|
if value is not None and value != '':
|
|
|
|
try:
|
|
|
|
(keyval, mask) = self.keybindings._parsebinding(value)
|
|
|
|
except KeymapError:
|
|
|
|
pass
|
2015-06-19 01:48:12 +00:00
|
|
|
liststore.append([keybinding, self.keybindingnames[keybinding],
|
2010-01-10 00:35:38 +00:00
|
|
|
keyval, mask])
|
2010-01-09 17:42:59 +00:00
|
|
|
|
|
|
|
## Plugins tab
|
2010-06-20 21:41:55 +00:00
|
|
|
# Populate the plugin list
|
|
|
|
widget = guiget('pluginlist')
|
|
|
|
liststore = widget.get_model()
|
|
|
|
self.registry = PluginRegistry()
|
|
|
|
self.pluginiters = {}
|
2010-06-21 21:44:09 +00:00
|
|
|
pluginlist = self.registry.get_available_plugins()
|
|
|
|
self.plugins = {}
|
|
|
|
for plugin in pluginlist:
|
|
|
|
self.plugins[plugin] = self.registry.is_enabled(plugin)
|
|
|
|
|
|
|
|
for plugin in self.plugins:
|
2010-06-20 21:41:55 +00:00
|
|
|
self.pluginiters[plugin] = liststore.append([plugin,
|
2010-06-21 21:44:09 +00:00
|
|
|
self.plugins[plugin]])
|
2010-06-20 21:41:55 +00:00
|
|
|
selection = widget.get_selection()
|
|
|
|
selection.connect('changed', self.on_plugin_selection_changed)
|
|
|
|
if len(self.pluginiters) > 0:
|
|
|
|
selection.select_iter(liststore.get_iter_first())
|
2010-01-09 17:42:59 +00:00
|
|
|
|
2010-01-08 08:39:21 +00:00
|
|
|
def set_profile_values(self, profile):
|
2010-01-08 01:02:49 +00:00
|
|
|
"""Update the profile values for a given profile"""
|
|
|
|
self.config.set_profile(profile)
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
2010-01-08 08:39:21 +00:00
|
|
|
dbg('PrefsEditor::set_profile_values: Setting profile %s' % profile)
|
|
|
|
|
|
|
|
## General tab
|
|
|
|
# Use system font
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('system_font_checkbutton')
|
2010-01-08 08:39:21 +00:00
|
|
|
widget.set_active(self.config['use_system_font'])
|
2010-01-09 11:52:30 +00:00
|
|
|
self.on_system_font_checkbutton_toggled(widget)
|
2010-01-08 08:39:21 +00:00
|
|
|
# Font selector
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('font_selector')
|
2010-04-02 01:21:18 +00:00
|
|
|
|
2010-01-21 21:39:05 +00:00
|
|
|
if self.config['use_system_font'] == True:
|
2015-07-10 19:37:35 +00:00
|
|
|
fontname = self.config.get_system_mono_font()
|
2010-04-02 14:04:44 +00:00
|
|
|
if fontname is not None:
|
|
|
|
widget.set_font_name(fontname)
|
2010-01-21 21:39:05 +00:00
|
|
|
else:
|
|
|
|
widget.set_font_name(self.config['font'])
|
2010-01-08 08:39:21 +00:00
|
|
|
# Allow bold text
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('allow_bold_checkbutton')
|
2010-01-08 01:02:49 +00:00
|
|
|
widget.set_active(self.config['allow_bold'])
|
2010-02-11 13:45:02 +00:00
|
|
|
# Icon terminal bell
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('icon_bell_checkbutton')
|
2010-02-11 13:45:02 +00:00
|
|
|
widget.set_active(self.config['icon_bell'])
|
2015-09-29 00:24:36 +00:00
|
|
|
# Visual terminal bell
|
|
|
|
widget = guiget('visual_bell_checkbutton')
|
|
|
|
widget.set_active(self.config['visible_bell'])
|
2010-01-08 08:39:21 +00:00
|
|
|
# Audible terminal bell
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('audible_bell_checkbutton')
|
2010-01-08 08:39:21 +00:00
|
|
|
widget.set_active(self.config['audible_bell'])
|
|
|
|
# WM_URGENT terminal bell
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('urgent_bell_checkbutton')
|
2010-01-08 08:39:21 +00:00
|
|
|
widget.set_active(self.config['urgent_bell'])
|
2010-02-09 00:23:21 +00:00
|
|
|
# Show titlebar
|
|
|
|
widget = guiget('show_titlebar')
|
|
|
|
widget.set_active(self.config['show_titlebar'])
|
2010-06-24 20:56:18 +00:00
|
|
|
# Copy on selection
|
|
|
|
widget = guiget('copy_on_selection')
|
|
|
|
widget.set_active(self.config['copy_on_selection'])
|
2015-11-28 19:14:14 +00:00
|
|
|
# Rewrap on resize
|
|
|
|
widget = guiget('rewrap_on_resize_checkbutton')
|
|
|
|
widget.set_active(self.config['rewrap_on_resize'])
|
2015-11-28 19:28:01 +00:00
|
|
|
# Word chars
|
|
|
|
widget = guiget('word_chars_entry')
|
|
|
|
widget.set_text(self.config['word_chars'])
|
|
|
|
# Word char support was missing from vte 0.38, hide from the UI
|
|
|
|
if not hasattr(self.term.vte, 'set_word_char_exceptions'):
|
|
|
|
guiget('word_chars_hbox').hide()
|
2010-01-08 08:39:21 +00:00
|
|
|
# Cursor shape
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('cursor_shape_combobox')
|
2010-01-08 08:39:21 +00:00
|
|
|
if self.config['cursor_shape'] == 'underline':
|
|
|
|
active = 1
|
|
|
|
elif self.config['cursor_shape'] == 'ibeam':
|
|
|
|
active = 2
|
|
|
|
else:
|
|
|
|
active = 0
|
|
|
|
widget.set_active(active)
|
2010-02-08 22:10:59 +00:00
|
|
|
# Cursor blink
|
|
|
|
widget = guiget('cursor_blink')
|
|
|
|
widget.set_active(self.config['cursor_blink'])
|
2015-12-03 14:37:16 +00:00
|
|
|
# Cursor colour - Radio values
|
|
|
|
if self.config['cursor_color_fg']:
|
|
|
|
widget = guiget('cursor_color_foreground_radiobutton')
|
|
|
|
else:
|
|
|
|
widget = guiget('cursor_color_custom_radiobutton')
|
|
|
|
widget.set_active(True)
|
|
|
|
# Cursor colour - swatch
|
2010-02-08 22:10:59 +00:00
|
|
|
widget = guiget('cursor_color')
|
2015-12-03 14:37:16 +00:00
|
|
|
widget.set_sensitive(not self.config['cursor_color_fg'])
|
2012-03-06 09:19:52 +00:00
|
|
|
try:
|
2014-09-19 14:10:43 +00:00
|
|
|
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
2015-12-03 14:37:16 +00:00
|
|
|
except (ValueError, TypeError):
|
|
|
|
try:
|
|
|
|
self.config['cursor_color'] = self.config['foreground_color']
|
|
|
|
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
|
|
except ValueError:
|
|
|
|
self.config['cursor_color'] = "#FFFFFF"
|
|
|
|
widget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
2010-01-08 08:39:21 +00:00
|
|
|
|
2010-01-09 11:52:30 +00:00
|
|
|
## Command tab
|
2010-01-08 23:51:45 +00:00
|
|
|
# Login shell
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('login_shell_checkbutton')
|
2010-01-08 23:51:45 +00:00
|
|
|
widget.set_active(self.config['login_shell'])
|
|
|
|
# Use Custom command
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('use_custom_command_checkbutton')
|
2010-01-08 23:51:45 +00:00
|
|
|
widget.set_active(self.config['use_custom_command'])
|
2010-01-09 11:52:30 +00:00
|
|
|
self.on_use_custom_command_checkbutton_toggled(widget)
|
2010-01-08 23:51:45 +00:00
|
|
|
# Custom Command
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('custom_command_entry')
|
2010-01-08 23:51:45 +00:00
|
|
|
widget.set_text(self.config['custom_command'])
|
|
|
|
# Exit action
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('exit_action_combobox')
|
2010-01-08 23:51:45 +00:00
|
|
|
if self.config['exit_action'] == 'restart':
|
|
|
|
widget.set_active(1)
|
|
|
|
elif self.config['exit_action'] == 'hold':
|
|
|
|
widget.set_active(2)
|
|
|
|
else:
|
|
|
|
# Default is to close the terminal
|
|
|
|
widget.set_active(0)
|
|
|
|
|
|
|
|
## Colors tab
|
|
|
|
# Use system colors
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('use_theme_colors_checkbutton')
|
2010-01-08 23:51:45 +00:00
|
|
|
widget.set_active(self.config['use_theme_colors'])
|
2020-04-25 18:22:51 +00:00
|
|
|
# Bold is bright
|
|
|
|
widget = guiget('bold_text_is_bright_checkbutton')
|
|
|
|
widget.set_active(self.config['bold_is_bright'])
|
2010-01-08 23:51:45 +00:00
|
|
|
# Colorscheme
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('color_scheme_combobox')
|
2010-04-06 21:36:09 +00:00
|
|
|
scheme = None
|
2010-04-06 11:36:45 +00:00
|
|
|
for ascheme in self.colourschemes:
|
|
|
|
forecol = self.colourschemes[ascheme][0]
|
|
|
|
backcol = self.colourschemes[ascheme][1]
|
2010-04-15 11:31:49 +00:00
|
|
|
if self.config['foreground_color'].lower() == forecol and \
|
|
|
|
self.config['background_color'].lower() == backcol:
|
2010-04-06 11:36:45 +00:00
|
|
|
scheme = ascheme
|
|
|
|
break
|
2010-01-08 23:51:45 +00:00
|
|
|
if scheme not in self.colorschemevalues:
|
2010-04-15 11:22:54 +00:00
|
|
|
if self.config['foreground_color'] in [None, ''] or \
|
|
|
|
self.config['background_color'] in [None, '']:
|
|
|
|
scheme = 'grey_on_black'
|
|
|
|
else:
|
|
|
|
scheme = 'custom'
|
|
|
|
# NOTE: The scheme is set in the GUI widget after the fore/back colours
|
2010-01-08 23:51:45 +00:00
|
|
|
# Foreground color
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('foreground_colorpicker')
|
2014-09-19 14:10:43 +00:00
|
|
|
widget.set_color(Gdk.color_parse(self.config['foreground_color']))
|
2010-01-08 23:51:45 +00:00
|
|
|
if scheme == 'custom':
|
|
|
|
widget.set_sensitive(True)
|
|
|
|
else:
|
|
|
|
widget.set_sensitive(False)
|
|
|
|
# Background color
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('background_colorpicker')
|
2014-09-19 14:10:43 +00:00
|
|
|
widget.set_color(Gdk.color_parse(self.config['background_color']))
|
2010-01-08 23:51:45 +00:00
|
|
|
if scheme == 'custom':
|
|
|
|
widget.set_sensitive(True)
|
|
|
|
else:
|
|
|
|
widget.set_sensitive(False)
|
2010-04-15 11:22:54 +00:00
|
|
|
# Now actually set the scheme
|
|
|
|
widget = guiget('color_scheme_combobox')
|
|
|
|
widget.set_active(self.colorschemevalues[scheme])
|
2010-04-06 21:36:09 +00:00
|
|
|
# Palette scheme
|
|
|
|
widget = guiget('palette_combobox')
|
|
|
|
palette = None
|
|
|
|
for apalette in self.palettes:
|
2010-04-15 11:31:49 +00:00
|
|
|
if self.config['palette'].lower() == self.palettes[apalette]:
|
2010-04-06 21:36:09 +00:00
|
|
|
palette = apalette
|
|
|
|
if palette not in self.palettevalues:
|
2010-04-15 11:31:49 +00:00
|
|
|
if self.config['palette'] in [None, '']:
|
|
|
|
palette = 'rxvt'
|
|
|
|
else:
|
|
|
|
palette = 'custom'
|
|
|
|
# NOTE: The palette selector is set after the colour pickers
|
2010-04-06 21:36:09 +00:00
|
|
|
# Palette colour pickers
|
2010-04-15 11:31:49 +00:00
|
|
|
colourpalette = self.config['palette'].split(':')
|
2018-04-24 18:22:10 +00:00
|
|
|
for i in range(1, 17):
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('palette_colorpicker_%d' % i)
|
2014-09-19 14:10:43 +00:00
|
|
|
widget.set_color(Gdk.color_parse(colourpalette[i - 1]))
|
2010-04-15 11:31:49 +00:00
|
|
|
# Now set the palette selector widget
|
|
|
|
widget = guiget('palette_combobox')
|
|
|
|
widget.set_active(self.palettevalues[palette])
|
2010-02-08 20:22:08 +00:00
|
|
|
# Titlebar colors
|
|
|
|
for bit in ['title_transmit_fg_color', 'title_transmit_bg_color',
|
|
|
|
'title_receive_fg_color', 'title_receive_bg_color',
|
|
|
|
'title_inactive_fg_color', 'title_inactive_bg_color']:
|
|
|
|
widget = guiget(bit)
|
2014-09-19 14:10:43 +00:00
|
|
|
widget.set_color(Gdk.color_parse(self.config[bit]))
|
2015-06-19 01:48:12 +00:00
|
|
|
# Inactive terminal shading
|
2011-10-07 00:20:54 +00:00
|
|
|
widget = guiget('inactive_color_offset')
|
|
|
|
widget.set_value(float(self.config['inactive_color_offset']))
|
2016-12-12 10:29:19 +00:00
|
|
|
widget = guiget('inactive_color_offset_value_label')
|
|
|
|
widget.set_text('%d%%' % (int(float(self.config['inactive_color_offset'])*100)))
|
2012-01-14 20:39:00 +00:00
|
|
|
# Use custom URL handler
|
|
|
|
widget = guiget('use_custom_url_handler_checkbox')
|
|
|
|
widget.set_active(self.config['use_custom_url_handler'])
|
|
|
|
self.on_use_custom_url_handler_checkbutton_toggled(widget)
|
|
|
|
# Custom URL handler
|
|
|
|
widget = guiget('custom_url_handler_entry')
|
|
|
|
widget.set_text(self.config['custom_url_handler'])
|
2010-01-09 00:47:49 +00:00
|
|
|
|
|
|
|
## Background tab
|
|
|
|
# Radio values
|
2010-01-22 18:39:09 +00:00
|
|
|
if self.config['background_type'] == 'solid':
|
2010-03-06 11:09:32 +00:00
|
|
|
guiget('solid_radiobutton').set_active(True)
|
2010-01-22 18:39:09 +00:00
|
|
|
elif self.config['background_type'] == 'transparent':
|
2010-03-06 11:09:32 +00:00
|
|
|
guiget('transparent_radiobutton').set_active(True)
|
2010-01-09 00:47:49 +00:00
|
|
|
self.update_background_tab()
|
|
|
|
# Background shading
|
|
|
|
widget = guiget('background_darkness_scale')
|
2010-01-09 22:27:56 +00:00
|
|
|
widget.set_value(float(self.config['background_darkness']))
|
2010-01-09 00:47:49 +00:00
|
|
|
|
|
|
|
## Scrolling tab
|
|
|
|
# Scrollbar position
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('scrollbar_position_combobox')
|
2010-01-09 00:47:49 +00:00
|
|
|
value = self.config['scrollbar_position']
|
|
|
|
if value == 'left':
|
|
|
|
widget.set_active(0)
|
2010-01-13 23:13:19 +00:00
|
|
|
elif value in ['disabled', 'hidden']:
|
2010-01-09 00:47:49 +00:00
|
|
|
widget.set_active(2)
|
|
|
|
else:
|
|
|
|
widget.set_active(1)
|
|
|
|
# Scrollback lines
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('scrollback_lines_spinbutton')
|
2010-01-09 00:47:49 +00:00
|
|
|
widget.set_value(self.config['scrollback_lines'])
|
2010-03-24 13:22:37 +00:00
|
|
|
# Scrollback infinite
|
|
|
|
widget = guiget('scrollback_infinite')
|
|
|
|
widget.set_active(self.config['scrollback_infinite'])
|
2010-01-09 00:47:49 +00:00
|
|
|
# Scroll on outut
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('scroll_on_output_checkbutton')
|
2010-01-09 00:47:49 +00:00
|
|
|
widget.set_active(self.config['scroll_on_output'])
|
|
|
|
# Scroll on keystroke
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('scroll_on_keystroke_checkbutton')
|
2010-01-09 00:47:49 +00:00
|
|
|
widget.set_active(self.config['scroll_on_keystroke'])
|
|
|
|
|
|
|
|
## Compatibility tab
|
|
|
|
# Backspace key
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('backspace_binding_combobox')
|
2010-01-09 00:47:49 +00:00
|
|
|
value = self.config['backspace_binding']
|
|
|
|
if value == 'control-h':
|
2010-01-24 15:45:47 +00:00
|
|
|
widget.set_active(1)
|
|
|
|
elif value == 'ascii-del':
|
2010-01-09 00:47:49 +00:00
|
|
|
widget.set_active(2)
|
2010-01-24 15:45:47 +00:00
|
|
|
elif value == 'escape-sequence':
|
|
|
|
widget.set_active(3)
|
2010-01-09 00:47:49 +00:00
|
|
|
else:
|
2010-01-24 15:45:47 +00:00
|
|
|
widget.set_active(0)
|
2010-01-09 11:52:30 +00:00
|
|
|
# Delete key
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('delete_binding_combobox')
|
2010-01-09 11:52:30 +00:00
|
|
|
value = self.config['delete_binding']
|
|
|
|
if value == 'control-h':
|
|
|
|
widget.set_active(1)
|
2010-01-24 15:45:47 +00:00
|
|
|
elif value == 'ascii-del':
|
2010-01-09 17:42:59 +00:00
|
|
|
widget.set_active(2)
|
2010-01-24 15:45:47 +00:00
|
|
|
elif value == 'escape-sequence':
|
|
|
|
widget.set_active(3)
|
|
|
|
else:
|
|
|
|
widget.set_active(0)
|
2010-06-23 11:03:04 +00:00
|
|
|
# Encoding
|
|
|
|
rowiter = None
|
|
|
|
widget = guiget('encoding_combobox')
|
|
|
|
encodingstore = guiget('EncodingListStore')
|
|
|
|
value = self.config['encoding']
|
|
|
|
encodings = TerminatorEncoding().get_list()
|
2018-04-24 18:22:10 +00:00
|
|
|
encodings.sort(key=lambda x: x[2].lower())
|
2010-06-23 11:03:04 +00:00
|
|
|
|
|
|
|
for encoding in encodings:
|
|
|
|
if encoding[1] is None:
|
|
|
|
continue
|
2015-06-19 01:48:12 +00:00
|
|
|
|
2010-06-23 11:03:04 +00:00
|
|
|
label = "%s %s" % (encoding[2], encoding[1])
|
|
|
|
rowiter = encodingstore.append([label, encoding[1]])
|
|
|
|
|
|
|
|
if encoding[1] == value:
|
|
|
|
widget.set_active_iter(rowiter)
|
2010-01-09 11:52:30 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def set_layout(self, layout_name):
|
|
|
|
"""Set a layout"""
|
|
|
|
self.layouteditor.set_layout(layout_name)
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_wingeomcheck_toggled(self, widget):
|
|
|
|
"""Window geometry setting changed"""
|
|
|
|
self.config['geometry_hinting'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2011-11-20 12:09:54 +00:00
|
|
|
def on_homogeneous_toggled(self, widget):
|
|
|
|
"""homogeneous_tabbar setting changed"""
|
2013-08-01 15:30:18 +00:00
|
|
|
guiget = self.builder.get_object
|
2011-11-20 12:09:54 +00:00
|
|
|
self.config['homogeneous_tabbar'] = widget.get_active()
|
2013-08-01 15:30:18 +00:00
|
|
|
scroll_toggled = guiget('scrolltabbarcheck')
|
|
|
|
if widget.get_active():
|
|
|
|
scroll_toggled.set_sensitive(True)
|
|
|
|
else:
|
|
|
|
scroll_toggled.set_active(True)
|
|
|
|
scroll_toggled.set_sensitive(False)
|
2011-11-20 12:09:54 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_scroll_toggled(self, widget):
|
|
|
|
"""scroll_tabbar setting changed"""
|
|
|
|
self.config['scroll_tabbar'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-07-21 22:17:34 +00:00
|
|
|
def on_dbuscheck_toggled(self, widget):
|
|
|
|
"""DBus server setting changed"""
|
|
|
|
self.config['dbus'] = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
2020-04-29 05:57:15 +00:00
|
|
|
def on_disable_mousewheel_zoom_toggled(self, widget):
|
|
|
|
"""Ctrl+mousewheel zoom setting changed"""
|
|
|
|
self.config['disable_mousewheel_zoom'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_winbordercheck_toggled(self, widget):
|
|
|
|
"""Window border setting changed"""
|
|
|
|
self.config['borderless'] = not widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2016-12-12 11:27:56 +00:00
|
|
|
def on_extrastylingcheck_toggled(self, widget):
|
|
|
|
"""Extra styling setting changed"""
|
|
|
|
self.config['extra_styling'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-05-15 18:07:07 +00:00
|
|
|
def on_hidefromtaskbcheck_toggled(self, widget):
|
|
|
|
"""Hide from taskbar setting changed"""
|
|
|
|
self.config['hide_from_taskbar'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_alwaysontopcheck_toggled(self, widget):
|
|
|
|
"""Always on top setting changed"""
|
|
|
|
self.config['always_on_top'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_hideonlosefocuscheck_toggled(self, widget):
|
|
|
|
"""Hide on lose focus setting changed"""
|
|
|
|
self.config['hide_on_lose_focus'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_stickycheck_toggled(self, widget):
|
|
|
|
"""Sticky setting changed"""
|
|
|
|
self.config['sticky'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2011-08-21 00:07:11 +00:00
|
|
|
def on_title_hide_sizetextcheck_toggled(self, widget):
|
|
|
|
"""Window geometry setting changed"""
|
|
|
|
self.config['title_hide_sizetext'] = widget.get_active()
|
2015-06-19 01:48:12 +00:00
|
|
|
self.config.save()
|
2011-08-21 00:07:11 +00:00
|
|
|
|
2012-10-18 23:56:34 +00:00
|
|
|
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()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_allow_bold_checkbutton_toggled(self, widget):
|
|
|
|
"""Allow bold setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
self.config['allow_bold'] = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_show_titlebar_toggled(self, widget):
|
|
|
|
"""Show titlebar setting changed"""
|
|
|
|
self.config['show_titlebar'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-06-24 20:56:18 +00:00
|
|
|
def on_copy_on_selection_toggled(self, widget):
|
|
|
|
"""Copy on selection setting changed"""
|
|
|
|
self.config['copy_on_selection'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2015-11-28 19:14:14 +00:00
|
|
|
def on_rewrap_on_resize_toggled(self, widget):
|
|
|
|
"""Rewrap on resize setting changed"""
|
|
|
|
self.config['rewrap_on_resize'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2015-11-30 21:23:23 +00:00
|
|
|
def on_putty_paste_style_toggled(self, widget):
|
|
|
|
"""Putty paste style setting changed"""
|
|
|
|
self.config['putty_paste_style'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2020-06-19 05:15:13 +00:00
|
|
|
def on_putty_paste_style_source_clipboard_toggled(self, widget):
|
|
|
|
"""PuTTY paste style source changed"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
clipboardwidget = guiget('putty_paste_style_source_clipboard_radiobutton')
|
|
|
|
self.config['putty_paste_style_source_clipboard'] = clipboardwidget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2015-11-30 23:35:06 +00:00
|
|
|
def on_smart_copy_toggled(self, widget):
|
|
|
|
"""Putty paste style setting changed"""
|
|
|
|
self.config['smart_copy'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_cursor_blink_toggled(self, widget):
|
|
|
|
"""Cursor blink setting changed"""
|
|
|
|
self.config['cursor_blink'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_icon_bell_checkbutton_toggled(self, widget):
|
|
|
|
"""Icon bell setting changed"""
|
2010-02-11 13:45:02 +00:00
|
|
|
self.config['icon_bell'] = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
2015-09-29 00:24:36 +00:00
|
|
|
def on_visual_bell_checkbutton_toggled(self, widget):
|
|
|
|
"""Visual bell setting changed"""
|
|
|
|
self.config['visible_bell'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_audible_bell_checkbutton_toggled(self, widget):
|
|
|
|
"""Audible bell setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
self.config['audible_bell'] = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_urgent_bell_checkbutton_toggled(self, widget):
|
|
|
|
"""Window manager bell setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
self.config['urgent_bell'] = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_login_shell_checkbutton_toggled(self, widget):
|
|
|
|
"""Login shell setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
self.config['login_shell'] = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_scroll_background_checkbutton_toggled(self, widget):
|
|
|
|
"""Scroll background setting changed"""
|
|
|
|
self.config['scroll_background'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_scroll_on_keystroke_checkbutton_toggled(self, widget):
|
|
|
|
"""Scroll on keystrong setting changed"""
|
|
|
|
self.config['scroll_on_keystroke'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_scroll_on_output_checkbutton_toggled(self, widget):
|
|
|
|
"""Scroll on output setting changed"""
|
|
|
|
self.config['scroll_on_output'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_delete_binding_combobox_changed(self, widget):
|
|
|
|
"""Delete binding setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
selected = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
if selected == 1:
|
|
|
|
value = 'control-h'
|
2010-01-09 15:51:56 +00:00
|
|
|
elif selected == 2:
|
2010-03-09 13:09:07 +00:00
|
|
|
value = 'ascii-del'
|
|
|
|
elif selected == 3:
|
|
|
|
value = 'escape-sequence'
|
|
|
|
else:
|
|
|
|
value = 'automatic'
|
|
|
|
self.config['delete_binding'] = value
|
|
|
|
self.config.save()
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_backspace_binding_combobox_changed(self, widget):
|
|
|
|
"""Backspace binding setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
selected = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
if selected == 1:
|
|
|
|
value = 'control-h'
|
2010-01-09 15:51:56 +00:00
|
|
|
elif selected == 2:
|
2010-03-09 13:09:07 +00:00
|
|
|
value = 'ascii-del'
|
2010-01-09 15:51:56 +00:00
|
|
|
elif selected == 3:
|
2020-06-23 13:08:17 +00:00
|
|
|
value = 'escape-sequence'
|
2010-03-09 13:09:07 +00:00
|
|
|
else:
|
|
|
|
value = 'automatic'
|
|
|
|
self.config['backspace_binding'] = value
|
|
|
|
self.config.save()
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2010-06-23 11:03:04 +00:00
|
|
|
def on_encoding_combobox_changed(self, widget):
|
|
|
|
"""Encoding setting changed"""
|
|
|
|
selected = widget.get_active_iter()
|
|
|
|
liststore = widget.get_model()
|
|
|
|
value = liststore.get_value(selected, 1)
|
|
|
|
|
|
|
|
self.config['encoding'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_scrollback_lines_spinbutton_value_changed(self, widget):
|
|
|
|
"""Scrollback lines setting changed"""
|
|
|
|
value = widget.get_value_as_int()
|
|
|
|
self.config['scrollback_lines'] = value
|
|
|
|
self.config.save()
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2010-03-24 13:22:37 +00:00
|
|
|
def on_scrollback_infinite_toggled(self, widget):
|
|
|
|
"""Scrollback infiniteness changed"""
|
|
|
|
spinbutton = self.builder.get_object('scrollback_lines_spinbutton')
|
|
|
|
value = widget.get_active()
|
|
|
|
if value == True:
|
|
|
|
spinbutton.set_sensitive(False)
|
|
|
|
else:
|
|
|
|
spinbutton.set_sensitive(True)
|
|
|
|
self.config['scrollback_infinite'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_scrollbar_position_combobox_changed(self, widget):
|
|
|
|
"""Scrollbar position setting changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
selected = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
if selected == 1:
|
2010-01-09 15:51:56 +00:00
|
|
|
value = 'right'
|
2010-01-13 23:13:19 +00:00
|
|
|
elif selected == 2:
|
2010-01-09 15:51:56 +00:00
|
|
|
value = 'hidden'
|
2010-03-09 13:09:07 +00:00
|
|
|
else:
|
|
|
|
value = 'left'
|
2010-01-09 15:51:56 +00:00
|
|
|
self.config['scrollbar_position'] = value
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2016-12-12 18:07:08 +00:00
|
|
|
def on_darken_background_scale_value_changed(self, widget):
|
2010-03-09 13:09:07 +00:00
|
|
|
"""Background darkness setting changed"""
|
2015-11-29 18:33:52 +00:00
|
|
|
value = widget.get_value() # This one is rounded according to the UI.
|
|
|
|
if value > 1.0:
|
|
|
|
value = 1.0
|
|
|
|
self.config['background_darkness'] = value
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_palette_combobox_changed(self, widget):
|
|
|
|
"""Palette selector changed"""
|
2010-04-06 21:36:09 +00:00
|
|
|
value = None
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
active = widget.get_active()
|
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
for key in list(self.palettevalues.keys()):
|
2010-04-06 21:36:09 +00:00
|
|
|
if self.palettevalues[key] == active:
|
|
|
|
value = key
|
|
|
|
|
|
|
|
if value == 'custom':
|
|
|
|
sensitive = True
|
|
|
|
else:
|
|
|
|
sensitive = False
|
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
for num in range(1, 17):
|
2010-04-06 21:36:09 +00:00
|
|
|
picker = guiget('palette_colorpicker_%d' % num)
|
|
|
|
picker.set_sensitive(sensitive)
|
|
|
|
|
|
|
|
if value in self.palettes:
|
|
|
|
palette = self.palettes[value]
|
|
|
|
palettebits = palette.split(':')
|
2018-04-24 18:22:10 +00:00
|
|
|
for num in range(1, 17):
|
2010-04-06 21:36:09 +00:00
|
|
|
# Update the visible elements
|
|
|
|
picker = guiget('palette_colorpicker_%d' % num)
|
2014-09-19 14:10:43 +00:00
|
|
|
picker.set_color(Gdk.color_parse(palettebits[num - 1]))
|
2010-04-06 21:36:09 +00:00
|
|
|
elif value == 'custom':
|
|
|
|
palettebits = []
|
2018-04-24 18:22:10 +00:00
|
|
|
for num in range(1, 17):
|
2010-04-06 21:36:09 +00:00
|
|
|
picker = guiget('palette_colorpicker_%d' % num)
|
2010-04-13 22:17:52 +00:00
|
|
|
palettebits.append(color2hex(picker))
|
2010-04-06 21:36:09 +00:00
|
|
|
palette = ':'.join(palettebits)
|
|
|
|
else:
|
|
|
|
err('Unknown palette value: %s' % value)
|
|
|
|
return
|
|
|
|
|
|
|
|
self.config['palette'] = palette
|
|
|
|
self.config.save()
|
2010-03-09 13:09:07 +00:00
|
|
|
|
|
|
|
def on_background_colorpicker_color_set(self, widget):
|
|
|
|
"""Background color changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['background_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_foreground_colorpicker_color_set(self, widget):
|
|
|
|
"""Foreground color changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['foreground_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
2010-04-06 21:36:09 +00:00
|
|
|
def on_palette_colorpicker_color_set(self, widget):
|
|
|
|
"""A palette colour changed"""
|
|
|
|
palette = None
|
|
|
|
palettebits = []
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
# FIXME: We do this at least once elsewhere. refactor!
|
2018-04-24 18:22:10 +00:00
|
|
|
for num in range(1, 17):
|
2010-04-06 21:36:09 +00:00
|
|
|
picker = guiget('palette_colorpicker_%d' % num)
|
2010-04-13 22:17:52 +00:00
|
|
|
value = color2hex(picker)
|
|
|
|
palettebits.append(value)
|
2010-04-06 21:36:09 +00:00
|
|
|
palette = ':'.join(palettebits)
|
|
|
|
|
|
|
|
self.config['palette'] = palette
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_exit_action_combobox_changed(self, widget):
|
|
|
|
"""Exit action changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
selected = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
if selected == 1:
|
|
|
|
value = 'restart'
|
2010-01-09 15:51:56 +00:00
|
|
|
elif selected == 2:
|
2010-03-09 13:09:07 +00:00
|
|
|
value = 'hold'
|
|
|
|
else:
|
|
|
|
value = 'close'
|
|
|
|
self.config['exit_action'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
2012-01-14 20:39:00 +00:00
|
|
|
def on_custom_url_handler_entry_changed(self, widget):
|
|
|
|
"""Custom URL handler value changed"""
|
|
|
|
self.config['custom_url_handler'] = widget.get_text()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-04-13 11:52:16 +00:00
|
|
|
def on_custom_command_entry_changed(self, widget):
|
2010-03-09 13:09:07 +00:00
|
|
|
"""Custom command value changed"""
|
|
|
|
self.config['custom_command'] = widget.get_text()
|
|
|
|
self.config.save()
|
|
|
|
|
2015-12-03 14:37:16 +00:00
|
|
|
def on_cursor_color_type_toggled(self, widget):
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
customwidget = guiget('cursor_color_custom_radiobutton')
|
|
|
|
colorwidget = guiget('cursor_color')
|
|
|
|
|
|
|
|
colorwidget.set_sensitive(customwidget.get_active())
|
|
|
|
self.config['cursor_color_fg'] = not customwidget.get_active()
|
|
|
|
|
|
|
|
try:
|
|
|
|
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
|
|
except (ValueError, TypeError):
|
|
|
|
try:
|
|
|
|
self.config['cursor_color'] = self.config['foreground_color']
|
|
|
|
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
|
|
except ValueError:
|
|
|
|
self.config['cursor_color'] = "#FFFFFF"
|
|
|
|
colorwidget.set_color(Gdk.color_parse(self.config['cursor_color']))
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_cursor_color_color_set(self, widget):
|
|
|
|
"""Cursor colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['cursor_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_cursor_shape_combobox_changed(self, widget):
|
|
|
|
"""Cursor shape changed"""
|
2010-01-09 15:51:56 +00:00
|
|
|
selected = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
if selected == 1:
|
|
|
|
value = 'underline'
|
2010-01-09 15:51:56 +00:00
|
|
|
elif selected == 2:
|
2010-03-09 13:09:07 +00:00
|
|
|
value = 'ibeam'
|
|
|
|
else:
|
|
|
|
value = 'block'
|
|
|
|
self.config['cursor_shape'] = value
|
|
|
|
self.config.save()
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2015-11-28 19:28:01 +00:00
|
|
|
def on_word_chars_entry_changed(self, widget):
|
|
|
|
"""Word characters changed"""
|
|
|
|
self.config['word_chars'] = widget.get_text()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_font_selector_font_set(self, widget):
|
|
|
|
"""Font changed"""
|
|
|
|
self.config['font'] = widget.get_font_name()
|
|
|
|
self.config.save()
|
|
|
|
|
2015-07-10 19:37:35 +00:00
|
|
|
def on_title_font_selector_font_set(self, widget):
|
|
|
|
"""Titlebar Font changed"""
|
|
|
|
self.config['title_font'] = widget.get_font_name()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_title_receive_bg_color_color_set(self, widget):
|
|
|
|
"""Title receive background colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['title_receive_bg_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_title_receive_fg_color_color_set(self, widget):
|
|
|
|
"""Title receive foreground colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['title_receive_fg_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_title_inactive_bg_color_color_set(self, widget):
|
|
|
|
"""Title inactive background colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['title_inactive_bg_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_title_transmit_bg_color_color_set(self, widget):
|
|
|
|
"""Title transmit backgruond colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['title_transmit_bg_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_title_inactive_fg_color_color_set(self, widget):
|
|
|
|
"""Title inactive foreground colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['title_inactive_fg_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_title_transmit_fg_color_color_set(self, widget):
|
|
|
|
"""Title transmit foreground colour changed"""
|
2010-04-13 22:17:52 +00:00
|
|
|
self.config['title_transmit_fg_color'] = color2hex(widget)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
|
|
|
|
2016-12-12 18:07:08 +00:00
|
|
|
def on_inactive_color_offset_value_changed(self, widget):
|
2011-10-07 00:20:54 +00:00
|
|
|
"""Inactive color offset setting changed"""
|
2015-11-29 18:33:52 +00:00
|
|
|
value = widget.get_value() # This one is rounded according to the UI.
|
2013-05-11 22:03:46 +00:00
|
|
|
if value > 1.0:
|
|
|
|
value = 1.0
|
2015-11-29 18:33:52 +00:00
|
|
|
self.config['inactive_color_offset'] = value
|
2011-10-07 00:20:54 +00:00
|
|
|
self.config.save()
|
2016-12-12 10:29:19 +00:00
|
|
|
guiget = self.builder.get_object
|
|
|
|
label_widget = guiget('inactive_color_offset_value_label')
|
|
|
|
label_widget.set_text('%d%%' % (int(value * 100)))
|
2011-10-07 00:20:54 +00:00
|
|
|
|
2016-12-12 18:07:08 +00:00
|
|
|
def on_handlesize_value_changed(self, widget):
|
2010-03-09 13:09:07 +00:00
|
|
|
"""Handle size changed"""
|
2015-11-29 18:33:52 +00:00
|
|
|
value = widget.get_value() # This one is rounded according to the UI.
|
|
|
|
value = int(value) # Cast to int.
|
2016-12-06 01:01:48 +00:00
|
|
|
if value > 20:
|
|
|
|
value = 20
|
2010-04-07 21:23:31 +00:00
|
|
|
self.config['handle_size'] = value
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
2016-12-12 10:29:19 +00:00
|
|
|
guiget = self.builder.get_object
|
|
|
|
label_widget = guiget('handlesize_value_label')
|
|
|
|
label_widget.set_text(str(value))
|
2020-06-21 18:35:50 +00:00
|
|
|
|
|
|
|
def on_lineheight_value_changed(self, widget):
|
|
|
|
"""Handles line height changed"""
|
|
|
|
value = widget.get_value()
|
|
|
|
value = round(float(value), 1)
|
|
|
|
if value > 2.0:
|
|
|
|
value = 2.0
|
|
|
|
self.config['line_height'] = value
|
|
|
|
self.config.save()
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
label_widget = guiget('lineheight_value_label')
|
|
|
|
label_widget.set_text(str(value))
|
2010-03-09 13:09:07 +00:00
|
|
|
|
|
|
|
def on_focuscombo_changed(self, widget):
|
|
|
|
"""Focus type changed"""
|
2015-06-19 01:48:12 +00:00
|
|
|
selected = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
if selected == 1:
|
|
|
|
value = 'click'
|
|
|
|
elif selected == 2:
|
|
|
|
value = 'mouse'
|
|
|
|
else:
|
|
|
|
value = 'system'
|
|
|
|
self.config['focus'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def on_tabposcombo_changed(self, widget):
|
|
|
|
"""Tab position changed"""
|
|
|
|
selected = widget.get_active()
|
|
|
|
if selected == 1:
|
|
|
|
value = 'bottom'
|
|
|
|
elif selected == 2:
|
|
|
|
value = 'left'
|
|
|
|
elif selected == 3:
|
|
|
|
value = 'right'
|
2010-07-03 19:42:33 +00:00
|
|
|
elif selected == 4:
|
|
|
|
value = 'hidden'
|
2010-03-09 13:09:07 +00:00
|
|
|
else:
|
|
|
|
value = 'top'
|
|
|
|
self.config['tab_position'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
2015-06-22 18:06:21 +00:00
|
|
|
def on_broadcastdefault_changed(self, widget):
|
|
|
|
"""Broadcast default changed"""
|
|
|
|
selected = widget.get_active()
|
|
|
|
if selected == 0:
|
|
|
|
value = 'all'
|
|
|
|
elif selected == 2:
|
|
|
|
value = 'off'
|
|
|
|
else:
|
|
|
|
value = 'group'
|
|
|
|
self.config['broadcast_default'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
def on_winstatecombo_changed(self, widget):
|
|
|
|
"""Window state changed"""
|
|
|
|
selected = widget.get_active()
|
|
|
|
if selected == 1:
|
|
|
|
value = 'hidden'
|
|
|
|
elif selected == 2:
|
|
|
|
value = 'maximise'
|
|
|
|
elif selected == 3:
|
|
|
|
value = 'fullscreen'
|
|
|
|
else:
|
|
|
|
value = 'normal'
|
|
|
|
self.config['window_state'] = value
|
|
|
|
self.config.save()
|
2010-02-05 00:16:24 +00:00
|
|
|
|
2010-01-22 22:53:23 +00:00
|
|
|
def on_profileaddbutton_clicked(self, _button):
|
2010-01-09 15:51:56 +00:00
|
|
|
"""Add a new profile to the list"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
treeview = guiget('profilelist')
|
|
|
|
model = treeview.get_model()
|
|
|
|
values = [ r[0] for r in model ]
|
|
|
|
|
|
|
|
newprofile = _('New Profile')
|
|
|
|
if newprofile in values:
|
2010-01-10 00:53:27 +00:00
|
|
|
i = 1
|
2010-01-09 15:51:56 +00:00
|
|
|
while newprofile in values:
|
|
|
|
i = i + 1
|
|
|
|
newprofile = '%s %d' % (_('New Profile'), i)
|
|
|
|
|
|
|
|
if self.config.add_profile(newprofile):
|
2010-02-08 21:03:43 +00:00
|
|
|
res = model.append([newprofile, True])
|
|
|
|
if res:
|
|
|
|
path = model.get_path(res)
|
2017-02-19 15:57:36 +00:00
|
|
|
treeview.set_cursor(path, column=treeview.get_column(0),
|
2010-02-08 21:03:43 +00:00
|
|
|
start_editing=True)
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
self.layouteditor.update_profiles()
|
|
|
|
|
2010-01-22 22:53:23 +00:00
|
|
|
def on_profileremovebutton_clicked(self, _button):
|
2010-01-09 15:51:56 +00:00
|
|
|
"""Remove a profile from the list"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
treeview = guiget('profilelist')
|
|
|
|
selection = treeview.get_selection()
|
|
|
|
(model, rowiter) = selection.get_selected()
|
|
|
|
profile = model.get_value(rowiter, 0)
|
|
|
|
|
|
|
|
if profile == 'default':
|
|
|
|
# We shouldn't let people delete this profile
|
|
|
|
return
|
|
|
|
|
2010-01-31 16:24:45 +00:00
|
|
|
self.previous_profile_selection = None
|
2010-01-09 15:51:56 +00:00
|
|
|
self.config.del_profile(profile)
|
|
|
|
model.remove(rowiter)
|
|
|
|
selection.select_iter(model.get_iter_first())
|
2010-03-05 22:20:48 +00:00
|
|
|
self.layouteditor.update_profiles()
|
2010-01-09 15:51:56 +00:00
|
|
|
|
2010-02-05 00:16:24 +00:00
|
|
|
def on_layoutaddbutton_clicked(self, _button):
|
|
|
|
"""Add a new layout to the list"""
|
|
|
|
terminator = Terminator()
|
|
|
|
current_layout = terminator.describe_layout()
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
treeview = guiget('layoutlist')
|
|
|
|
model = treeview.get_model()
|
|
|
|
values = [ r[0] for r in model ]
|
|
|
|
|
|
|
|
name = _('New Layout')
|
|
|
|
if name in values:
|
2015-09-01 21:04:16 +00:00
|
|
|
i = 0
|
2010-02-05 00:16:24 +00:00
|
|
|
while name in values:
|
|
|
|
i = i + 1
|
|
|
|
name = '%s %d' % (_('New Layout'), i)
|
|
|
|
|
|
|
|
if self.config.add_layout(name, current_layout):
|
2010-02-08 21:03:43 +00:00
|
|
|
res = model.append([name, True])
|
|
|
|
if res:
|
|
|
|
path = model.get_path(res)
|
2017-02-06 16:32:30 +00:00
|
|
|
treeview.set_cursor(path, start_editing=True)
|
2010-02-05 00:16:24 +00:00
|
|
|
|
2010-03-18 23:11:18 +00:00
|
|
|
self.config.save()
|
|
|
|
|
2014-05-19 19:47:11 +00:00
|
|
|
def on_layoutrefreshbutton_clicked(self, _button):
|
|
|
|
"""Refresh the terminals status and update"""
|
|
|
|
terminator = Terminator()
|
|
|
|
current_layout = terminator.describe_layout()
|
|
|
|
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
treeview = guiget('layoutlist')
|
|
|
|
selected = treeview.get_selection()
|
|
|
|
(model, rowiter) = selected.get_selected()
|
|
|
|
name = model.get_value(rowiter, 0)
|
2015-07-15 00:51:18 +00:00
|
|
|
|
2014-05-19 19:47:11 +00:00
|
|
|
if self.config.replace_layout(name, current_layout):
|
2015-07-15 00:43:39 +00:00
|
|
|
treeview.set_cursor(model.get_path(rowiter), column=treeview.get_column(0), start_editing=False)
|
2015-07-15 00:51:18 +00:00
|
|
|
self.config.save()
|
2014-05-19 19:47:11 +00:00
|
|
|
|
2010-02-05 00:16:24 +00:00
|
|
|
def on_layoutremovebutton_clicked(self, _button):
|
|
|
|
"""Remove a layout from the list"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
treeview = guiget('layoutlist')
|
|
|
|
selection = treeview.get_selection()
|
|
|
|
(model, rowiter) = selection.get_selected()
|
|
|
|
layout = model.get_value(rowiter, 0)
|
|
|
|
|
|
|
|
if layout == 'default':
|
|
|
|
# We shouldn't let people delete this layout
|
|
|
|
return
|
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
self.previous_selection = None
|
2010-02-05 00:16:24 +00:00
|
|
|
self.config.del_layout(layout)
|
|
|
|
model.remove(rowiter)
|
|
|
|
selection.select_iter(model.get_iter_first())
|
2010-03-18 23:11:18 +00:00
|
|
|
self.config.save()
|
2010-02-05 00:16:24 +00:00
|
|
|
|
2012-01-14 20:39:00 +00:00
|
|
|
def on_use_custom_url_handler_checkbutton_toggled(self, checkbox):
|
|
|
|
"""Toggling the use_custom_url_handler checkbox needs to alter the
|
|
|
|
sensitivity of the custom_url_handler entrybox"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
widget = guiget('custom_url_handler_entry')
|
|
|
|
value = checkbox.get_active()
|
|
|
|
|
|
|
|
widget.set_sensitive(value)
|
|
|
|
self.config['use_custom_url_handler'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
2010-01-09 11:52:30 +00:00
|
|
|
def on_use_custom_command_checkbutton_toggled(self, checkbox):
|
|
|
|
"""Toggling the use_custom_command checkbox needs to alter the
|
|
|
|
sensitivity of the custom_command entrybox"""
|
|
|
|
guiget = self.builder.get_object
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('custom_command_entry')
|
2010-03-09 13:09:07 +00:00
|
|
|
value = checkbox.get_active()
|
|
|
|
|
|
|
|
widget.set_sensitive(value)
|
|
|
|
self.config['use_custom_command'] = value
|
|
|
|
self.config.save()
|
2010-01-09 11:52:30 +00:00
|
|
|
|
|
|
|
def on_system_font_checkbutton_toggled(self, checkbox):
|
|
|
|
"""Toggling the use_system_font checkbox needs to alter the
|
|
|
|
sensitivity of the font selector"""
|
|
|
|
guiget = self.builder.get_object
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('font_selector')
|
2010-03-09 13:09:07 +00:00
|
|
|
value = checkbox.get_active()
|
|
|
|
|
|
|
|
widget.set_sensitive(not value)
|
|
|
|
self.config['use_system_font'] = value
|
|
|
|
self.config.save()
|
2015-07-10 19:37:35 +00:00
|
|
|
|
|
|
|
if self.config['use_system_font'] == True:
|
|
|
|
fontname = self.config.get_system_mono_font()
|
|
|
|
if fontname is not None:
|
|
|
|
widget.set_font_name(fontname)
|
|
|
|
else:
|
|
|
|
widget.set_font_name(self.config['font'])
|
|
|
|
|
|
|
|
def on_title_system_font_checkbutton_toggled(self, checkbox):
|
|
|
|
"""Toggling the title_use_system_font checkbox needs to alter the
|
|
|
|
sensitivity of the font selector"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
widget = guiget('title_font_selector')
|
|
|
|
value = checkbox.get_active()
|
|
|
|
|
|
|
|
widget.set_sensitive(not value)
|
|
|
|
self.config['title_use_system_font'] = value
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
if self.config['title_use_system_font'] == True:
|
|
|
|
fontname = self.config.get_system_prop_font()
|
|
|
|
if fontname is not None:
|
|
|
|
widget.set_font_name(fontname)
|
|
|
|
else:
|
|
|
|
widget.set_font_name(self.config['title_font'])
|
2010-01-09 11:52:30 +00:00
|
|
|
|
|
|
|
def on_reset_compatibility_clicked(self, widget):
|
|
|
|
"""Reset the confusing and annoying backspace/delete options to the
|
|
|
|
safest values"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('backspace_binding_combobox')
|
2010-01-09 11:52:30 +00:00
|
|
|
widget.set_active(2)
|
2010-03-06 11:09:32 +00:00
|
|
|
widget = guiget('delete_binding_combobox')
|
2010-01-24 15:45:47 +00:00
|
|
|
widget.set_active(3)
|
2010-01-09 00:47:49 +00:00
|
|
|
|
2010-01-22 22:53:23 +00:00
|
|
|
def on_background_type_toggled(self, _widget):
|
2010-01-09 00:47:49 +00:00
|
|
|
"""The background type was toggled"""
|
|
|
|
self.update_background_tab()
|
|
|
|
|
|
|
|
def update_background_tab(self):
|
|
|
|
"""Update the background tab"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
|
|
|
|
# Background type
|
|
|
|
backtype = None
|
2010-03-06 11:09:32 +00:00
|
|
|
imagewidget = guiget('image_radiobutton')
|
|
|
|
transwidget = guiget('transparent_radiobutton')
|
2010-01-09 00:47:49 +00:00
|
|
|
if transwidget.get_active() == True:
|
2010-03-09 13:09:07 +00:00
|
|
|
backtype = 'transparent'
|
2010-01-09 00:47:49 +00:00
|
|
|
else:
|
|
|
|
backtype = 'solid'
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config['background_type'] = backtype
|
|
|
|
self.config.save()
|
|
|
|
|
2013-08-01 17:56:55 +00:00
|
|
|
if backtype in ('transparent', 'image'):
|
2010-03-06 11:09:32 +00:00
|
|
|
guiget('darken_background_scale').set_sensitive(True)
|
2010-01-09 00:47:49 +00:00
|
|
|
else:
|
2010-03-06 11:09:32 +00:00
|
|
|
guiget('darken_background_scale').set_sensitive(False)
|
2010-01-08 23:51:45 +00:00
|
|
|
|
2010-01-08 08:39:21 +00:00
|
|
|
def on_profile_selection_changed(self, selection):
|
|
|
|
"""A different profile was selected"""
|
|
|
|
(listmodel, rowiter) = selection.get_selected()
|
2010-01-09 15:51:56 +00:00
|
|
|
if not rowiter:
|
|
|
|
# Something is wrong, just jump to the first item in the list
|
|
|
|
treeview = selection.get_tree_view()
|
|
|
|
liststore = treeview.get_model()
|
|
|
|
selection.select_iter(liststore.get_iter_first())
|
|
|
|
return
|
2010-01-08 08:39:21 +00:00
|
|
|
profile = listmodel.get_value(rowiter, 0)
|
|
|
|
self.set_profile_values(profile)
|
2010-01-31 16:24:45 +00:00
|
|
|
self.previous_profile_selection = profile
|
2010-01-09 15:51:56 +00:00
|
|
|
|
|
|
|
widget = self.builder.get_object('profileremovebutton')
|
|
|
|
if profile == 'default':
|
|
|
|
widget.set_sensitive(False)
|
|
|
|
else:
|
|
|
|
widget.set_sensitive(True)
|
2010-01-08 01:02:49 +00:00
|
|
|
|
2010-06-20 21:41:55 +00:00
|
|
|
def on_plugin_selection_changed(self, selection):
|
|
|
|
"""A different plugin was selected"""
|
|
|
|
(listmodel, rowiter) = selection.get_selected()
|
|
|
|
if not rowiter:
|
|
|
|
# Something is wrong, just jump to the first item in the list
|
|
|
|
treeview = selection.get_tree_view()
|
|
|
|
liststore = treeview.get_model()
|
|
|
|
selection.select_iter(liststore.get_iter_first())
|
|
|
|
return
|
|
|
|
plugin = listmodel.get_value(rowiter, 0)
|
|
|
|
self.set_plugin(plugin)
|
|
|
|
self.previous_plugin_selection = plugin
|
|
|
|
|
|
|
|
widget = self.builder.get_object('plugintogglebutton')
|
|
|
|
|
|
|
|
def on_plugin_toggled(self, cell, path):
|
|
|
|
"""A plugin has been enabled or disabled"""
|
|
|
|
treeview = self.builder.get_object('pluginlist')
|
|
|
|
model = treeview.get_model()
|
|
|
|
plugin = model[path][0]
|
|
|
|
|
2010-06-22 23:48:06 +00:00
|
|
|
if not self.plugins[plugin]:
|
|
|
|
# Plugin is currently disabled, load it
|
|
|
|
self.registry.enable(plugin)
|
|
|
|
else:
|
|
|
|
# Plugin is currently enabled, unload it
|
|
|
|
self.registry.disable(plugin)
|
|
|
|
|
2010-06-21 21:44:09 +00:00
|
|
|
self.plugins[plugin] = not self.plugins[plugin]
|
2010-06-20 21:41:55 +00:00
|
|
|
# Update the treeview
|
2010-06-21 21:44:09 +00:00
|
|
|
model[path][1] = self.plugins[plugin]
|
2010-06-20 21:41:55 +00:00
|
|
|
|
2010-06-21 21:44:09 +00:00
|
|
|
enabled_plugins = [x for x in self.plugins if self.plugins[x] == True]
|
2010-06-20 21:41:55 +00:00
|
|
|
self.config['enabled_plugins'] = enabled_plugins
|
|
|
|
self.config.save()
|
|
|
|
|
|
|
|
def set_plugin(self, plugin):
|
|
|
|
"""Show the preferences for the selected plugin, if any"""
|
|
|
|
pluginpanelabel = self.builder.get_object('pluginpanelabel')
|
|
|
|
pluginconfig = self.config.plugin_get_config(plugin)
|
|
|
|
# FIXME: Implement this, we need to auto-construct a UI for the plugin
|
|
|
|
|
2010-01-08 01:02:49 +00:00
|
|
|
def on_profile_name_edited(self, cell, path, newtext):
|
|
|
|
"""Update a profile name"""
|
|
|
|
oldname = cell.get_property('text')
|
2010-01-30 15:33:37 +00:00
|
|
|
if oldname == newtext or oldname == 'default':
|
2010-01-08 01:02:49 +00:00
|
|
|
return
|
|
|
|
dbg('PrefsEditor::on_profile_name_edited: Changing %s to %s' %
|
|
|
|
(oldname, newtext))
|
|
|
|
self.config.rename_profile(oldname, newtext)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
2015-06-19 01:48:12 +00:00
|
|
|
|
2010-01-08 01:02:49 +00:00
|
|
|
widget = self.builder.get_object('profilelist')
|
|
|
|
model = widget.get_model()
|
2010-01-22 22:53:23 +00:00
|
|
|
itera = model.get_iter(path)
|
|
|
|
model.set_value(itera, 0, newtext)
|
2010-01-08 01:02:49 +00:00
|
|
|
|
2010-01-31 16:24:45 +00:00
|
|
|
if oldname == self.previous_profile_selection:
|
|
|
|
self.previous_profile_selection = newtext
|
2010-01-10 00:53:27 +00:00
|
|
|
|
2010-02-05 00:16:24 +00:00
|
|
|
def on_layout_selection_changed(self, selection):
|
|
|
|
"""A different layout was selected"""
|
2010-03-05 22:20:48 +00:00
|
|
|
self.layouteditor.on_layout_selection_changed(selection)
|
2010-02-05 00:16:24 +00:00
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
def on_layout_item_selection_changed(self, selection):
|
|
|
|
"""A different item in the layout was selected"""
|
|
|
|
self.layouteditor.on_layout_item_selection_changed(selection)
|
2010-02-05 00:16:24 +00:00
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
def on_layout_profile_chooser_changed(self, widget):
|
|
|
|
"""A different profile has been selected for this item"""
|
|
|
|
self.layouteditor.on_layout_profile_chooser_changed(widget)
|
2010-02-27 13:06:53 +00:00
|
|
|
|
2010-04-13 11:52:16 +00:00
|
|
|
def on_layout_profile_command_changed(self, widget):
|
2010-03-05 22:20:48 +00:00
|
|
|
"""A different command has been entered for this item"""
|
|
|
|
self.layouteditor.on_layout_profile_command_activate(widget)
|
2010-02-12 08:16:18 +00:00
|
|
|
|
2013-08-27 17:22:57 +00:00
|
|
|
def on_layout_profile_workingdir_changed(self, widget):
|
|
|
|
"""A different working directory has been entered for this item"""
|
|
|
|
self.layouteditor.on_layout_profile_workingdir_activate(widget)
|
|
|
|
|
2010-02-05 00:16:24 +00:00
|
|
|
def on_layout_name_edited(self, cell, path, newtext):
|
|
|
|
"""Update a layout name"""
|
|
|
|
oldname = cell.get_property('text')
|
|
|
|
if oldname == newtext or oldname == 'default':
|
|
|
|
return
|
|
|
|
dbg('Changing %s to %s' % (oldname, newtext))
|
|
|
|
self.config.rename_layout(oldname, newtext)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config.save()
|
2015-06-19 01:48:12 +00:00
|
|
|
|
2010-02-05 00:16:24 +00:00
|
|
|
widget = self.builder.get_object('layoutlist')
|
|
|
|
model = widget.get_model()
|
|
|
|
itera = model.get_iter(path)
|
|
|
|
model.set_value(itera, 0, newtext)
|
|
|
|
|
|
|
|
if oldname == self.previous_layout_selection:
|
|
|
|
self.previous_layout_selection = newtext
|
|
|
|
|
2010-03-10 12:52:25 +00:00
|
|
|
if oldname == self.layouteditor.layout_name:
|
|
|
|
self.layouteditor.layout_name = newtext
|
|
|
|
|
2010-01-08 23:51:45 +00:00
|
|
|
def on_color_scheme_combobox_changed(self, widget):
|
|
|
|
"""Update the fore/background colour pickers"""
|
|
|
|
value = None
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
active = widget.get_active()
|
2010-03-09 13:09:07 +00:00
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
for key in list(self.colorschemevalues.keys()):
|
2010-01-08 23:51:45 +00:00
|
|
|
if self.colorschemevalues[key] == active:
|
|
|
|
value = key
|
|
|
|
|
2010-03-06 11:09:32 +00:00
|
|
|
fore = guiget('foreground_colorpicker')
|
|
|
|
back = guiget('background_colorpicker')
|
2010-01-08 23:51:45 +00:00
|
|
|
if value == 'custom':
|
|
|
|
fore.set_sensitive(True)
|
|
|
|
back.set_sensitive(True)
|
|
|
|
else:
|
|
|
|
fore.set_sensitive(False)
|
|
|
|
back.set_sensitive(False)
|
|
|
|
|
|
|
|
forecol = None
|
|
|
|
backcol = None
|
2010-04-06 11:36:45 +00:00
|
|
|
if value in self.colourschemes:
|
|
|
|
forecol = self.colourschemes[value][0]
|
|
|
|
backcol = self.colourschemes[value][1]
|
2010-04-01 21:05:14 +00:00
|
|
|
elif value == 'custom':
|
2010-04-13 22:17:52 +00:00
|
|
|
forecol = color2hex(fore)
|
|
|
|
backcol = color2hex(back)
|
2010-04-01 21:05:14 +00:00
|
|
|
else:
|
|
|
|
err('Unknown colourscheme value: %s' % value)
|
|
|
|
return
|
2010-01-08 23:51:45 +00:00
|
|
|
|
2014-09-19 14:10:43 +00:00
|
|
|
fore.set_color(Gdk.color_parse(forecol))
|
|
|
|
back.set_color(Gdk.color_parse(backcol))
|
2010-01-08 23:51:45 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config['foreground_color'] = forecol
|
|
|
|
self.config['background_color'] = backcol
|
|
|
|
self.config.save()
|
|
|
|
|
2010-01-08 23:51:45 +00:00
|
|
|
def on_use_theme_colors_checkbutton_toggled(self, widget):
|
|
|
|
"""Update colour pickers"""
|
|
|
|
guiget = self.builder.get_object
|
|
|
|
active = widget.get_active()
|
|
|
|
|
2010-03-06 11:09:32 +00:00
|
|
|
scheme = guiget('color_scheme_combobox')
|
|
|
|
fore = guiget('foreground_colorpicker')
|
|
|
|
back = guiget('background_colorpicker')
|
2010-01-08 23:51:45 +00:00
|
|
|
|
|
|
|
if active:
|
|
|
|
for widget in [scheme, fore, back]:
|
|
|
|
widget.set_sensitive(False)
|
|
|
|
else:
|
|
|
|
scheme.set_sensitive(True)
|
|
|
|
self.on_color_scheme_combobox_changed(scheme)
|
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config['use_theme_colors'] = active
|
|
|
|
self.config.save()
|
|
|
|
|
2020-04-25 18:22:51 +00:00
|
|
|
def on_bold_text_is_bright_checkbutton_toggled(self, widget):
|
|
|
|
"""Bold-is-bright setting changed"""
|
|
|
|
self.config['bold_is_bright'] = widget.get_active()
|
|
|
|
self.config.save()
|
|
|
|
|
2010-01-22 22:53:23 +00:00
|
|
|
def on_cellrenderer_accel_edited(self, liststore, path, key, mods, _code):
|
2010-01-10 00:20:24 +00:00
|
|
|
"""Handle an edited keybinding"""
|
|
|
|
celliter = liststore.get_iter_from_string(path)
|
|
|
|
liststore.set(celliter, 2, key, 3, mods)
|
2009-12-27 02:32:16 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
binding = liststore.get_value(liststore.get_iter(path), 0)
|
2014-09-19 14:08:08 +00:00
|
|
|
accel = Gtk.accelerator_name(key, mods)
|
2010-03-09 13:09:07 +00:00
|
|
|
self.config['keybindings'][binding] = accel
|
|
|
|
self.config.save()
|
|
|
|
|
2010-01-10 00:20:24 +00:00
|
|
|
def on_cellrenderer_accel_cleared(self, liststore, path):
|
2010-01-22 22:53:23 +00:00
|
|
|
"""Handle the clearing of a keybinding accelerator"""
|
2010-01-10 00:20:24 +00:00
|
|
|
celliter = liststore.get_iter_from_string(path)
|
|
|
|
liststore.set(celliter, 2, 0, 3, 0)
|
2009-12-27 02:32:16 +00:00
|
|
|
|
2010-03-09 13:09:07 +00:00
|
|
|
binding = liststore.get_value(liststore.get_iter(path), 0)
|
|
|
|
self.config['keybindings'][binding] = None
|
|
|
|
self.config.save()
|
|
|
|
|
2015-09-01 20:50:09 +00:00
|
|
|
def on_open_manual(self, widget):
|
|
|
|
"""Open the fine manual"""
|
|
|
|
self.term.key_help()
|
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
class LayoutEditor:
|
|
|
|
profile_ids_to_profile = None
|
|
|
|
profile_profile_to_ids = None
|
|
|
|
layout_name = None
|
|
|
|
layout_item = None
|
|
|
|
builder = None
|
|
|
|
treeview = None
|
|
|
|
treestore = None
|
|
|
|
config = None
|
|
|
|
|
|
|
|
def __init__(self, builder):
|
|
|
|
"""Initialise ourself"""
|
|
|
|
self.config = config.Config()
|
|
|
|
self.builder = builder
|
|
|
|
|
|
|
|
def prepare(self, layout=None):
|
|
|
|
"""Do the things we can't do in __init__"""
|
|
|
|
self.treeview = self.builder.get_object('LayoutTreeView')
|
|
|
|
self.treestore = self.builder.get_object('LayoutTreeStore')
|
|
|
|
self.update_profiles()
|
|
|
|
if layout:
|
|
|
|
self.set_layout(layout)
|
|
|
|
|
|
|
|
def set_layout(self, layout_name):
|
|
|
|
"""Load a particular layout"""
|
|
|
|
self.layout_name = layout_name
|
|
|
|
store = self.treestore
|
|
|
|
layout = self.config.layout_get_config(layout_name)
|
|
|
|
listitems = {}
|
|
|
|
store.clear()
|
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
children = list(layout.keys())
|
2010-03-05 22:20:48 +00:00
|
|
|
i = 0
|
|
|
|
while children != []:
|
|
|
|
child = children.pop()
|
|
|
|
child_type = layout[child]['type']
|
|
|
|
parent = layout[child]['parent']
|
|
|
|
|
|
|
|
if child_type != 'Window' and parent not in layout:
|
|
|
|
# We have an orphan!
|
|
|
|
err('%s is an orphan in this layout. Discarding' % child)
|
|
|
|
continue
|
|
|
|
try:
|
|
|
|
parentiter = listitems[parent]
|
|
|
|
except KeyError:
|
|
|
|
if child_type == 'Window':
|
|
|
|
parentiter = None
|
|
|
|
else:
|
|
|
|
# We're not ready for this widget yet
|
|
|
|
children.insert(0, child)
|
|
|
|
continue
|
|
|
|
|
|
|
|
if child_type == 'VPaned':
|
|
|
|
child_type = 'Vertical split'
|
|
|
|
elif child_type == 'HPaned':
|
|
|
|
child_type = 'Horizontal split'
|
|
|
|
|
|
|
|
listitems[child] = store.append(parentiter, [child, child_type])
|
|
|
|
|
|
|
|
treeview = self.builder.get_object('LayoutTreeView')
|
|
|
|
treeview.expand_all()
|
|
|
|
|
|
|
|
def update_profiles(self):
|
|
|
|
"""Update the list of profiles"""
|
|
|
|
self.profile_ids_to_profile = {}
|
|
|
|
self.profile_profile_to_ids= {}
|
|
|
|
chooser = self.builder.get_object('layout_profile_chooser')
|
|
|
|
|
|
|
|
profiles = self.config.list_profiles()
|
|
|
|
profiles.sort()
|
|
|
|
i = 0
|
|
|
|
for profile in profiles:
|
|
|
|
self.profile_ids_to_profile[i] = profile
|
|
|
|
self.profile_profile_to_ids[profile] = i
|
2016-12-12 10:29:19 +00:00
|
|
|
chooser.append_text(profile)
|
2010-03-05 22:20:48 +00:00
|
|
|
i = i + 1
|
|
|
|
|
|
|
|
def on_layout_selection_changed(self, selection):
|
|
|
|
"""A different layout was selected"""
|
|
|
|
(listmodel, rowiter) = selection.get_selected()
|
|
|
|
if not rowiter:
|
|
|
|
# Something is wrong, just jump to the first item in the list
|
|
|
|
selection.select_iter(self.treestore.get_iter_first())
|
|
|
|
return
|
|
|
|
layout = listmodel.get_value(rowiter, 0)
|
|
|
|
self.set_layout(layout)
|
|
|
|
self.previous_layout_selection = layout
|
|
|
|
|
|
|
|
widget = self.builder.get_object('layoutremovebutton')
|
|
|
|
if layout == 'default':
|
|
|
|
widget.set_sensitive(False)
|
|
|
|
else:
|
|
|
|
widget.set_sensitive(True)
|
|
|
|
|
2013-08-27 17:22:57 +00:00
|
|
|
command = self.builder.get_object('layout_profile_command')
|
|
|
|
chooser = self.builder.get_object('layout_profile_chooser')
|
|
|
|
workdir = self.builder.get_object('layout_profile_workingdir')
|
|
|
|
command.set_sensitive(False)
|
|
|
|
chooser.set_sensitive(False)
|
|
|
|
workdir.set_sensitive(False)
|
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
def on_layout_item_selection_changed(self, selection):
|
|
|
|
"""A different item in the layout was selected"""
|
|
|
|
(treemodel, rowiter) = selection.get_selected()
|
|
|
|
if not rowiter:
|
|
|
|
return
|
|
|
|
item = treemodel.get_value(rowiter, 0)
|
|
|
|
self.layout_item = item
|
|
|
|
self.set_layout_item(item)
|
|
|
|
|
|
|
|
def set_layout_item(self, item_name):
|
|
|
|
"""Set a layout item"""
|
|
|
|
layout = self.config.layout_get_config(self.layout_name)
|
|
|
|
layout_item = layout[self.layout_item]
|
|
|
|
command = self.builder.get_object('layout_profile_command')
|
|
|
|
chooser = self.builder.get_object('layout_profile_chooser')
|
2013-08-27 17:22:57 +00:00
|
|
|
workdir = self.builder.get_object('layout_profile_workingdir')
|
2010-03-05 22:20:48 +00:00
|
|
|
|
|
|
|
if layout_item['type'] != 'Terminal':
|
|
|
|
command.set_sensitive(False)
|
|
|
|
chooser.set_sensitive(False)
|
2013-08-27 17:22:57 +00:00
|
|
|
workdir.set_sensitive(False)
|
2010-03-05 22:20:48 +00:00
|
|
|
return
|
|
|
|
|
|
|
|
command.set_sensitive(True)
|
|
|
|
chooser.set_sensitive(True)
|
2013-08-27 17:22:57 +00:00
|
|
|
workdir.set_sensitive(True)
|
2018-04-24 18:22:10 +00:00
|
|
|
if 'command' in layout_item and layout_item['command'] != '':
|
2010-03-05 22:20:48 +00:00
|
|
|
command.set_text(layout_item['command'])
|
2010-03-10 12:52:25 +00:00
|
|
|
else:
|
|
|
|
command.set_text('')
|
2010-03-05 22:20:48 +00:00
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
if 'profile' in layout_item and layout_item['profile'] != '':
|
2010-03-05 22:20:48 +00:00
|
|
|
chooser.set_active(self.profile_profile_to_ids[layout_item['profile']])
|
2010-03-10 12:52:25 +00:00
|
|
|
else:
|
|
|
|
chooser.set_active(0)
|
2010-03-05 22:20:48 +00:00
|
|
|
|
2018-04-24 18:22:10 +00:00
|
|
|
if 'directory' in layout_item and layout_item['directory'] != '':
|
2013-08-27 17:22:57 +00:00
|
|
|
workdir.set_text(layout_item['directory'])
|
|
|
|
else:
|
|
|
|
workdir.set_text('')
|
|
|
|
|
2010-03-05 22:20:48 +00:00
|
|
|
def on_layout_profile_chooser_changed(self, widget):
|
|
|
|
"""A new profile has been selected for this item"""
|
|
|
|
if not self.layout_item:
|
|
|
|
return
|
|
|
|
profile = widget.get_active_text()
|
|
|
|
layout = self.config.layout_get_config(self.layout_name)
|
|
|
|
layout[self.layout_item]['profile'] = profile
|
2010-03-10 12:52:25 +00:00
|
|
|
self.config.save()
|
2010-03-05 22:20:48 +00:00
|
|
|
|
|
|
|
def on_layout_profile_command_activate(self, widget):
|
|
|
|
"""A new command has been entered for this item"""
|
|
|
|
command = widget.get_text()
|
|
|
|
layout = self.config.layout_get_config(self.layout_name)
|
|
|
|
layout[self.layout_item]['command'] = command
|
2010-03-10 12:52:25 +00:00
|
|
|
self.config.save()
|
2010-03-05 22:20:48 +00:00
|
|
|
|
2013-08-27 17:22:57 +00:00
|
|
|
def on_layout_profile_workingdir_activate(self, widget):
|
|
|
|
"""A new working directory has been entered for this item"""
|
|
|
|
workdir = widget.get_text()
|
|
|
|
layout = self.config.layout_get_config(self.layout_name)
|
|
|
|
layout[self.layout_item]['directory'] = workdir
|
|
|
|
self.config.save()
|
|
|
|
|
2010-01-08 01:02:49 +00:00
|
|
|
if __name__ == '__main__':
|
2018-04-24 18:22:10 +00:00
|
|
|
from . import util
|
2010-01-22 13:00:26 +00:00
|
|
|
util.DEBUG = True
|
2018-04-24 18:22:10 +00:00
|
|
|
from . import terminal
|
2010-01-22 22:53:23 +00:00
|
|
|
TERM = terminal.Terminal()
|
|
|
|
PREFEDIT = PrefsEditor(TERM)
|
2010-01-08 01:02:49 +00:00
|
|
|
|
2014-09-19 14:08:08 +00:00
|
|
|
Gtk.main()
|