Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Encoding settings (deprecated) #536

Merged
merged 2 commits into from Nov 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 0 additions & 2 deletions terminatorlib/config.py
Expand Up @@ -245,8 +245,6 @@
'use_theme_colors' : False,
'bold_is_bright' : False,
'line_height' : 1.0,
'encoding' : 'UTF-8',
'active_encodings' : ['UTF-8', 'ISO-8859-1'],
'focus_on_close' : 'auto',
'force_no_bell' : False,
'cycle_term_tab' : True,
Expand Down
118 changes: 0 additions & 118 deletions terminatorlib/encoding.py

This file was deleted.

49 changes: 2 additions & 47 deletions terminatorlib/preferences.glade
Expand Up @@ -137,14 +137,6 @@
</row>
</data>
</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">
<columns>
<!-- column-name focustype -->
Expand Down Expand Up @@ -2955,7 +2947,7 @@
</packing>
</child>
<child>
<!-- n-columns=2 n-rows=5 -->
<!-- n-columns=2 n-rows=4 -->
<object class="GtkGrid" id="grid15">
<property name="visible">True</property>
<property name="can-focus">False</property>
Expand Down Expand Up @@ -3051,42 +3043,6 @@
<property name="top-attach">2</property>
</packing>
</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>
<object class="GtkButton" id="reset_compat_defaults_button">
<property name="label" translatable="yes">_Reset Compatibility Options to Defaults</property>
Expand All @@ -3101,7 +3057,7 @@
</object>
<packing>
<property name="left-attach">0</property>
<property name="top-attach">4</property>
<property name="top-attach">3</property>
<property name="width">2</property>
</packing>
</child>
Expand Down Expand Up @@ -4127,7 +4083,6 @@ Much of the behavior of Terminator is based on GNOME Terminal, and we are adding
<widgets>
<widget name="backspace_binding_combobox"/>
<widget name="delete_binding_combobox"/>
<widget name="encoding_combobox"/>
</widgets>
</object>
<object class="GtkAdjustment" id="background_image_shading_adjustment">
Expand Down
27 changes: 0 additions & 27 deletions terminatorlib/prefseditor.py
Expand Up @@ -14,7 +14,6 @@
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
Expand Down Expand Up @@ -687,23 +686,6 @@ def on_palette_click(event, data, widget=widget):
widget.set_active(3)
else:
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 colors
Expand Down Expand Up @@ -924,15 +906,6 @@ def on_backspace_binding_combobox_changed(self, widget):
self.config['backspace_binding'] = value
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):
"""Scrollback lines setting changed"""
value = widget.get_value_as_int()
Expand Down
13 changes: 0 additions & 13 deletions terminatorlib/terminal.py
Expand Up @@ -98,8 +98,6 @@ class Terminal(Gtk.VBox):
matches = None
regex_flags = None
config = None
default_encoding = None
custom_encoding = None
custom_font_size = None
layout_command = None
relaunch_command = None
Expand Down Expand Up @@ -165,7 +163,6 @@ def __init__(self):


self.vte.show()
self.default_encoding = self.vte.get_encoding()
self.update_url_matches()

self.terminalbox = self.create_terminalbox()
Expand Down Expand Up @@ -660,8 +657,6 @@ def reconfigure(self, _widget=None):
self.cnxids.new(self.vte, 'child-exited',
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
if hasattr(self.vte, 'set_word_char_exceptions'):
self.vte.set_word_char_exceptions(self.config['word_chars'])
Expand Down Expand Up @@ -1077,14 +1072,6 @@ def toggle_widget_visibility(self, widget):
else:
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):
"""Handle the start of a drag event"""
Gtk.drag_set_icon_pixbuf(drag_context, util.widget_pixbuf(self, 512), 0, 0)
Expand Down
68 changes: 0 additions & 68 deletions terminatorlib/terminal_popup_menu.py
Expand Up @@ -7,7 +7,6 @@

from .version import APP_NAME
from .translation import _
from .encoding import TerminatorEncoding
from .terminator import Terminator
from .util import err, dbg, spawn_new_terminator
from .config import Config
Expand Down Expand Up @@ -221,7 +220,6 @@ def show(self, widget, event=None):
item.connect('activate', terminal.force_set_profile, profile)
submenu.append(item)

self.add_encoding_items(menu)
self.add_layout_launcher(menu)

try:
Expand Down Expand Up @@ -256,69 +254,3 @@ def add_layout_launcher(self, menu):
item = Gtk.MenuItem(layout)
item.connect('activate', lambda x: spawn_new_terminator(self.terminator.origcwd, ['-u', '-l', layout]))
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)