Exemplo n.º 1
0
	def handles(self, mode, action):
		if MenuActionCofC.handles(self, mode, action):
			return True
		if isinstance(action, OSDAction) and action.action is None:
			return True
		return isinstance(action, (NoAction, TurnOffAction, ShellCommandAction,
			ChangeProfileAction, KeyboardAction, ResetGyroAction))
Exemplo n.º 2
0
	def set_action(self, mode, action):
		if self.handles(mode, action):
			cb = self.builder.get_object("cbActionType")
			if isinstance(action, TurnOffAction):
				self.set_cb(cb, "turnoff")
			elif isinstance(action, ShellCommandAction):
				self.set_cb(cb, "shell")
				enCommand = self.builder.get_object("enCommand")
				enCommand.set_text(action.command.encode("utf-8"))
			elif isinstance(action, ResetGyroAction):
				self.set_cb(cb, "resetgyro")
			elif isinstance(action, ChangeProfileAction):
				self._current_profile = action.profile
				self.set_cb(cb, "profile")
			elif MenuActionCofC.handles(self, None, action):
				self.set_cb(cb, "menu")
				self.load_menu_data(action)
			elif isinstance(action, KeyboardAction):
				self.set_cb(cb, "keyboard")
			elif isinstance(action, OSDAction):
				self.set_cb(cb, "osd")
				enOSDText = self.builder.get_object("enOSDText")
				enOSDText.set_text(action.text)
			else:
				self.set_cb(cb, "none")
Exemplo n.º 3
0
	def handles(self, mode, action):
		if MenuActionCofC.handles(self, mode, action):
			return True
		if isinstance(action, OSDAction) and action.action is None:
			return True
		return isinstance(action, (NoAction, TurnOffAction, ShellCommandAction,
			ChangeProfileAction, KeyboardAction))
Exemplo n.º 4
0
 def set_action(self, mode, action):
     if self.handles(mode, action):
         cb = self.builder.get_object("cbActionType")
         if isinstance(action, TurnOffAction):
             self.set_cb(cb, "turnoff")
         elif isinstance(action, ShellCommandAction):
             self.set_cb(cb, "shell")
             enCommand = self.builder.get_object("enCommand")
             enCommand.set_text(action.command.encode("utf-8"))
         elif isinstance(action, ResetGyroAction):
             self.set_cb(cb, "resetgyro")
         elif isinstance(action, ChangeProfileAction):
             self._current_profile = action.profile
             self.set_cb(cb, "profile")
         elif MenuActionCofC.handles(self, None, action):
             self.set_cb(cb, "menu")
             self.load_menu_data(action)
         elif isinstance(action, KeyboardAction):
             self.set_cb(cb, "keyboard")
         elif isinstance(action, OSDAction):
             self.set_cb(cb, "osd")
             sclOSDTimeout = self.builder.get_object("sclOSDTimeout")
             enOSDText = self.builder.get_object("enOSDText")
             cbOSDSize = self.builder.get_object("cbOSDSize")
             self._recursing = True
             sclOSDTimeout.set_value(action.timeout or 60.1)
             enOSDText.set_text(action.text)
             self.set_cb(cbOSDSize, action.size)
             self._recursing = False
         elif isinstance(action, ClearOSDAction):
             self.set_cb(cb, "clearosd")
         else:
             self.set_cb(cb, "none")
Exemplo n.º 5
0
	def set_action(self, mode, action):
		if self.handles(mode, action):
			cb = self.builder.get_object("cbActionType")
			if isinstance(action, TurnOffAction):
				self.set_cb(cb, "turnoff")
			elif isinstance(action, ShellCommandAction):
				self.set_cb(cb, "shell")
				enCommand = self.builder.get_object("enCommand")
				enCommand.set_text(action.command.encode("utf-8"))
			elif isinstance(action, ResetGyroAction):
				self.set_cb(cb, "resetgyro")
			elif isinstance(action, ChangeProfileAction):
				self._current_profile = action.profile
				self.set_cb(cb, "profile")
			elif MenuActionCofC.handles(self, None, action):
				self.set_cb(cb, "menu")
				self.load_menu_data(action)
			elif isinstance(action, KeyboardAction):
				self.set_cb(cb, "keyboard")
			elif isinstance(action, OSDAction):
				self.set_cb(cb, "osd")
				sclOSDTimeout = self.builder.get_object("sclOSDTimeout")
				enOSDText = self.builder.get_object("enOSDText")
				cbOSDSize = self.builder.get_object("cbOSDSize")
				self._recursing = True
				sclOSDTimeout.set_value(action.timeout or 60.1)
				enOSDText.set_text(action.text)
				self.set_cb(cbOSDSize, action.size)
				self._recursing = False
			elif isinstance(action, ClearOSDAction):
				self.set_cb(cb, "clearosd")
			else:
				self.set_cb(cb, "none")
Exemplo n.º 6
0
 def set_action(self, mode, action):
     cbm = self.builder.get_object("cbMenuType")
     cb = self.builder.get_object("cbActionType")
     if isinstance(action, DPadAction):
         self.set_cb(cbm, "menu", 1)
         if isinstance(action, DPad8Action):
             self.set_cb(cb, "dpad8", 1)
         else:
             self.set_cb(cb, "dpad", 1)
         self.update_button_desc(action)
     elif MenuActionCofC.handles(self, None, action):
         self.set_cb(cb, "menu", 1)
         self.load_menu_data(action)
     self.on_cbActionType_changed()
Exemplo n.º 7
0
	def set_action(self, mode, action):
		cbm = self.builder.get_object("cbMenuType")
		cb = self.builder.get_object("cbActionType")
		scl = self.builder.get_object("sclDiagonalRange")
		if isinstance(action, DPadAction):
			self.set_cb(cbm, "menu", 1)
			scl.set_value(action.diagonal_rage)
			if isinstance(action, DPad8Action):
				self.set_cb(cb, "dpad8", 1)
			else:
				self.set_cb(cb, "dpad", 1)
			self.update_button_desc(action)
		elif MenuActionCofC.handles(self, None, action):
			self.set_cb(cb, "menu", 1)
			self.load_menu_data(action)
		self.on_cbActionType_changed()
Exemplo n.º 8
0
	def handles(self, mode, action):
		if MenuActionCofC.handles(self, mode, action):
			return True
		return isinstance(action, DPadAction) # DPad8Action is derived from DPadAction
Exemplo n.º 9
0
	def handles(self, mode, action):
		if MenuActionCofC.handles(self, mode, action):
			return True
		return isinstance(action, DPadAction) # DPad8Action is derived from DPadAction