Skip to content

Commit e9177af

Browse files
committed
Improve SingleEffectManager
1 parent d53e45b commit e9177af

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

demosys/effects/managers.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,22 @@ def pre_load(self):
6565
Initialize the effect that should run.
6666
"""
6767
effect_list = [cfg.cls() for name, cfg in effects.effects.items()]
68+
69+
# If an effect want't specified in the initializer we grab the first one
6870
if not self.active_effect:
6971
self.active_effect = effect_list[0]
70-
71-
for effect in effect_list:
72-
if effect.name == self.effect_module:
73-
self.active_effect = effect
72+
else:
73+
# Otherwise we look for an effect with the name
74+
for effect in effect_list:
75+
if effect.name == self.effect_module:
76+
self.active_effect = effect
7477

7578
if not self.active_effect:
7679
print("Cannot find effect '{}'".format(self.active_effect))
7780
print("Available effects:")
7881
print("\n".join(e.name for e in effect_list))
7982
return False
83+
8084
return True
8185

8286
def post_load(self):

0 commit comments

Comments
 (0)