(self, url, prepare=False)
Open a given URL, conditionally unpacking it from a VTE match
Open a given URL, conditionally unpacking it from a VTE match
Open a given URL conditionally unpacking it from a VTE match
def open_url(self, url, prepare=False):
        """Open a given URL, conditionally unpacking it from a VTE match"""
        if prepare:
            url = self.prepare_url(url)
        dbg('URL: %s (prepared: %s)' % (url, prepare))

        # If the URL opening is managed by the plugin: do nothing.
        # (plugins can indicate they manage the URL opening by returning a "terminator://" URI).
        if url.split(":")[0] == "terminator":
            dbg("URL opening is managed by the plugin, do nothing more.")
            return

        # Else, call the URL handler.
        if self.config['use_custom_url_handler']:
            dbg("Using custom URL handler: %s" %
                self.config['custom_url_handler'])
            try:
                subprocess.Popen([self.config['custom_url_handler'], url])
                return
            except:
                dbg('custom url handler did not work, falling back to defaults')

        try:
            Gtk.show_uri(None, url, Gdk.CURRENT_TIME)
            return
        except:
            dbg('Gtk.show_uri did not work, falling through to xdg-open')

        try:
            subprocess.Popen(["xdg-open", url])
        except:
            dbg('xdg-open did not work, falling back to webbrowser.open')
            import webbrowser
            webbrowser.open(url)
def open_url ( self , url , prepare = False ) : if prepare : url = self . prepare_url ( url ) dbg ( 'URL: %s (prepared: %s)' % ( url , prepare ) ) # If the URL opening is managed by the plugin: do nothing. # (plugins can indicate they manage the URL opening by returning a "terminator://" URI). if url . split ( ":" ) [ 0 ] == "terminator" : dbg ( "URL opening is managed by the plugin, do nothing more." ) return # Else, call the URL handler. if self . config [ 'use_custom_url_handler' ] : dbg ( "Using custom URL handler: %s" % self . config [ 'custom_url_handler' ] ) try : subprocess . Popen ( [ self . config [ 'custom_url_handler' ] , url ] ) return except : dbg ( 'custom url handler did not work, falling back to defaults' ) try : Gtk . show_uri ( None , url , Gdk . CURRENT_TIME ) return except : dbg ( 'Gtk.show_uri did not work, falling through to xdg-open' ) try : subprocess . Popen ( [ "xdg-open" , url ] ) except : dbg ( 'xdg-open did not work, falling back to webbrowser.open' ) import webbrowser webbrowser . open ( url )