Skip to content

Commit

Permalink
Add effect.index, input.index and output.index methods
Browse files Browse the repository at this point in the history
  • Loading branch information
SrMouraSilva committed Feb 23, 2017
1 parent c988bf9 commit 905f16d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 4 deletions.
10 changes: 10 additions & 0 deletions pluginsmanager/model/effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,3 +124,13 @@ def json(self):
@abstractmethod
def __dict__(self):
pass

@property
def index(self):
"""
Returns the first occurrence of the effect in your pedalboard
"""
if self.pedalboard is None:
raise IndexError('Effect not contains a pedalboard')

return self.pedalboard.effects.index(self)
11 changes: 9 additions & 2 deletions pluginsmanager/model/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,14 @@ def json(self):
@property
def __dict__(self):
return {
'effect': self.effect.pedalboard.effects.index(self.effect),
'effect': self.effect.index,
'symbol': self.symbol,
'index': self.effect.inputs.index(self),
'index': self.index,
}

@property
def index(self):
"""
:return Input index in the your effect
"""
return self.effect.inputs.index(self)
11 changes: 9 additions & 2 deletions pluginsmanager/model/output.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,14 @@ def json(self):
@property
def __dict__(self):
return {
'effect': self.effect.pedalboard.effects.index(self.effect),
'effect': self.effect.index,
'symbol': self.symbol,
'index': self.effect.outputs.index(self),
'index': self.index,
}

@property
def index(self):
"""
:return Output index in the your effect
"""
return self.effect.outputs.index(self)

0 comments on commit 905f16d

Please sign in to comment.