starting with encoding
This commit is contained in:
parent
4b7b1f37e4
commit
24278a3be0
4
TODO
4
TODO
|
@ -1,2 +1,6 @@
|
|||
* Edit doc/terminatorrc.5 manpage to contain the information about the options
|
||||
* Write a Tab feature for terminator
|
||||
|
||||
* handling encoding
|
||||
print self._vte.get_encoding ()
|
||||
actually defaults to UTF-8
|
||||
|
|
31
terminator
31
terminator
|
@ -103,6 +103,7 @@ class TerminatorTerm:
|
|||
self._box.show()
|
||||
self._box.pack_start(self._titlebox, False)
|
||||
self._box.pack_start(self._termbox)
|
||||
|
||||
if len(self.terminator.term_list) > 0 and self.conf.titlebars:
|
||||
if len(self.terminator.term_list) == 1:
|
||||
self.terminator.term_list[0]._titlebox.show()
|
||||
|
@ -311,6 +312,12 @@ class TerminatorTerm:
|
|||
# Set our sloppiness
|
||||
self.focus = self.conf.focus
|
||||
|
||||
def on_encoding_change (self, widget, encoding):
|
||||
current = self._vte.get_encoding()
|
||||
if current != encoding:
|
||||
print ('Setting Encoding to ' + encoding)
|
||||
self._vte.set_encoding(encoding)
|
||||
|
||||
def on_composited_changed (self, widget):
|
||||
self.reconfigure_vte ()
|
||||
|
||||
|
@ -487,6 +494,8 @@ class TerminatorTerm:
|
|||
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True))
|
||||
menu.append (item)
|
||||
|
||||
self._do_encoding_items(menu)
|
||||
|
||||
item = gtk.MenuItem ()
|
||||
menu.append (item)
|
||||
|
||||
|
@ -497,6 +506,28 @@ class TerminatorTerm:
|
|||
menu.show_all ()
|
||||
return menu
|
||||
|
||||
def _do_encoding_items(self, menu):
|
||||
|
||||
|
||||
item = gtk.MenuItem (_("Encoding"))
|
||||
menu.append(item)
|
||||
submenu = gtk.Menu()
|
||||
item.set_submenu(submenu)
|
||||
|
||||
|
||||
current_encoding = self._vte.get_encoding ()
|
||||
group = None
|
||||
for encoding in self.conf.active_encodings:
|
||||
radioitem = gtk.RadioMenuItem(group, _(encoding))
|
||||
if group is None:
|
||||
group = radioitem
|
||||
|
||||
if encoding == current_encoding:
|
||||
radioitem.set_active(True)
|
||||
|
||||
radioitem.connect('activate', self.on_encoding_change, encoding)
|
||||
submenu.append(radioitem)
|
||||
|
||||
def on_vte_title_change(self, vte):
|
||||
if self.conf.titletips:
|
||||
vte.set_property ("has-tooltip", True)
|
||||
|
|
|
@ -110,6 +110,8 @@ class TerminatorConfValuestore:
|
|||
'use_theme_colors' : True,
|
||||
'http_proxy' : '',
|
||||
'ignore_hosts' : ['localhost','127.0.0.0/8','*.local'],
|
||||
'encoding' : 'UTF-8',
|
||||
'active_encodings' : ['UTF-8', 'ISO-8859-1'],
|
||||
}
|
||||
|
||||
def __getattr__ (self, keyname):
|
||||
|
@ -234,9 +236,13 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
|
|||
value = 'http://%s:%s/'%(
|
||||
self.client.get_string ('/system/http_proxy/host'),
|
||||
self.client.get_int ('/system/http_proxy/port'))
|
||||
elif key == 'active_encodings':
|
||||
value = self.client.get_list (self._gt_dir + '/global/active_encodings', 'string')
|
||||
else:
|
||||
value = self.client.get ('%s/%s'%(self.profile, key))
|
||||
|
||||
|
||||
|
||||
if value:
|
||||
funcname = "get_" + self.defaults[key].__class__.__name__
|
||||
dbg (' GConf: picked function: %s'%funcname)
|
||||
|
|
Loading…
Reference in New Issue