Enable selecting a profile's encoding via the prefs UI. Closes LP #597340
This commit is contained in:
parent
b13d7fc43c
commit
0533af23ae
@ -263,6 +263,14 @@
|
||||
<column type="gboolean"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkListStore" id="EncodingListStore">
|
||||
<columns>
|
||||
<!-- column-name Encoding -->
|
||||
<column type="gchararray"/>
|
||||
<!-- column-name config_value -->
|
||||
<column type="gchararray"/>
|
||||
</columns>
|
||||
</object>
|
||||
<object class="GtkDialog" id="prefswin">
|
||||
<property name="border_width">5</property>
|
||||
<property name="type_hint">normal</property>
|
||||
@ -2516,6 +2524,79 @@
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkVBox" id="vbox12">
|
||||
<property name="visible">True</property>
|
||||
<property name="spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label13">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes"><b>Encoding</b></property>
|
||||
<property name="use_markup">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkAlignment" id="alignment7">
|
||||
<property name="visible">True</property>
|
||||
<property name="left_padding">12</property>
|
||||
<child>
|
||||
<object class="GtkTable" id="table4">
|
||||
<property name="visible">True</property>
|
||||
<property name="n_columns">2</property>
|
||||
<property name="column_spacing">12</property>
|
||||
<property name="row_spacing">6</property>
|
||||
<child>
|
||||
<object class="GtkLabel" id="color_scheme_combobox_label1">
|
||||
<property name="visible">True</property>
|
||||
<property name="xalign">0</property>
|
||||
<property name="label" translatable="yes">Default:</property>
|
||||
<property name="use_underline">True</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="mnemonic_widget">color_scheme_combobox</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="x_options">GTK_FILL</property>
|
||||
<property name="y_options"></property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkComboBox" id="encoding_combobox">
|
||||
<property name="visible">True</property>
|
||||
<property name="model">EncodingListStore</property>
|
||||
<signal name="changed" handler="on_encoding_combobox_changed"/>
|
||||
<child>
|
||||
<object class="GtkCellRendererText" id="cellrenderertext17"/>
|
||||
<attributes>
|
||||
<attribute name="text">0</attribute>
|
||||
</attributes>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="left_attach">1</property>
|
||||
<property name="right_attach">2</property>
|
||||
<property name="y_options">GTK_FILL</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="position">5</property>
|
||||
|
@ -14,6 +14,7 @@ from util import dbg, err
|
||||
import config
|
||||
from keybindings import Keybindings, KeymapError
|
||||
from translation import _
|
||||
from encoding import TerminatorEncoding
|
||||
from terminator import Terminator
|
||||
from plugin import PluginRegistry
|
||||
|
||||
@ -499,6 +500,23 @@ class PrefsEditor:
|
||||
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(lambda x, y: cmp(x[2].lower(), y[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)
|
||||
|
||||
def set_layout(self, layout_name):
|
||||
"""Set a layout"""
|
||||
@ -607,6 +625,15 @@ class PrefsEditor:
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user