MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / _handle_key

Method _handle_key

dm_control/viewer/user_input.py:275–293  ·  view source on GitHub ↗

Handles a single key press (mouse and keyboard).

(self, key, action, modifiers)

Source from the content-addressed store, hash-verified

273 self._z_axis_callback.append(callback)
274
275 def _handle_key(self, key, action, modifiers):
276 """Handles a single key press (mouse and keyboard)."""
277 alias_key = (key, modifiers)
278
279 exclusive_key, exclusive_callback = self._active_exclusive
280 if exclusive_key is not None:
281 if action == RELEASE and key == exclusive_key:
282 exclusive_callback(False)
283 self._active_exclusive = _NO_EXCLUSIVE_KEY
284 else:
285 is_exclusive, callback = self._action_callbacks.get(
286 alias_key, _NO_CALLBACK)
287 if callback:
288 if action == PRESS:
289 if is_exclusive:
290 callback(True)
291 self._active_exclusive = (key, callback)
292 else:
293 callback()
294
295 def _handle_double_click(self, key, modifiers):
296 """Handles a double mouse click."""

Calls 1

getMethod · 0.45