1
2
3
4
5
6 from libxyz.core.plugins import BasePlugin
7 from libxyz.core.utils import ustring, bstring
8
9 import libxyz.ui as uilib
10
12 """
13 Plugin testinput
14 """
15
16 NAME = u"testinput"
17 AUTHOR = u"Max E. Kuznecov <syhpoon@syhpoon.name>"
18 VERSION = u"0.1"
19 BRIEF_DESCRIPTION = u"Test input"
20 FULL_DESCRIPTION = u"Simple dialog to show pressed keys.\n"\
21 u"Shortcut is what XYZCommander expects to see in "\
22 u"configuration files.\n"\
23 u"Raw is what low-level library emits to focus widget"
24 NAMESPACE = u"ui"
25 MIN_XYZ_VERSION = None
26 DOC = None
27 HOMEPAGE = u"xyzcmd.syhpoon.name"
28
35
36
37
39 """
40 Show test_box dialog
41 @param use_wrap: Whether to use input wrapper which honours
42 learned keys
43 """
44
45 _msg = _(u"Press any key. Escape twice to quit.")
46
47 _escape = 0
48
49 while True:
50 _input = InputBox(self.xyz, self.xyz.top, bstring(_msg),
51 _(u"Input test")).show(use_wrap=use_wrap)
52
53 if self._keys.ESCAPE in _input:
54 _escape += 1
55 if _escape == 2:
56 return
57 else:
58 _escape = 0
59
60 shortcut = uilib.Shortcut(raw=_input)
61
62 _low = [ustring(x) for x in _input]
63 _msg = u"Shortcut: '%s'. Raw: '%s'" % (
64 (u" ".join([ustring(x) for x in shortcut.sc]),
65 u" ".join([ustring(x) for x in shortcut.raw])))
66
67
68
88