Package libxyz :: Package ui :: Module keys
[hide private]
[frames] | no frames]

Source Code for Module libxyz.ui.keys

 1  #-*- coding: utf8 -* 
 2  # 
 3  # Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008 
 4  # 
 5  # This file is part of XYZCommander. 
 6  # XYZCommander is free software: you can redistribute it and/or modify 
 7  # it under the terms of the GNU Lesser Public License as published by 
 8  # the Free Software Foundation, either version 3 of the License, or 
 9  # (at your option) any later version. 
10  # XYZCommander is distributed in the hope that it will be useful, 
11  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
12  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 
13  # GNU Lesser Public License for more details. 
14  # You should have received a copy of the GNU Lesser Public License 
15  # along with XYZCommander. If not, see <http://www.gnu.org/licenses/>. 
16   
17 -class Keys(object):
18 """ 19 Keys abstractions 20 """ 21
22 - def __init__(self):
23 self._data = { 24 "CONTROL": "ctrl", 25 "CTRL": "ctrl", 26 "META": "meta", 27 "ESCAPE": "esc", 28 "ESC": "esc", 29 "SHIFT": "shift", 30 "UP": "up", 31 "DOWN": "down", 32 "RIGHT": "right", 33 "LEFT": "left", 34 "END": "end", 35 "HOME": "home", 36 "INSERT": "insert", 37 "DELETE": "delete", 38 "PAGE_UP": "page up", 39 "PAGE_DOWN": "page down", 40 "ENTER": "enter", 41 "TAB": "tab", 42 "BACKSPACE": "backspace", 43 "F1": "f1", 44 "F2": "f2", 45 "F3": "f3", 46 "F4": "f4", 47 "F5": "f5", 48 "F6": "f6", 49 "F7": "f7", 50 "F8": "f8", 51 "F9": "f9", 52 "F10": "f10", 53 "F11": "f11", 54 "F12": "f12", 55 "F13": "f13", 56 "F14": "f14", 57 "F15": "f15", 58 "F16": "f16", 59 "F17": "f17", 60 "F18": "f18", 61 "F19": "f19", 62 "F20": "f20", 63 } 64 65 for _k, _v in self._data.iteritems(): 66 setattr(self, _k, _v)
67 68 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 69
70 - def get_key(self, low):
71 """ 72 Get attribute name by lowlevel representation 73 """ 74 75 for _k, _v in self._data.iteritems(): 76 if _v == low: 77 return _k 78 79 return None
80