Set the keymap to associate with the specified tool. Parameters ---------- name : str Name of the Tool. key : str or list of str Keys to associate with the tool.
(self, name, key)
| 174 | del self._keys[k] |
| 175 | |
| 176 | def update_keymap(self, name, key): |
| 177 | """ |
| 178 | Set the keymap to associate with the specified tool. |
| 179 | |
| 180 | Parameters |
| 181 | ---------- |
| 182 | name : str |
| 183 | Name of the Tool. |
| 184 | key : str or list of str |
| 185 | Keys to associate with the tool. |
| 186 | """ |
| 187 | if name not in self._tools: |
| 188 | raise KeyError(f'{name!r} not in Tools') |
| 189 | self._remove_keys(name) |
| 190 | if isinstance(key, str): |
| 191 | key = [key] |
| 192 | for k in key: |
| 193 | if k in self._keys: |
| 194 | _api.warn_external( |
| 195 | f'Key {k} changed from {self._keys[k]} to {name}') |
| 196 | self._keys[k] = name |
| 197 | |
| 198 | def remove_tool(self, name): |
| 199 | """ |