def __init__(self, menu_id, confirm_with=None, cancel_with=None, show_with_release=None): Action.__init__(self, menu_id, *strip_none(confirm_with, cancel_with, show_with_release)) self.menu_id = menu_id self.confirm_with = confirm_with or self.DEFAULT_CONFIRM self.cancel_with = cancel_with or self.DEFAULT_CANCEL self.show_with_release = show_with_release not in (None, False) self._stick_distance = 0
def __init__(self, menu_id, control_with=DEFAULT_CONTROL, confirm_with=DEFAULT, cancel_with=DEFAULT, show_with_release=False, size=0): if control_with == SAME: # Little touch of backwards compatibility control_with, confirm_with = self.DEFAULT_CONTROL, SAME if type(control_with) == int: # Allow short form in case when menu is assigned to pad # eg.: menu("some-id", 3) sets size to 3 control_with, size = MenuAction.DEFAULT_CONTROL, control_with Action.__init__(self, menu_id, control_with, confirm_with, cancel_with, show_with_release, size) HapticEnabledAction.__init__(self) self.menu_id = menu_id self.control_with = control_with self.confirm_with = confirm_with self.cancel_with = cancel_with self.size = size self.x, self.y = MenuAction.DEFAULT_POSITION self.show_with_release = bool(show_with_release) self._stick_distance = 0
def __init__(self, up_direction, on_finished): Action.__init__(self) # TODO: Configurable resolution self._resolution = 3 self._deadzone = 1.0 / self._resolution / self._resolution self._up_direction = up_direction self._on_finished = on_finished self._enabled = False self._positions = [] self._result = []
def __init__(self, *params): Action.__init__(self, *params) params = list(params) for p in params: if isinstance(p, Action): self.action = p params.remove(p) break else: self.action = NoAction() self._mod_init(*params)
def __init__(self, menu_id, confirm_with=None, cancel_with=None, show_with_release=None): Action.__init__( self, menu_id, *strip_none(confirm_with, cancel_with, show_with_release)) self.menu_id = menu_id self.confirm_with = confirm_with or self.DEFAULT_CONFIRM self.cancel_with = cancel_with or self.DEFAULT_CANCEL self.show_with_release = show_with_release not in (None, False)
def __init__(self, *parameters): Action.__init__(self, *parameters) self.action = None self.timeout = self.DEFAULT_TIMEOUT if len(parameters) > 1: # timeout parameter included self.timeout = parameters[0] if isinstance(parameters[-1], Action): self.action = parameters[-1] self.text = self.action.describe(Action.AC_OSD) else: self.text = unicode(parameters[-1])
def __init__(self, *parameters): Action.__init__(self, *parameters) self.action = None self.timeout = self.DEFAULT_TIMEOUT if len(parameters) > 1: # timeout parameter included self.timeout = parameters[0] if isinstance(parameters[-1], Action): self.action = parameters[-1] self.text = self.action.describe(Action.AC_OSD) else: self.text = unicode(parameters[-1]) if self.action and isinstance(self.action, OSDEnabledAction): self.action.enable_osd(self.timeout)
def __init__(self, *stuff): OSDEnabledAction.__init__(self) Action.__init__(self, *stuff) self.gestures = {} gstr = None for i in stuff: if gstr is None and type(i) in (str, unicode): gstr = i elif gstr is not None and isinstance(i, Action): self.gestures[gstr] = i gstr = None else: raise ValueError("Invalid parameter for '%s': unexpected %s" % (self.COMMAND, i))
def __init__(self, *parameters): Action.__init__(self, *parameters) self.actions = [] self.repeat = False self._active = False self._current = None self._release = None for p in parameters: if type(p) == float and len(self.actions): self.actions[-1].delay_after = p elif isinstance(p, Macro): self.actions += p.actions elif isinstance(p, Action): self.actions.append(p) else: self.actions.append(ButtonAction(p))
def __init__(self, menu_id, control_with=DEFAULT_CONTROL, confirm_with=DEFAULT_CONFIRM, cancel_with=DEFAULT_CANCEL, show_with_release=False): if control_with == SAME: # Little touch of backwards compatibility control_with, confirm_with = self.DEFAULT_CONTROL, SAME Action.__init__(self, menu_id, control_with, confirm_with, cancel_with, show_with_release) self.menu_id = menu_id self.control_with = control_with self.confirm_with = confirm_with self.cancel_with = cancel_with self.x, self.y = MenuAction.DEFAULT_POSITION self.show_with_release = bool(show_with_release) self._stick_distance = 0
def __init__(self, *pars): Action.__init__(self, pars) self.options = [] self.confirm_with = DialogAction.DEFAULT_CONFIRM self.cancel_with = DialogAction.DEFAULT_CANCEL self.text = _("Dialog") self.x, self.y = MenuAction.DEFAULT_POSITION # First and 2nd parameter may be confirm and cancel button if len(pars) > 0 and pars[0] in SCButtons: self.confirm_with, pars = pars[0], pars[1:] if len(pars) > 0 and pars[0] in SCButtons: self.cancel_with, pars = pars[0], pars[1:] # 1st always present argument is title if len(pars) > 0: self.text, pars = pars[0], pars[1:] # ... everything else are actions self.options = pars
def __init__(self, *stuff): OSDEnabledAction.__init__(self) Action.__init__(self, *stuff) self.gestures = {} self.precision = self.DEFAULT_PRECISION gstr = None if len(stuff) > 0 and type(stuff[0]) in (int, float): self.precision = clamp(0.0, float(stuff[0]), 1.0) stuff = stuff[1:] for i in stuff: if gstr is None and type(i) in (str, unicode): gstr = i elif gstr is not None and isinstance(i, Action): self.gestures[gstr] = i gstr = None else: raise ValueError("Invalid parameter for '%s': unexpected %s" % (self.COMMAND, i))
def __init__(self, *parameters): Action.__init__(self, *parameters) self.action = None self.timeout = self.DEFAULT_TIMEOUT self.size = self.DEFAULT_SIZE if len(parameters) > 1 and type(parameters[0]) in (int, float): # timeout parameter included self.timeout = float(parameters[0]) parameters = parameters[1:] if len(parameters) > 1 and type(parameters[0]) in (int, float): # size parameter included self.size = int(parameters[0]) parameters = parameters[1:] if isinstance(parameters[0], Action): self.action = parameters[0] self.text = self.action.describe(Action.AC_OSD) else: self.text = unicode(parameters[0]) if self.action and isinstance(self.action, OSDEnabledAction): self.action.enable_osd(self.timeout)
def __init__(self, *parameters): Action.__init__(self, *parameters) self.actions = parameters self._current = 0
def __init__(self, action=None): Action.__init__(self, action) self.action = action or NoAction()
def __init__(self, command): if type(command) == str: command = command.decode("unicode_escape") assert type(command) == unicode Action.__init__(self, command) self.command = command
def __init__(self, button): Action.__init__(self, button) self.button = button
def __init__(self): Action.__init__(self)
def __init__(self, command): Action.__init__(self, command) self.command = command
def __init__(self, brightness): Action.__init__(self, brightness) self.brightness = clamp(0, int(brightness), 100)
def __init__(self, *a): Action.__init__(self, *a) self.speed = 1.0
def __init__(self, side): Action.__init__(self, side) if hasattr(side, "name"): side = side.name self.speed = (1.0, 1.0) self.side = side
def __init__(self, delay): Action.__init__(self, delay) self.delay = float(delay) self.delay_after = self.delay - Macro.HOLD_TIME
def __init__(self, action): Action.__init__(self, action) self.action = action
def __init__(self, profile): Action.__init__(self, profile) self.profile = profile