Comment 2 for bug 1117881

Revision history for this message
tbnorth (terry-n-brown) wrote : Re: [Bug 1117881] [NEW] link from log pane to @file nodes

On Thu, 07 Feb 2013 04:10:10 -0000
tbnorth <email address hidden> wrote:

> it didn't immediately work, but there shouldn't be much more to it than
> that - and updating a lot of log messages of course.

so this does work

    from PyQt4 import QtCore
    w = c.frame.top.findChild(QtCore.QObject, 'log-widget')
    w.setReadOnly(True) # so click on link works
    w.setOpenLinks(False) # so click on link doesn't clear text

    def anchorClicked(url, c=c):
        url = str(url.toString())
        g.handleUrl(url,c=c,p=c.p)

    w.anchorClicked.connect(anchorClicked)
    g.es(w.anchorClicked)

    w.append("<div><a href='http://www.google.com/'>Google</a></div>")

and I think this idea is a good one - but a lot of changes would be
needed - nothing too critical I think, but enough to require some
thought / discussion.

 - g.es() is used for putting the 'reading: xxx' messages in the log
 - g.es() escapes HTML so you see the markup code
 - a keyword flag for g.es() could suppress that behavior
 - many calls to g.es which write 'reading: xxx' messages would
   need updating