summary refs log tree commit diff stats
path: root/doc/print_keys.py
blob: f87a2a408ae3b609de5cc1e9b3ad113ba8a4b55f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#!/usr/bin/env python
"""
You can use this tool to find out values of keypresses
"""

from curses import *

sep = '; '

@wrapper
def main(w):
	while True:
		w.addstr(str(w.getch()) + sep)
pe that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. if __name__ == '__main__': from __init__ import init; init() import unittest from ranger.gui import ansi class TestDisplayable(unittest.TestCase): def test_char_len(self): ansi_string = "X" self.assertEqual(ansi.char_len(ansi_string), 1) def test_char_len2(self): ansi_string = "XY" self.assertEqual(ansi.char_len(ansi_string), 2) def test_char_len3(self): ansi_string = "XY" self.assertEqual(ansi.char_len(ansi_string), 2) def test_char_slice(self): ansi_string = "XY" expected = "X" self.assertEqual(ansi.char_slice(ansi_string, 0, 1), expected) if __name__ == '__main__': unittest.main()