How to use the scc.actions.MultiAction 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 / python / scc / gui / ae / axis_action.py View on Github external
def make_circular_action(self):
		"""
		Constructs Circular Modifier
		"""
		if self.circular_axis and any(self.circular_buttons):
			return CircularModifier(MultiAction(
				self.circular_axis, ButtonAction(*self.circular_buttons)))
		elif any(self.circular_buttons):
			return CircularModifier(ButtonAction(*self.circular_buttons))
		else:
			return CircularModifier(self.circular_axis)
github kozec / sc-controller / python / scc / gui / controller_widget.py View on Github external
def _set_label(self, action):
		if is_gyro_enable(action):
			action = action.mods.values()[0] or action.default
		if isinstance(action, MultiAction):
			rv = []
			for a in action.actions:
				d = a.describe(self.ACTION_CONTEXT)
				if not d in rv : rv.append(d)
			self.label.set_label("\n".join(rv))
			return
		self.label.set_label(action.describe(self.ACTION_CONTEXT))
github kozec / sc-controller / python / scc / gui / ring_editor.py View on Github external
def _make_action(self):
		""" Generates and returns Action instance """
		cbMode = self.builder.get_object("cbMode")
		key = cbMode.get_model().get_value(cbMode.get_active_iter(), 0)
		if key == "inner":
			return MultiAction(
				self.actions[1],
				RingAction(self.radius, self.actions[0], NoAction())
			)
		elif key == "outer":
			return MultiAction(
				self.actions[0],
				RingAction(self.radius, NoAction(), self.actions[1])
			)
		else:
			return RingAction(self.radius, *self.actions)
github kozec / sc-controller / python / scc / gui / ae / buttons.py View on Github external
def handles(self, mode, action):
		# Handles ButtonAction and MultiAction if all subactions are ButtonAction
		if isinstance(action, (ButtonAction, NoAction, InvalidAction)):
			return True
		if isinstance(action, AxisAction):
			return len(action.parameters) == 1
		if isinstance(action, MouseAction):
			if action.axis == Rels.REL_WHEEL:
				return True
		if is_button_togle(action):
			return True
		if is_button_repeat(action):
			return True
		if isinstance(action, MultiAction):
			if len(action.actions) > 0:
				for a in action.actions:
					if not isinstance(a, ButtonAction):
						return False
				return True
		return False
github kozec / sc-controller / scc / gui / ae / gyro.py View on Github external
def set_action(self, mode, action):
		if self.handles(mode, action):
			if isinstance(action, ModeModifier):
				self._recursing = True
				self.builder.get_object("cbInvertGyro").set_active(bool(action.default))
				self._recursing = False
				b = action.mods.keys()[0]
				action = action.mods[b] or action.default
				self.select_gyro_button(b)
			else:
				self.select_gyro_button(None)
			
			actions = [ action ]
			if isinstance(action, MultiAction):
				actions = action.actions
			
			self._recursing = True
			for a in actions:
				if isinstance(a, GyroAction):
					pars = ensure_size(3, a.parameters)
					for i in xrange(0, 3):
						if pars[i] is not None:
							self.axes[i] = pars[i]
							self.cbs[i].set_active(isinstance(a, GyroAbsAction))
			self.update()
			self._recursing = False
github kozec / sc-controller / python / scc / gui / ring_editor.py View on Github external
def _make_action(self):
		""" Generates and returns Action instance """
		cbMode = self.builder.get_object("cbMode")
		key = cbMode.get_model().get_value(cbMode.get_active_iter(), 0)
		if key == "inner":
			return MultiAction(
				self.actions[1],
				RingAction(self.radius, self.actions[0], NoAction())
			)
		elif key == "outer":
			return MultiAction(
				self.actions[0],
				RingAction(self.radius, NoAction(), self.actions[1])
			)
		else:
			return RingAction(self.radius, *self.actions)
github kozec / sc-controller / scc / gui / ae / axis.py View on Github external
def handles(self, mode, action):
		if isinstance(action, MultiAction) and len(action.actions) == 2:
			# Handles combination of axis + button on fully pressed trigger
			if not isinstance(action.actions[0], ButtonAction):
				return False
			action = action.actions[1]
		return isinstance(action, (AxisAction, MouseAction))