#!/usr/bin/python # TerminatorConfig - layered config classes # Copyright (C) 2006-2008 cmsj@tenshu.net # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, version 2 only. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA """Terminator by Chris Jones Classes relating to configuratoin""" import platform from borg import Borg DEFAULTS = { 'gt_dir' : '/apps/gnome-terminal', 'profile_dir' : '/apps/gnome-terminal/profiles', 'titlebars' : True, 'zoomedtitlebar' : True, 'allow_bold' : True, 'audible_bell' : False, 'visible_bell' : True, 'urgent_bell' : False, 'background_color' : '#000000', 'background_darkness' : 0.5, 'background_type' : 'solid', 'background_image' : '', 'backspace_binding' : 'ascii-del', 'delete_binding' : 'delete-sequence', 'cursor_blink' : True, 'cursor_shape' : 'block', 'cursor_color' : '', 'emulation' : 'xterm', 'font' : 'Mono 10', 'foreground_color' : '#AAAAAA', 'scrollbar_position' : "right", 'scroll_background' : True, 'scroll_on_keystroke' : True, 'scroll_on_output' : True, 'scrollback_lines' : 500, 'focus' : 'click', 'exit_action' : 'close', 'palette' : '#000000000000:#CDCD00000000:#0000CDCD0000:\ #CDCDCDCD0000:#30BF30BFA38E:#A53C212FA53C:\ #0000CDCDCDCD:#FAFAEBEBD7D7:#404040404040:\ #FFFF00000000:#0000FFFF0000:#FFFFFFFF0000:\ #00000000FFFF:#FFFF0000FFFF:#0000FFFFFFFF:\ #FFFFFFFFFFFF', 'word_chars' : '-A-Za-z0-9,./?%&#:_', 'mouse_autohide' : True, 'update_records' : True, 'login_shell' : False, 'use_custom_command' : False, 'custom_command' : '', 'use_system_font' : True, 'use_theme_colors' : False, 'http_proxy' : '', 'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'], 'encoding' : 'UTF-8', 'active_encodings' : ['UTF-8', 'ISO-8859-1'], 'fullscreen' : False, 'borderless' : False, 'maximise' : False, 'hidden' : False, 'handle_size' : -1, 'focus_on_close' : 'auto', 'f11_modifier' : False, 'force_no_bell' : False, 'cycle_term_tab' : True, 'copy_on_selection' : False, 'close_button_on_tab' : True, 'tab_position' : 'top', 'enable_real_transparency' : True, 'title_tx_txt_color' : '#FFFFFF', 'title_tx_bg_color' : '#C80003', 'title_rx_txt_color' : '#FFFFFF', 'title_rx_bg_color' : '#0076C9', 'title_ia_txt_color' : '#000000', 'title_ia_bg_color' : '#C0BEBF', 'try_posix_regexp' : platform.system() != 'Linux', 'hide_tabbar' : False, 'scroll_tabbar' : False, 'alternate_screen_scroll': True, 'split_to_group' : False, 'autoclean_groups' : True, 'keybindings' : { 'zoom_in' : 'plus', 'zoom_out' : 'minus', 'zoom_normal' : '0', 'new_root_tab' : 'T', 'new_tab' : 'T', 'go_next' : ('N','Tab'), 'go_prev' : ('P','Tab'), 'go_up' : 'Up', 'go_down' : 'Down', 'go_left' : 'Left', 'go_right' : 'Right', 'split_horiz' : 'O', 'split_vert' : 'E', 'close_term' : 'W', 'copy' : 'C', 'paste' : 'V', 'toggle_scrollbar' : 'S', 'search' : 'F', 'close_window' : 'Q', 'resize_up' : 'Up', 'resize_down' : 'Down', 'resize_left' : 'Left', 'resize_right' : 'Right', 'move_tab_right' : 'Page_Down', 'move_tab_left' : 'Page_Up', 'toggle_zoom' : 'X', 'scaled_zoom' : 'Z', 'next_tab' : 'Page_Down', 'prev_tab' : 'Page_Up', 'switch_to_tab_1' : None, 'switch_to_tab_2' : None, 'switch_to_tab_3' : None, 'switch_to_tab_4' : None, 'switch_to_tab_5' : None, 'switch_to_tab_6' : None, 'switch_to_tab_7' : None, 'switch_to_tab_8' : None, 'switch_to_tab_9' : None, 'switch_to_tab_10' : None, 'full_screen' : 'F11', 'reset' : 'R', 'reset_clear' : 'G', 'hide_window' : 'a', 'group_all' : 'g', 'ungroup_all' : 'g', 'group_tab' : 't', 'ungroup_tab' : 'T', 'new_window' : 'I', } } class Config(Borg, dict): """Class to provide access to our user configuration""" defaults = None def __init__(self): """Class initialiser""" Borg.__init__(self) dict.__init__(self) self.prepare_attributes() def prepare_attributes(self): """Set up our borg environment""" if self.defaults is None: self.defaults = DEFAULTS def __getitem__(self, key): """Look up a configuration item""" return(self.defaults[key])