Merge pull request #536 from Vulcalien/vte-set-encoding
Remove Encoding settings (deprecated)
This commit is contained in:
commit
2ac33bb6bd
|
@ -245,8 +245,6 @@ DEFAULTS = {
|
||||||
'use_theme_colors' : False,
|
'use_theme_colors' : False,
|
||||||
'bold_is_bright' : False,
|
'bold_is_bright' : False,
|
||||||
'line_height' : 1.0,
|
'line_height' : 1.0,
|
||||||
'encoding' : 'UTF-8',
|
|
||||||
'active_encodings' : ['UTF-8', 'ISO-8859-1'],
|
|
||||||
'focus_on_close' : 'auto',
|
'focus_on_close' : 'auto',
|
||||||
'force_no_bell' : False,
|
'force_no_bell' : False,
|
||||||
'cycle_term_tab' : True,
|
'cycle_term_tab' : True,
|
||||||
|
|
|
@ -1,118 +0,0 @@
|
||||||
# TerminatorEncoding - charset encoding classes
|
|
||||||
# Copyright (C) 2006-2010 chantra@debuntu.org
|
|
||||||
#
|
|
||||||
# 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
|
|
||||||
|
|
||||||
"""TerminatorEncoding by Emmanuel Bretelle <chantra@debuntu.org>
|
|
||||||
|
|
||||||
TerminatorEncoding supplies a list of possible encoding
|
|
||||||
values.
|
|
||||||
This list is taken from gnome-terminal's src/terminal-encoding.c
|
|
||||||
and src/encoding.c
|
|
||||||
"""
|
|
||||||
|
|
||||||
from .translation import _
|
|
||||||
|
|
||||||
#pylint: disable-msg=R0903
|
|
||||||
class TerminatorEncoding:
|
|
||||||
"""Class to store encoding details"""
|
|
||||||
|
|
||||||
# The commented out entries below are so marked because gnome-terminal has done
|
|
||||||
# the same.
|
|
||||||
encodings = [
|
|
||||||
[True, None, _("Current Locale")],
|
|
||||||
[False, "ISO-8859-1", _("Western")],
|
|
||||||
[False, "ISO-8859-2", _("Central European")],
|
|
||||||
[False, "ISO-8859-3", _("South European") ],
|
|
||||||
[False, "ISO-8859-4", _("Baltic") ],
|
|
||||||
[False, "ISO-8859-5", _("Cyrillic") ],
|
|
||||||
[False, "ISO-8859-6", _("Arabic") ],
|
|
||||||
[False, "ISO-8859-7", _("Greek") ],
|
|
||||||
[False, "ISO-8859-8", _("Hebrew Visual") ],
|
|
||||||
[False, "ISO-8859-8-I", _("Hebrew") ],
|
|
||||||
[False, "ISO-8859-9", _("Turkish") ],
|
|
||||||
[False, "ISO-8859-10", _("Nordic") ],
|
|
||||||
[False, "ISO-8859-13", _("Baltic") ],
|
|
||||||
[False, "ISO-8859-14", _("Celtic") ],
|
|
||||||
[False, "ISO-8859-15", _("Western") ],
|
|
||||||
[False, "ISO-8859-16", _("Romanian") ],
|
|
||||||
# [False, "UTF-7", _("Unicode") ],
|
|
||||||
[False, "UTF-8", _("Unicode") ],
|
|
||||||
# [False, "UTF-16", _("Unicode") ],
|
|
||||||
# [False, "UCS-2", _("Unicode") ],
|
|
||||||
# [False, "UCS-4", _("Unicode") ],
|
|
||||||
[False, "ARMSCII-8", _("Armenian") ],
|
|
||||||
[False, "BIG5", _("Chinese Traditional") ],
|
|
||||||
[False, "BIG5-HKSCS", _("Chinese Traditional") ],
|
|
||||||
[False, "CP866", _("Cyrillic/Russian") ],
|
|
||||||
[False, "EUC-JP", _("Japanese") ],
|
|
||||||
[False, "EUC-KR", _("Korean") ],
|
|
||||||
[False, "EUC-TW", _("Chinese Traditional") ],
|
|
||||||
[False, "GB18030", _("Chinese Simplified") ],
|
|
||||||
[False, "GB2312", _("Chinese Simplified") ],
|
|
||||||
[False, "GBK", _("Chinese Simplified") ],
|
|
||||||
[False, "GEORGIAN-PS", _("Georgian") ],
|
|
||||||
[False, "HZ", _("Chinese Simplified") ],
|
|
||||||
[False, "IBM850", _("Western") ],
|
|
||||||
[False, "IBM852", _("Central European") ],
|
|
||||||
[False, "IBM855", _("Cyrillic") ],
|
|
||||||
[False, "IBM857", _("Turkish") ],
|
|
||||||
[False, "IBM862", _("Hebrew") ],
|
|
||||||
[False, "IBM864", _("Arabic") ],
|
|
||||||
[False, "ISO-2022-JP", _("Japanese") ],
|
|
||||||
[False, "ISO-2022-KR", _("Korean") ],
|
|
||||||
[False, "ISO-IR-111", _("Cyrillic") ],
|
|
||||||
# [False, "JOHAB", _("Korean") ],
|
|
||||||
[False, "KOI8-R", _("Cyrillic") ],
|
|
||||||
[False, "KOI8-U", _("Cyrillic/Ukrainian") ],
|
|
||||||
[False, "MAC_ARABIC", _("Arabic") ],
|
|
||||||
[False, "MAC_CE", _("Central European") ],
|
|
||||||
[False, "MAC_CROATIAN", _("Croatian") ],
|
|
||||||
[False, "MAC-CYRILLIC", _("Cyrillic") ],
|
|
||||||
[False, "MAC_DEVANAGARI", _("Hindi") ],
|
|
||||||
[False, "MAC_FARSI", _("Persian") ],
|
|
||||||
[False, "MAC_GREEK", _("Greek") ],
|
|
||||||
[False, "MAC_GUJARATI", _("Gujarati") ],
|
|
||||||
[False, "MAC_GURMUKHI", _("Gurmukhi") ],
|
|
||||||
[False, "MAC_HEBREW", _("Hebrew") ],
|
|
||||||
[False, "MAC_ICELANDIC", _("Icelandic") ],
|
|
||||||
[False, "MAC_ROMAN", _("Western") ],
|
|
||||||
[False, "MAC_ROMANIAN", _("Romanian") ],
|
|
||||||
[False, "MAC_TURKISH", _("Turkish") ],
|
|
||||||
[False, "MAC_UKRAINIAN", _("Cyrillic/Ukrainian") ],
|
|
||||||
[False, "SHIFT-JIS", _("Japanese") ],
|
|
||||||
[False, "TCVN", _("Vietnamese") ],
|
|
||||||
[False, "TIS-620", _("Thai") ],
|
|
||||||
[False, "UHC", _("Korean") ],
|
|
||||||
[False, "VISCII", _("Vietnamese") ],
|
|
||||||
[False, "WINDOWS-1250", _("Central European") ],
|
|
||||||
[False, "WINDOWS-1251", _("Cyrillic") ],
|
|
||||||
[False, "WINDOWS-1252", _("Western") ],
|
|
||||||
[False, "WINDOWS-1253", _("Greek") ],
|
|
||||||
[False, "WINDOWS-1254", _("Turkish") ],
|
|
||||||
[False, "WINDOWS-1255", _("Hebrew") ],
|
|
||||||
[False, "WINDOWS-1256", _("Arabic") ],
|
|
||||||
[False, "WINDOWS-1257", _("Baltic") ],
|
|
||||||
[False, "WINDOWS-1258", _("Vietnamese") ]
|
|
||||||
]
|
|
||||||
|
|
||||||
def __init__(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def get_list():
|
|
||||||
"""Return a list of supported encodings"""
|
|
||||||
return TerminatorEncoding.encodings
|
|
||||||
|
|
||||||
get_list = staticmethod(get_list)
|
|
||||||
|
|
|
@ -137,14 +137,6 @@
|
||||||
</row>
|
</row>
|
||||||
</data>
|
</data>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkListStore" id="EncodingListStore">
|
|
||||||
<columns>
|
|
||||||
<!-- column-name Encoding -->
|
|
||||||
<column type="gchararray"/>
|
|
||||||
<!-- column-name config_value -->
|
|
||||||
<column type="gchararray"/>
|
|
||||||
</columns>
|
|
||||||
</object>
|
|
||||||
<object class="GtkListStore" id="FocusListStore">
|
<object class="GtkListStore" id="FocusListStore">
|
||||||
<columns>
|
<columns>
|
||||||
<!-- column-name focustype -->
|
<!-- column-name focustype -->
|
||||||
|
@ -2955,7 +2947,7 @@
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
<child>
|
||||||
<!-- n-columns=2 n-rows=5 -->
|
<!-- n-columns=2 n-rows=4 -->
|
||||||
<object class="GtkGrid" id="grid15">
|
<object class="GtkGrid" id="grid15">
|
||||||
<property name="visible">True</property>
|
<property name="visible">True</property>
|
||||||
<property name="can-focus">False</property>
|
<property name="can-focus">False</property>
|
||||||
|
@ -3051,42 +3043,6 @@
|
||||||
<property name="top-attach">2</property>
|
<property name="top-attach">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
<child>
|
|
||||||
<object class="GtkLabel" id="label13">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">end</property>
|
|
||||||
<property name="label" translatable="yes">Encoding:</property>
|
|
||||||
<property name="use-markup">True</property>
|
|
||||||
<property name="justify">center</property>
|
|
||||||
<property name="ellipsize">end</property>
|
|
||||||
<property name="xalign">0</property>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">0</property>
|
|
||||||
<property name="top-attach">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
|
||||||
<object class="GtkComboBox" id="encoding_combobox">
|
|
||||||
<property name="visible">True</property>
|
|
||||||
<property name="can-focus">False</property>
|
|
||||||
<property name="halign">start</property>
|
|
||||||
<property name="hexpand">True</property>
|
|
||||||
<property name="model">EncodingListStore</property>
|
|
||||||
<signal name="changed" handler="on_encoding_combobox_changed" swapped="no"/>
|
|
||||||
<child>
|
|
||||||
<object class="GtkCellRendererText" id="cellrenderertext17"/>
|
|
||||||
<attributes>
|
|
||||||
<attribute name="text">0</attribute>
|
|
||||||
</attributes>
|
|
||||||
</child>
|
|
||||||
</object>
|
|
||||||
<packing>
|
|
||||||
<property name="left-attach">1</property>
|
|
||||||
<property name="top-attach">3</property>
|
|
||||||
</packing>
|
|
||||||
</child>
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkButton" id="reset_compat_defaults_button">
|
<object class="GtkButton" id="reset_compat_defaults_button">
|
||||||
<property name="label" translatable="yes">_Reset Compatibility Options to Defaults</property>
|
<property name="label" translatable="yes">_Reset Compatibility Options to Defaults</property>
|
||||||
|
@ -3101,7 +3057,7 @@
|
||||||
</object>
|
</object>
|
||||||
<packing>
|
<packing>
|
||||||
<property name="left-attach">0</property>
|
<property name="left-attach">0</property>
|
||||||
<property name="top-attach">4</property>
|
<property name="top-attach">3</property>
|
||||||
<property name="width">2</property>
|
<property name="width">2</property>
|
||||||
</packing>
|
</packing>
|
||||||
</child>
|
</child>
|
||||||
|
@ -4127,7 +4083,6 @@ Much of the behavior of Terminator is based on GNOME Terminal, and we are adding
|
||||||
<widgets>
|
<widgets>
|
||||||
<widget name="backspace_binding_combobox"/>
|
<widget name="backspace_binding_combobox"/>
|
||||||
<widget name="delete_binding_combobox"/>
|
<widget name="delete_binding_combobox"/>
|
||||||
<widget name="encoding_combobox"/>
|
|
||||||
</widgets>
|
</widgets>
|
||||||
</object>
|
</object>
|
||||||
<object class="GtkAdjustment" id="background_image_shading_adjustment">
|
<object class="GtkAdjustment" id="background_image_shading_adjustment">
|
||||||
|
|
|
@ -14,7 +14,6 @@ from .util import dbg, err
|
||||||
from . import config
|
from . import config
|
||||||
from .keybindings import Keybindings, KeymapError
|
from .keybindings import Keybindings, KeymapError
|
||||||
from .translation import _
|
from .translation import _
|
||||||
from .encoding import TerminatorEncoding
|
|
||||||
from .terminator import Terminator
|
from .terminator import Terminator
|
||||||
from .plugin import PluginRegistry
|
from .plugin import PluginRegistry
|
||||||
from .version import APP_NAME
|
from .version import APP_NAME
|
||||||
|
@ -687,23 +686,6 @@ class PrefsEditor:
|
||||||
widget.set_active(3)
|
widget.set_active(3)
|
||||||
else:
|
else:
|
||||||
widget.set_active(0)
|
widget.set_active(0)
|
||||||
# Encoding
|
|
||||||
rowiter = None
|
|
||||||
widget = guiget('encoding_combobox')
|
|
||||||
encodingstore = guiget('EncodingListStore')
|
|
||||||
value = self.config['encoding']
|
|
||||||
encodings = TerminatorEncoding().get_list()
|
|
||||||
encodings.sort(key=lambda x: x[2].lower())
|
|
||||||
|
|
||||||
for encoding in encodings:
|
|
||||||
if encoding[1] is None:
|
|
||||||
continue
|
|
||||||
|
|
||||||
label = "%s %s" % (encoding[2], encoding[1])
|
|
||||||
rowiter = encodingstore.append([label, encoding[1]])
|
|
||||||
|
|
||||||
if encoding[1] == value:
|
|
||||||
widget.set_active_iter(rowiter)
|
|
||||||
|
|
||||||
## Titlebar tab
|
## Titlebar tab
|
||||||
# Titlebar colors
|
# Titlebar colors
|
||||||
|
@ -924,15 +906,6 @@ class PrefsEditor:
|
||||||
self.config['backspace_binding'] = value
|
self.config['backspace_binding'] = value
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
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()
|
|
||||||
|
|
||||||
def on_scrollback_lines_spinbutton_value_changed(self, widget):
|
def on_scrollback_lines_spinbutton_value_changed(self, widget):
|
||||||
"""Scrollback lines setting changed"""
|
"""Scrollback lines setting changed"""
|
||||||
value = widget.get_value_as_int()
|
value = widget.get_value_as_int()
|
||||||
|
|
|
@ -98,8 +98,6 @@ class Terminal(Gtk.VBox):
|
||||||
matches = None
|
matches = None
|
||||||
regex_flags = None
|
regex_flags = None
|
||||||
config = None
|
config = None
|
||||||
default_encoding = None
|
|
||||||
custom_encoding = None
|
|
||||||
custom_font_size = None
|
custom_font_size = None
|
||||||
layout_command = None
|
layout_command = None
|
||||||
relaunch_command = None
|
relaunch_command = None
|
||||||
|
@ -165,7 +163,6 @@ class Terminal(Gtk.VBox):
|
||||||
|
|
||||||
|
|
||||||
self.vte.show()
|
self.vte.show()
|
||||||
self.default_encoding = self.vte.get_encoding()
|
|
||||||
self.update_url_matches()
|
self.update_url_matches()
|
||||||
|
|
||||||
self.terminalbox = self.create_terminalbox()
|
self.terminalbox = self.create_terminalbox()
|
||||||
|
@ -660,8 +657,6 @@ class Terminal(Gtk.VBox):
|
||||||
self.cnxids.new(self.vte, 'child-exited',
|
self.cnxids.new(self.vte, 'child-exited',
|
||||||
lambda x, y: self.emit('close-term'))
|
lambda x, y: self.emit('close-term'))
|
||||||
|
|
||||||
if self.custom_encoding != True:
|
|
||||||
self.vte.set_encoding(self.config['encoding'])
|
|
||||||
# Word char support was missing from vte 0.38, silently skip this setting
|
# Word char support was missing from vte 0.38, silently skip this setting
|
||||||
if hasattr(self.vte, 'set_word_char_exceptions'):
|
if hasattr(self.vte, 'set_word_char_exceptions'):
|
||||||
self.vte.set_word_char_exceptions(self.config['word_chars'])
|
self.vte.set_word_char_exceptions(self.config['word_chars'])
|
||||||
|
@ -1077,14 +1072,6 @@ class Terminal(Gtk.VBox):
|
||||||
else:
|
else:
|
||||||
widget.show()
|
widget.show()
|
||||||
|
|
||||||
def on_encoding_change(self, _widget, encoding):
|
|
||||||
"""Handle the encoding changing"""
|
|
||||||
current = self.vte.get_encoding()
|
|
||||||
if current != encoding:
|
|
||||||
dbg('on_encoding_change: setting encoding to: %s' % encoding)
|
|
||||||
self.custom_encoding = not (encoding == self.config['encoding'])
|
|
||||||
self.vte.set_encoding(encoding)
|
|
||||||
|
|
||||||
def on_drag_begin(self, widget, drag_context, _data):
|
def on_drag_begin(self, widget, drag_context, _data):
|
||||||
"""Handle the start of a drag event"""
|
"""Handle the start of a drag event"""
|
||||||
Gtk.drag_set_icon_pixbuf(drag_context, util.widget_pixbuf(self, 512), 0, 0)
|
Gtk.drag_set_icon_pixbuf(drag_context, util.widget_pixbuf(self, 512), 0, 0)
|
||||||
|
|
|
@ -7,7 +7,6 @@ from gi.repository import Gtk
|
||||||
|
|
||||||
from .version import APP_NAME
|
from .version import APP_NAME
|
||||||
from .translation import _
|
from .translation import _
|
||||||
from .encoding import TerminatorEncoding
|
|
||||||
from .terminator import Terminator
|
from .terminator import Terminator
|
||||||
from .util import err, dbg, spawn_new_terminator
|
from .util import err, dbg, spawn_new_terminator
|
||||||
from .config import Config
|
from .config import Config
|
||||||
|
@ -221,7 +220,6 @@ class TerminalPopupMenu(object):
|
||||||
item.connect('activate', terminal.force_set_profile, profile)
|
item.connect('activate', terminal.force_set_profile, profile)
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
|
||||||
self.add_encoding_items(menu)
|
|
||||||
self.add_layout_launcher(menu)
|
self.add_layout_launcher(menu)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
@ -256,69 +254,3 @@ class TerminalPopupMenu(object):
|
||||||
item = Gtk.MenuItem(layout)
|
item = Gtk.MenuItem(layout)
|
||||||
item.connect('activate', lambda x: spawn_new_terminator(self.terminator.origcwd, ['-u', '-l', layout]))
|
item.connect('activate', lambda x: spawn_new_terminator(self.terminator.origcwd, ['-u', '-l', layout]))
|
||||||
submenu.append(item)
|
submenu.append(item)
|
||||||
|
|
||||||
def add_encoding_items(self, menu):
|
|
||||||
"""Add the encoding list to the menu"""
|
|
||||||
terminal = self.terminal
|
|
||||||
active_encodings = terminal.config['active_encodings']
|
|
||||||
item = Gtk.MenuItem.new_with_mnemonic(_("Encodings"))
|
|
||||||
menu.append (item)
|
|
||||||
submenu = Gtk.Menu ()
|
|
||||||
item.set_submenu (submenu)
|
|
||||||
encodings = TerminatorEncoding ().get_list ()
|
|
||||||
encodings.sort (key=lambda x: x[2].lower ())
|
|
||||||
|
|
||||||
current_encoding = terminal.vte.get_encoding ()
|
|
||||||
group = None
|
|
||||||
|
|
||||||
if current_encoding not in active_encodings:
|
|
||||||
active_encodings.insert (0, _(current_encoding))
|
|
||||||
|
|
||||||
for encoding in active_encodings:
|
|
||||||
if encoding == terminal.default_encoding:
|
|
||||||
extratext = " (%s)" % _("Default")
|
|
||||||
elif encoding == current_encoding and \
|
|
||||||
terminal.custom_encoding == True:
|
|
||||||
extratext = " (%s)" % _("User defined")
|
|
||||||
else:
|
|
||||||
extratext = ""
|
|
||||||
|
|
||||||
radioitem = Gtk.RadioMenuItem (_(encoding) + extratext, group)
|
|
||||||
|
|
||||||
if encoding == current_encoding:
|
|
||||||
radioitem.set_active (True)
|
|
||||||
|
|
||||||
if group is None:
|
|
||||||
group = radioitem
|
|
||||||
|
|
||||||
radioitem.connect ('activate', terminal.on_encoding_change,
|
|
||||||
encoding)
|
|
||||||
submenu.append (radioitem)
|
|
||||||
|
|
||||||
item = Gtk.MenuItem.new_with_mnemonic(_("Other Encodings"))
|
|
||||||
submenu.append (item)
|
|
||||||
#second level
|
|
||||||
|
|
||||||
submenu = Gtk.Menu ()
|
|
||||||
item.set_submenu (submenu)
|
|
||||||
group = None
|
|
||||||
|
|
||||||
for encoding in encodings:
|
|
||||||
if encoding[1] in active_encodings:
|
|
||||||
continue
|
|
||||||
|
|
||||||
if encoding[1] is None:
|
|
||||||
label = "%s %s" % (encoding[2], terminal.vte.get_encoding ())
|
|
||||||
else:
|
|
||||||
label = "%s %s" % (encoding[2], encoding[1])
|
|
||||||
|
|
||||||
radioitem = Gtk.RadioMenuItem (label, group)
|
|
||||||
if group is None:
|
|
||||||
group = radioitem
|
|
||||||
|
|
||||||
if encoding[1] == current_encoding:
|
|
||||||
radioitem.set_active (True)
|
|
||||||
|
|
||||||
radioitem.connect ('activate', terminal.on_encoding_change,
|
|
||||||
encoding[1])
|
|
||||||
submenu.append (radioitem)
|
|
||||||
|
|
Loading…
Reference in New Issue