Mercurial > urwid-satext
annotate urwid_satext/keys.py @ 84:9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 04 Sep 2014 16:50:12 +0200 |
parents | |
children | e0c8274f9b1c |
rev | line source |
---|---|
84
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
4 # Urwid SàT extensions |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
5 # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014 Jérôme Poisson (goffi@goffi.org) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 # |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
8 # it under the terms of the GNU Lesser General Public License as published by |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
10 # (at your option) any later version. |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 # |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
15 # GNU Lesser General Public License for more details. |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 # |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
17 # You should have received a copy of the GNU Lesser General Public License |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
20 """This module manage action <==> key mapping and can be extended to add new actions""" |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
21 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
22 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
23 class ConflictError(Exception): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
24 pass |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
25 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 class ActionMap(dict): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 """Object which manage mapping betwwen actions and keys""" |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 def __init__(self, source_dict=None): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
31 """ Initialise the map |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
32 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
33 @param source_dict: dictionary-like object with actions to import |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
34 """ |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
35 self._namespaces_actions = {} # key = namespace, values (set) = actions |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
36 self._close_namespaces = tuple() |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
37 self._alway_check_namespaces = None |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
38 if source_dict is not None: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
39 self.update(source_dict) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
40 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
41 def __setitem__(self, action, shortcut): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
42 """set an action avoiding conflicts |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
43 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
44 @param action (str,tuple): either an action (str) or a (namespace, action) tuple. action without namespace will not be checked by cbeck_namespaces(). namespace can also be a tuple itself, the action will the be assigned to several namespaces. |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
45 @param shortcut (str): key shortcut for this action |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
46 @raise: ConflictError if the action already exists |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
47 """ |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
48 if isinstance(action, tuple): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
49 namespaces, action = action |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
50 if not isinstance(namespaces, tuple): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
51 namespaces = (namespaces,) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
52 for namespace in namespaces: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
53 namespace_map = self._namespaces_actions.setdefault(namespace.lower(), set()) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
54 namespace_map.add(action) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
55 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
56 if action in self: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
57 raise ConflictError("The action [{}] already exists".format(action)) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
58 return super(ActionMap, self).__setitem__(action, shortcut.lower()) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
59 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
60 def __delitem__(self, action): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
61 # we don't want to delete actions |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
62 raise NotImplementedError |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
63 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
64 def update(self, dict_like): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
65 """Update actions with an other dictionary |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
66 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
67 @param dict_like: dictionary like object to update actions |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
68 @raise: ConflictError if at least one of the new actions already exists |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
69 """ |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
70 if not isinstance(dict_like, dict): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
71 raise ValueError("only dictionary subclasses are accepted for update") |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
72 conflict = dict_like.viewkeys() & self.viewkeys() |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
73 if conflict: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
74 raise ConflictError("The actions [{}] already exists".format(','.join(conflict))) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
75 for action, shortcut in dict_like.iteritems(): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
76 self[action] = shortcut |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
77 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
78 def set_close_namespaces(self, close_namespaces, always_check=None): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
79 """Set namespaces where conflicting shortcut should not happen |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
80 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 used by check_namespaces to see if the same shortcut is not used in two close namespaces (e.g. 'tab' used in edit_bar and globally) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
82 @param close_namespaces (tuple of tuples): tuple indicating namespace where shortcut should not conflict. e.g.: (('global', 'edit'), ('confirm', 'popup', 'global')) indicate that shortcut in 'global' and 'edit' should not be the same, nor the ones between 'confirm', 'popup' and 'global'. |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
83 @param always_check (tuple): if not None, these namespaces will be close to every other ones (useful for global namespace) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
84 """ |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
85 assert isinstance(close_namespaces, tuple) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
86 if always_check is not None: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
87 assert isinstance(always_check, tuple) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
88 self._close_namespaces = close_namespaces |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
89 self._alway_check_namespaces = always_check |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
90 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
91 def check_namespaces(self): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
92 """Check that shortcuts are not conflicting in close namespaces""" |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
93 # we first check each namespace individually |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
94 checked = set() |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
96 def check_namespaces(namespaces): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 # for each namespace which save keys used |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
98 # if 1 key is used several times, we raise |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
99 # a ConflictError |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
100 set_shortcuts = {} |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
101 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
102 to_check = set(namespaces + self._alway_check_namespaces) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
103 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
104 for namespace in to_check: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
105 checked.add(namespace) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
106 for action in self._namespaces_actions[namespace]: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
107 shortcut = self[action] |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
108 if shortcut in set_shortcuts: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
109 set_namespace = set_shortcuts[shortcut] |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
110 if set_namespace == namespace: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
111 msg = 'shortcut [{}] is not unique in namespace "{}"'.format(shortcut, namespace) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
112 else: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
113 msg = 'shortcut [{}] is used both in namespaces "{}" and "{}"'.format(shortcut, set_namespace, namespace) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
114 raise ConflictError(msg) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
115 set_shortcuts[shortcut] = namespace |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
116 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
117 # we first check close namespaces |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
118 for close_namespaces in self._close_namespaces: |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
119 check_namespaces(close_namespaces) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
120 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
121 # then the remaining ones |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
122 for namespace in set(self._namespaces_actions.keys()).difference(checked): |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
123 check_namespaces((namespace,)) |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
124 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
125 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
126 keys = { |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
127 ("edit", "EDIT_HOME"): 'ctrl a', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
128 ("edit", "EDIT_END"): 'ctrl e', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
129 ("edit", "EDIT_DELETE_TO_END"): 'ctrl k', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
130 ("edit", "EDIT_DELETE_LAST_WORD"): 'ctrl w', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
131 ("edit", "EDIT_ENTER"): 'enter', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
132 ("edit", "EDIT_COMPLETE"): 'shift tab', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
133 (("edit", "modal"), "MODAL_ESCAPE"): 'esc', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
134 ("selectable", "TEXT_SELECT"): ' ', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
135 ("selectable", "TEXT_SELECT2"): 'enter', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
136 ("menu_box", "MENU_BOX_UP"): 'up', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
137 ("menu_box", "MENU_BOX_LEFT"): 'left', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
138 ("menu_box", "MENU_BOX_RIGHT"): 'right', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
139 ("menu", "MENU_DOWN"): 'down', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
140 ("menu", "MENU_UP"): 'up', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
141 ("menu_roller", "MENU_ROLLER_UP"): 'up', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
142 ("menu_roller", "MENU_ROLLER_DOWN"): 'down', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
143 ("menu_roller", "MENU_ROLLER_RIGHT"): 'right', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
144 ("columns_roller", "COLUMNS_ROLLER_LEFT"): 'left', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
145 ("columns_roller", "COLUMNS_ROLLER_RIGHT"): 'right', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
146 ("focus", "FOCUS_SWITCH"): 'tab', |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
147 } |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
148 |
9f683df69a4c
shortcut keys are now managed in separate module, with a class checking for conflicts
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
149 action_key_map = ActionMap(keys) |