Trees | Indices | Help |
|
---|
|
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/>. 1618 """ 19 Wrap get_input and seek in user-defined keycodes before return keys 20 """ 21 22 WIN_RESIZE = 'window resize' 239025 self.xyz = xyz 26 self.plugin = xyz.pm.load(u":core:keycodes") 27 self.keycodes = {} 28 self._resized = False 29 30 self.update()31 32 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3335 """ 36 Set/load keycodes data 37 @param data: Keycodes data. If not provided load via get_keys() 38 @type data: dict 39 """ 40 41 if data is not None: 42 self.keycodes = data 43 else: 44 self.keycodes = self.plugin.get_keys()45 46 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 4749 """ 50 Get input from screen and search if it matches any user-defined 51 keycodes 52 """ 53 54 _input = None 55 56 while True: 57 _in = self.xyz.screen.get_input() 58 59 if not _in: 60 continue 61 62 if self.WIN_RESIZE in _in: 63 self._resized = True 64 65 try: 66 _input = [self.keycodes[tuple(_in)]] 67 except KeyError: 68 _input = _in 69 finally: 70 break 71 72 return _input73 74 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 75 83 84 #~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 85 88 89 resized = property(_resized_get, _resized_set)
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Aug 3 02:02:16 2009 | http://epydoc.sourceforge.net |