Source code for yyagl.engine.gui.browser

from sys import platform
from os import environ, system
from webbrowser import open_new_tab


[docs]class BrowserStrategy(object):
[docs] @staticmethod def open(url): open_new_tab(url)
[docs]class BrowserStrategyLinux(BrowserStrategy):
[docs] @staticmethod def open(url): environ['LD_LIBRARY_PATH'] = '' system('xdg-open ' + url)
[docs]class Browser(object):
[docs] @staticmethod def open(url): cls = BrowserStrategyLinux if platform.startswith('linux') else \ BrowserStrategy cls.open(url)