How to use the scc.uinput.Rels function in scc

To help you get started, we’ve selected a few scc examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github kozec / sc-controller / tests / test_parser / test_actions.py View on Github external
def test_mouse(self):
		"""
		Tests if MouseAction can be converted to string and parsed back to
		same action.
		"""
		# With axis specified
		assert _parses_as_itself(MouseAction(Rels.REL_WHEEL))
		# Without axis (when used as trackbal)
		assert _parses_as_itself(MouseAction())
github kozec / sc-controller / scc / parser.py View on Github external
def build_action_constants():
	""" Generates dicts for ActionParser.CONSTS """
	rv = {
		'Keys'		: Keys,
		'Axes'		: Axes,
		'Rels'		: Rels,
		'HapticPos'	: HapticPos,
		'None'		: NoAction(),
		'True'		: True,
		'False'		: False,
	}
	for c in PARSER_CONSTANTS:
		rv[c] = c
	for tpl in (Keys, Axes, Rels, SCButtons, HapticPos):
		for x in tpl:
			rv[x.name] = x
	for b in ("A", "B", "X", "Y", "START", "SELECT"):
		name = "BTN_%s" % (b,)
		rv[name] = getattr(Keys, name)
	return rv
github kozec / sc-controller / scc / modifiers.py View on Github external
def describe(self, context):
		if self.name: return self.name
		# Special cases just to make GUI look pretty
		if isinstance(self.action, MouseAction):
			return _("Trackball")
		if isinstance(self.action, XYAction):
			if isinstance(self.action.x, AxisAction) and isinstance(self.action.y, AxisAction):
				x, y = self.action.x.parameters[0], self.action.y.parameters[0]
				if x == Axes.ABS_X and y == Axes.ABS_Y:
					return _("Mouse-like LStick")
				else:
					return _("Mouse-like RStick")
			if isinstance(self.action.x, MouseAction) and isinstance(self.action.y, MouseAction):
				x, y = self.action.x.parameters[0], self.action.y.parameters[0]
				if x in (Rels.REL_HWHEEL, Rels.REL_WHEEL) and y in (Rels.REL_HWHEEL, Rels.REL_WHEEL):
					return _("Mouse Wheel")
		
		return _("Ball(%s)") % (self.action.describe(context))
github kozec / sc-controller / python / scc / gui / ae / axis_action.py View on Github external
and isinstance(action.action.x, (AxisAction, MouseAction))
				)
			return isinstance(action.action, MouseAction)
		if isinstance(action, XYAction):
			p = [ None, None ]
			for x in (0, 1):
				if len(action.actions[0].strip().parameters) >= x:
					if len(action.actions[x].strip().parameters) > 0:
						p[x] = action.actions[x].strip().parameters[0]
			if p[0] == Axes.ABS_X and p[1] == Axes.ABS_Y:
				return True
			elif p[0] == Axes.ABS_RX and p[1] == Axes.ABS_RY:
				return True
			elif p[0] == Axes.ABS_HAT0X and p[1] == Axes.ABS_HAT0Y:
				return True
			elif p[0] == Rels.REL_HWHEEL and p[1] == Rels.REL_WHEEL:
				return True
		return False
github kozec / sc-controller / scc / gui / ae / axis_action.py View on Github external
and isinstance(action.action.x, (AxisAction, MouseAction))
				)
			return isinstance(action.action, MouseAction)
		if isinstance(action, XYAction):
			p = [ None, None ]
			for x in (0, 1):
				if len(action.actions[0].strip().parameters) >= x:
					if len(action.actions[x].strip().parameters) > 0:
						p[x] = action.actions[x].strip().parameters[0]
			if p[0] == Axes.ABS_X and p[1] == Axes.ABS_Y:
				return True
			elif p[0] == Axes.ABS_RX and p[1] == Axes.ABS_RY:
				return True
			elif p[0] == Axes.ABS_HAT0X and p[1] == Axes.ABS_HAT0Y:
				return True
			elif p[0] == Rels.REL_HWHEEL and p[1] == Rels.REL_WHEEL:
				return True
		return False
github kozec / sc-controller / scc / events.py View on Github external
self.mapper.do_trackball(0, True)
				elif axis in (Rels.REL_WHEEL, Rels.REL_HWHEEL):
					self.mapper.do_trackball(1, True)
			if axis == Rels.REL_X:
				self.mapper.mouse_dq_add(0, getattr(self.mapper.state, self.axis_attr), -speed)
			elif axis == Rels.REL_Y:
				self.mapper.mouse_dq_add(1, getattr(self.mapper.state, self.axis_attr), -speed)
			elif axis == Rels.REL_HWHEEL:
				self.mapper.mouse_dq_add(2, getattr(self.mapper.state, self.axis_attr), -speed)
			elif axis == Rels.REL_WHEEL:
				self.mapper.mouse_dq_add(3, getattr(self.mapper.state, self.axis_attr), -speed)
			self.mapper.force_event.add(FE_PAD)
				
		elif self.mapper.old_state.buttons & self.touch_button:
			# Pad was just released
			if axis in (Rels.REL_X, Rels.REL_Y):
				self.mapper.do_trackball(0, False)
			elif axis in (Rels.REL_WHEEL, Rels.REL_HWHEEL):
				self.mapper.do_trackball(1, False)
			if axis == Rels.REL_X:
				self.mapper.mouse_dq_clear(0)
			elif axis == Rels.REL_Y:
				self.mapper.mouse_dq_clear(1)
			elif axis == Rels.REL_WHEEL:
				self.mapper.mouse_dq_clear(3)
			elif axis == Rels.REL_HWHEEL:
				self.mapper.mouse_dq_clear(2)
github kozec / sc-controller / python / scc / gui / ae / gyro_action.py View on Github external
def handles(self, mode, action):
		if isinstance(action, NoAction):
			return True
		if is_gyro_enable(action):
			action = action.mods.values()[0] or action.default
			if isinstance(action, SensitivityModifier):
				action = action.action
		if isinstance(action, GyroAction):	# Takes GyroAbsAction as well
			ap = action.parameters
			if (len(ap) == 3 and not ap[1]) or len(ap) == 2:
				if ap[0] == Axes.ABS_X and ap[-1] == Axes.ABS_Y:
					return True
				elif ap[0] == Axes.ABS_RX and ap[-1] == Axes.ABS_RY:
					return True
				elif ap[0] == Rels.REL_Y and ap[-1] == Rels.REL_X:
					return True
			return False
		if isinstance(action, (MouseAction, MouseAbsAction, CemuHookAction)):
			return True
		return False
github kozec / sc-controller / scc / profile.py View on Github external
iswheelaction = ( lambda x : isinstance(x, MouseAction) and
					x.parameters[0] in (Rels.REL_HWHEEL, Rels.REL_WHEEL) )
			for p in (Profile.LEFT, Profile.RIGHT):
github kozec / sc-controller / python / scc / profile.py View on Github external
iswheelaction = ( lambda x : isinstance(x, MouseAction) and
					x.parameters[0] in (Rels.REL_HWHEEL, Rels.REL_WHEEL) )
			for p in (Profile.LEFT, Profile.RIGHT):