def test_binding_exclusive(self): self.input_map.bind(self.callback, user_input.Exclusive(user_input.KEY_UP)) expected_dict = { (user_input.KEY_UP, user_input.MOD_NONE): (True, self.callback) } self.assertDictEqual(expected_dict, self.input_map._action_callbacks)
# limitations under the License. # ============================================================================ """Mujoco Physics viewer, with custom input controllers.""" from dm_control.mujoco.wrapper import mjbindings from dm_control.viewer import renderer from dm_control.viewer import user_input from dm_control.viewer import util constants = mjbindings.constants enums = mjbindings.enums functions = mjbindings.functions _NUM_GROUP_KEYS = 10 _PAN_CAMERA_VERTICAL_MOUSE = user_input.Exclusive( user_input.MOUSE_BUTTON_RIGHT) _PAN_CAMERA_HORIZONTAL_MOUSE = user_input.Exclusive( (user_input.MOUSE_BUTTON_RIGHT, user_input.MOD_SHIFT)) _ROTATE_OBJECT_MOUSE = user_input.Exclusive( (user_input.MOUSE_BUTTON_LEFT, user_input.MOD_CONTROL)) _MOVE_OBJECT_VERTICAL_MOUSE = user_input.Exclusive( (user_input.MOUSE_BUTTON_RIGHT, user_input.MOD_CONTROL)) _MOVE_OBJECT_HORIZONTAL_MOUSE = user_input.Exclusive( (user_input.MOUSE_BUTTON_RIGHT, user_input.MOD_SHIFT_CONTROL)) _PAN_CAMERA_VERTICAL_TOUCHPAD = user_input.Exclusive( (user_input.MOUSE_BUTTON_LEFT, user_input.MOD_ALT)) _PAN_CAMERA_HORIZONTAL_TOUCHPAD = user_input.Exclusive( (user_input.MOUSE_BUTTON_RIGHT, user_input.MOD_ALT)) _ROTATE_OBJECT_TOUCHPAD = user_input.Exclusive(user_input.MOUSE_BUTTON_RIGHT) _MOVE_OBJECT_VERTICAL_TOUCHPAD = user_input.Exclusive(