Exemplo n.º 1
0
	def set_action(self, mode, action):
		cbToggle = self.builder.get_object("cbToggle")
		cbRepeat = self.builder.get_object("cbRepeat")
		if self.handles(mode, action):
			self.keys = set()
			is_togle, is_repeat = False, False
			if isinstance(action, MultiAction):
				for a in action.actions:
					if isinstance(a, ButtonAction):
						self.keys.add(a.button)
			elif isinstance(action, ButtonAction):
				self.keys.add(action.button)
			elif isinstance(action, Macro):
				# Macro goes here only if it is button repeat
				self.keys.add(action.actions[0].button)
				is_repeat = True
			elif isinstance(action, Cycle):
				# There is only one case when self.handles returns True for Cycle
				self.keys.add(action.actions[0].action.button)
				is_togle = True
			cbToggle.set_active(is_togle)
			cbRepeat.set_active(is_repeat)
			area = action_to_area(action)
			if area is not None:
				self.set_active_area(area)
				return
		self.set_active_area(None)
Exemplo n.º 2
0
 def set_action(self, mode, action):
     if self.handles(mode, action):
         area = action_to_area(action)
         if area is not None:
             self.set_active_area(area)
             return
     self.set_active_area(None)
Exemplo n.º 3
0
 def set_action(self, mode, action):
     cbToggle = self.builder.get_object("cbToggle")
     cbRepeat = self.builder.get_object("cbRepeat")
     if self.handles(mode, action):
         self.keys = set()
         is_togle, is_repeat = False, False
         if isinstance(action, MultiAction):
             for a in action.actions:
                 if isinstance(a, ButtonAction):
                     self.keys.add(a.button)
         elif isinstance(action, ButtonAction):
             self.keys.add(action.button)
         elif isinstance(action, Macro):
             # Macro goes here only if it is button repeat
             self.keys.add(action.actions[0].button)
             is_repeat = True
         elif isinstance(action, Cycle):
             # There is only one case when self.handles returns True for Cycle
             self.keys.add(action.actions[0].action.button)
             is_togle = True
         cbToggle.set_active(is_togle)
         cbRepeat.set_active(is_repeat)
         area = action_to_area(action)
         if area is not None:
             self.set_active_area(area)
             return
     self.set_active_area(None)
Exemplo n.º 4
0
	def set_action(self, mode, action):
		if self.handles(mode, action):
			area = action_to_area(action)
			if area is not None:
				self.set_active_area(area)
				return
		self.set_active_area(None)
Exemplo n.º 5
0
	def set_action(self, mode, action):
		if self.handles(mode, action):
			if isinstance(action, MultiAction) and len(action.actions) == 2:
				# axis + button on fully pressed trigger
				self.full = action.actions[0].button2
				self.builder.get_object("lblFullPressed").set_label(describe_action(Action.AC_BUTTON, ButtonAction, self.full))
				action = action.actions[1]
			area = action_to_area(action)
			if area is not None:
				self.set_active_area(area)
				return
		self.set_active_area(None)
Exemplo n.º 6
0
	def grab_action(self, action, cb):
		b = SimpleChooser(self.app, "axis", cb)
		b.set_title(_("Select Axis"))
		area = action_to_area(action)
		b.display_action(Action.AC_STICK, area)
		b.show(self.editor.window)
Exemplo n.º 7
0
 def grab_action(self, action, cb):
     b = SimpleChooser(self.app, "axis", cb)
     b.set_title(_("Select Axis"))
     area = action_to_area(action)
     b.display_action(Action.AC_STICK, area)
     b.show(self.editor.window)