rendered paste bodydef on_document_link_clicked(self, document, link): """Handle links. Directly open local files. Run Firefox for http:// and ftp://, launch apps for run:""" if link.startswith('http://') or link.startswith('ftp://') or link.startswith("https://"): # start default web browser self.statusbar.pop(self.sb_context_id) self.statusbar.push(self.sb_context_id, "Visiting: %s" % link) os.spawnl(os.P_NOWAIT, '/usr/bin/exo-open', '', link) elif link.startswith('run://'): # launch program command = link[len('run://'):] self.statusbar.pop(self.sb_context_id) self.statusbar.push(self.sb_context_id, "Launched Application: %s" % command) os.spawnl(os.P_NOWAIT, '/usr/bin/%s' % command) else: self.read_file(link)