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:
blitzmann
2015-02-03 14:06:10 -05:00
parent 36a3ac70b6
commit c861adc5ed
2 changed files with 22 additions and 3 deletions

View File

@@ -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])
###########################################################################