

def open_browser(url, no_browser_title, no_browser_markup):
    'Opens a webbrowser with the given URL.'
    import os

    def _iscommand(cmd):
        'Return True if cmd can be found on the executable search path.'
        path = os.environ.get('PATH')
        if (not path):
            return False
        for dirname in path.split(os.pathsep):
            exe = os.path.join(dirname, cmd)
            if os.path.isfile(exe):
                return True
        return False
    if _iscommand('gnome-open'):
        os.system(('gnome-open %s' % url))
    elif _iscommand('kfmclient'):
        os.system(('kfmclient openURL %s' % url))
    elif _iscommand('firefox'):
        os.system(('firefox %s' % url))
    elif _iscommand('mozilla-firefox'):
        os.system(('mozilla-firefox %s' % url))
    else:
        mbox = gtk.MessageDialog(type=gtk.MESSAGE_INFO, buttons=gtk.BUTTONS_OK)
        mbox.set_title(no_browser_title)
        mbox.set_markup(no_browser_markup)
        mbox.run()
        mbox.destroy()

dataset/ETHPy150Open thesamet/webilder/src/webilder/uitricks.py open_browser/original