Skip to content

Commit

Permalink
fix(epwmap): Patch failed webbrowser method on Mac
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed Sep 10, 2019
1 parent 6f729d7 commit eb0a5bc
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
20 changes: 15 additions & 5 deletions plugin/grasshopper/src/LadybugPlus_EPWmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

ghenv.Component.Name = "LadybugPlus_EPWmap"
ghenv.Component.NickName = 'epwMap'
ghenv.Component.Message = 'VER 0.0.04\nJUN_07_2019'
ghenv.Component.Message = 'VER 0.0.04\nSEP_10_2019'
ghenv.Component.Category = "LadybugPlus"
ghenv.Component.SubCategory = '00 :: Ladybug'
ghenv.Component.AdditionalHelpFromDocStrings = "1"
Expand All @@ -42,18 +42,28 @@
# URL to epwmap.
url = 'http://www.ladybug.tools/epwmap/'

# function for opening a browser page on Mac
def mac_open(url):
os.system("open \"\" " + url)

if all_required_inputs(ghenv.Component) and _epw_map is True:
broswer_found = False
for browser in acceptable_browsers:
browser_path = browser[1]
if broswer_found == False and os.path.isfile(browser_path) == True:
broswer_found = True
wb.register(browser[0], None, wb.BackgroundBrowser(browser_path), 1)
wb.get(browser[0]).open(url, 2, True)
print "Opening epwmap."
try:
wb.get(browser[0]).open(url, 2, True)
print "Opening epwmap."
except ValueError:
mac_open(url)
if broswer_found == False:
print "An accepable broswer was not found on your machine.\n" \
"The default browser will be used but epwmap may not display correctly there."
wb.open(url, 2, True)
"The default browser will be used but epwmap may not display correctly there."
try:
wb.open(url, 2, True)
except ValueError:
mac_open(url)
else:
print "Set _epw_map to True."
Binary file modified plugin/grasshopper/userObjects/LadybugPlus_EPWmap.ghuser
Binary file not shown.

0 comments on commit eb0a5bc

Please sign in to comment.