All pastes #266768 Raw Edit

Something

public python v1 · immutable
#266768 ·published 2006-12-04 10:41 UTC
rendered paste body
def 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)