diff options
author | Daiki Ueno <ueno@unixuser.org> | 2012-10-30 18:01:13 +0900 |
---|---|---|
committer | Daiki Ueno <ueno@unixuser.org> | 2012-10-31 09:57:45 +0900 |
commit | 6c46656de7183f2d5700806e4728dee1b0eb937a (patch) | |
tree | 362d1b079c96963c04fce600bc557d78014d001b /caribou | |
parent | d4c2802768ef1a6bd4943091ff713bce782f016d (diff) | |
download | caribou-6c46656de7183f2d5700806e4728dee1b0eb937a.tar.gz |
Port label string construction code to libcaribou
Move the key label construction code from Antler to libcaribou and
also handle the "text" attribute of key.
https://bugzilla.gnome.org/show_bug.cgi?id=656175
Diffstat (limited to 'caribou')
-rw-r--r-- | caribou/antler/keyboard_view.py | 32 |
1 files changed, 2 insertions, 30 deletions
diff --git a/caribou/antler/keyboard_view.py b/caribou/antler/keyboard_view.py index 7b1ab2b..4862ab7 100644 --- a/caribou/antler/keyboard_view.py +++ b/caribou/antler/keyboard_view.py @@ -9,25 +9,6 @@ from gi.repository import Caribou import os from math import ceil -PRETTY_LABELS = { - "BackSpace" : u'\u232b', - "space" : u' ', - "Return" : u'\u23ce', - "Return" : u'\u23ce', - "Control_L" : u'Ctrl', - "Control_R" : u'Ctrl', - "Alt_L" : u'Alt', - "Alt_R" : u'Alt', - 'Caribou_Prefs' : u'\u2328', - 'Caribou_ShiftUp' : u'\u2b06', - 'Caribou_ShiftDown' : u'\u2b07', - 'Caribou_Emoticons' : u'\u263a', - 'Caribou_Symbols' : u'123', - 'Caribou_Symbols_More' : u'{#*', - 'Caribou_Alpha' : u'Abc', - 'Caribou_Repeat' : u'\u267b' -} - class AntlerKey(Gtk.Button): def __init__(self, key, spacing=0): GObject.GObject.__init__(self) @@ -61,17 +42,8 @@ class AntlerKey(Gtk.Button): self.unset_state_flags(Gtk.StateFlags.INCONSISTENT) def _get_key_label(self): - label = self.caribou_key().props.name - if PRETTY_LABELS.has_key(self.caribou_key().props.name): - label = PRETTY_LABELS[self.caribou_key().props.name] - elif self.caribou_key().props.name.startswith('Caribou_'): - label = self.caribou_key().name.replace('Caribou_', '') - else: - unichar = unichr(Gdk.keyval_to_unicode(self.caribou_key().props.keyval)) - if not unichar.isspace() and unichar != u'\x00': - label = unichar - - return "<b>%s</b>" % GLib.markup_escape_text(label.encode('utf-8')) + label = self.caribou_key().props.label + return "<b>%s</b>" % GLib.markup_escape_text(label) def _caribou_key_pressed (self, key, _key): self.set_state_flags(Gtk.StateFlags.ACTIVE, False) |