def handle_sysex(self, midi_bytes): result = find_if(lambda (id, _): midi_bytes[:len(id)] == id, self._forwarding_long_identifier_registry.iteritems()) if result != None: id, control = result control.receive_value(midi_bytes[len(id):-1]) else: self.log_message('Got unknown sysex message: ', midi_bytes)
def connect(self, slot, in_front = False, sender = None): """ Connects the signal to the slot. Does nothing if the slot is already connected. Returns the wrapper object that is used as a slot. If 'in_front' is True, the slot will be put first, meaning it will be called before previously registered slots (by default it is put last). If 'sender' is not None, it will be passed as last ordinal parameter to the slot when the signal is dispatched. """ if not callable(slot): raise AssertionError if slot not in self._slots: slot = IdentifyingSlot(sender, slot) if sender is not None else Slot(slot) in_front and self._slots.insert(0, slot) else: self._slots.append(slot) else: slot = find_if(lambda x: x == slot, self._slots) return slot
def find_disconnectable(self, predicate): return find_if(predicate, self._registered_disconnectables)
def short_circuit_combiner(slot_results): return find_if(nop, slot_results)
def get_control_by_name(self, control_name): return find_if(lambda c: c.name == control_name, self.controls)
def find(self, task): return find_if(lambda t: t._task_equivalent(task), self._tasks)