starting with encoding

This commit is contained in:
Emmanuel Bretelle 2008-05-15 07:41:00 +01:00
parent 4b7b1f37e4
commit 24278a3be0
3 changed files with 45 additions and 4 deletions

4
TODO
View File

@ -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

View File

@ -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()
@ -310,7 +311,13 @@ 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,16 +494,40 @@ 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)
item = gtk.ImageMenuItem (gtk.STOCK_CLOSE)
item.connect ("activate", lambda menu_item: self.terminator.closeterm (self))
menu.append (item)
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)

View File

@ -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):
@ -212,7 +214,7 @@ class TerminatorConfValuestoreGConf (TerminatorConfValuestore):
value = None
dbg (' VSGConf: preparing: %s/%s'%(self.profile, key))
# FIXME: Ugly special cases we should look to fix in some other way.
if key == 'font' and self.use_system_font:
value = self.client.get ('/desktop/gnome/interface/monospace_font_name')
@ -234,8 +236,12 @@ 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__