def detach(self): r'''Detaches context mark. Returns context mark. ''' Mark.detach(self) self._unbind_effective_context() return self
def __init__(self, target_context=None): Mark.__init__(self) self._effective_context = None if target_context is not None: if not isinstance(target_context, type): message = 'target context {!r} must be context class.' message = message.format(target_context) raise TypeError(message) self._target_context = target_context
def __init__(self, *args): Mark.__init__(self) self._format_slot = 'right' if len(args) == 1 and isinstance(args[0], type(self)): self.bend_amount = args[0].bend_amount elif len(args) == 1 and not isinstance(args[0], type(self)): self.bend_amount = args[0] else: message = 'can not initialize stem tremolo.' raise ValueError(message)
def __init__(self, *args): Mark.__init__(self) self._format_slot = "right" if len(args) == 1 and isinstance(args[0], type(self)): self.tremolo_flags = args[0].tremolo_flags elif len(args) == 1 and not isinstance(args[0], type(self)): self.tremolo_flags = args[0] else: message = "can not initialize stem tremolo." raise ValueError(message)
def __init__(self, *args): Mark.__init__(self) if len(args) == 1 and isinstance(args[0], type(self)): self._name = copy.copy(args[0].name) self._value = copy.copy(args[0].value) elif len(args) == 1 and not isinstance(args[0], type(self)): self._name = copy.copy(args[0]) self._value = None elif len(args) == 2: self._name = copy.copy(args[0]) self._value = copy.copy(args[1]) else: message = 'unknown annotation initialization signature.' raise ValueError(message) self._format_slot = None
def __init__(self, *args): Mark.__init__(self) if len(args) == 1 and isinstance(args[0], type(self)): self.command_name = copy.copy(args[0].command_name) self.format_slot = copy.copy(args[0].format_slot) elif len(args) == 1 and not isinstance(args[0], type(self)): self.command_name = copy.copy(args[0]) self.format_slot = None elif len(args) == 2 and isinstance(args[0], type(self)): self.command_name = copy.copy(args[0].command_name) self.format_slot = args[1] elif len(args) == 2 and not isinstance(args[0], type(self)): self.command_name = args[0] self.format_slot = args[1] else: message = 'can not initialize LilyPond command mark.' raise ValueError(message)
def _attach(self, start_component): r'''Attaches context mark to `start_component`. Makes sure no context mark of same type is already attached to score component that starts with start component. Returns context mark. ''' from abjad.tools import contexttools classes = (type(self), ) effective_context_mark = \ start_component._get_effective_context_mark(classes) if effective_context_mark is not None: if effective_context_mark.start_component._get_timespan().start_offset == \ start_component._get_timespan().start_offset: message = 'effective context mark already attached' message += ' to component starting at same time.' raise ExtraMarkError(message) return Mark._attach(self, start_component)
def __init__(self, *args, **kwargs): Mark.__init__(self, *args) if 'direction' in kwargs: self.direction = kwargs['direction'] else: self.direction = None
def _bind_start_component(self, start_component): #print 'binding CONTEXT MARK to start component ...' Mark._bind_start_component(self, start_component) self._update_effective_context()