Sanity check to importing effect handler
Tweaks to opening effect files when in debug (support for OS X and Linux)
This commit is contained in:
@@ -120,7 +120,12 @@ class Effect(EqBase):
|
||||
'''
|
||||
try:
|
||||
self.__effectModule = effectModule = __import__('eos.effects.' + self.handlerName, fromlist=True)
|
||||
self.__handler = getattr(effectModule, "handler")
|
||||
try:
|
||||
self.__handler = getattr(effectModule, "handler")
|
||||
except AttributeError:
|
||||
print "effect {} exists, but no handler".format(self.handlerName)
|
||||
raise
|
||||
|
||||
try:
|
||||
self.__runTime = getattr(effectModule, "runTime") or "normal"
|
||||
except AttributeError:
|
||||
@@ -133,7 +138,7 @@ class Effect(EqBase):
|
||||
|
||||
t = t if isinstance(t, tuple) or t is None else (t,)
|
||||
self.__type = t
|
||||
except ImportError as e:
|
||||
except (ImportError, AttributeError) as e:
|
||||
self.__handler = effectDummy
|
||||
self.__runTime = "normal"
|
||||
self.__type = None
|
||||
|
||||
@@ -523,10 +523,24 @@ class ItemEffects (wx.Panel):
|
||||
self.Layout()
|
||||
|
||||
def OnClick(self, event):
|
||||
"""
|
||||
Debug use: open effect file with default application.
|
||||
If effect file does not exist, create it
|
||||
"""
|
||||
|
||||
import os
|
||||
file = os.path.join(config.pyfaPath,"eos","effects","%s.py"%event.GetText().lower())
|
||||
file = os.path.join(config.pyfaPath, "eos", "effects", "%s.py"%event.GetText().lower())
|
||||
|
||||
if not os.path.isfile(file):
|
||||
open(file, 'a').close()
|
||||
|
||||
if 'wxMSW' in wx.PlatformInfo:
|
||||
os.startfile(file)
|
||||
elif 'wxMac' in wx.PlatformInfo:
|
||||
os.system("open "+file)
|
||||
else:
|
||||
import subprocess
|
||||
subprocess.call(["xdg-open", file])
|
||||
|
||||
|
||||
###########################################################################
|
||||
|
||||
Reference in New Issue
Block a user