link from log pane to @file nodes

Bug #1117881 reported by Matt Wilkie
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
leo-editor
Confirmed
Wishlist
Unassigned

Bug Description

This afternoon I'm working on a project I've not touched in some time. When I open the Leo workbook file there are number of external files which have whitespace changes (line endings or something). The log says things like "cached read node changed" and then when I save the workbook I get list of the files touched, and a series of Recovered Nodes showing the diff conflicts.

There are 65+ external files in this project scattered in various places throughout the outline, and I've no recollection where they are anymore. Now I /certainly can/ just use the Nav pane to search for the location of these @file nodes, flipping back and forth between Log and Nav and hunt down each of the affected files and examine them determine what I need to do for each. However it occurs to me that:

   - *wouldn't it be nice if 2x-clicking on "wrote: dissolve-all.py" in the log pane opened up or selected that @file node in the outline? or myLeoSettings? or ...?*

Now for this particular scenario, it's far less effort for me to just search/nav for the files (or just not care about adding noise to my source code control history by committing an "ignore, whitespace changes") than it would be for someone to design and code this kind of feature (or even write this feature request). However, I like the idea and thought it be worth sharing, so here you are. :)

{{{
reading: E:\Canvec_Tools\Canvec_workbook.leo
cached read node changed: domain list
cached read node changed: get dissolve fields
...etc.

wrote: dissolve-all.py
wrote: xx-domain2tables.py
wrote: xx-tables2domains.py
....etc.
unchanged: xx-assign-cv-domains.py
unchanged: xxx.py
saved: Canvec_workbook.leo
}}}

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 01:40:32 -0000
Matt Wilkie <email address hidden> wrote:

> - *wouldn't it be nice if 2x-clicking on "wrote: dissolve-all.py" in
> the log pane opened up or selected that @file node in the outline? or
> myLeoSettings? or ...?*

This should be really easy, just another form of the code I just posted
for the overview pane
http://permalink.gmane.org/gmane.comp.python.leo.general/22138
because the URL behind the link can be a Leo UNL. In a really quick
test:

  from PyQt4 import QtCore
  w = c.frame.top.findChild(QtCore.QObject, 'log-widget')
  w.append("<div><a href='http://www.google.com/'>Google</a></div>")

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

  w.anchorClicked.connect(anchorClicked)

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.

Cheers -Terry

Revision history for this message
tbnorth (terry-n-brown) wrote :

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

Changed in leo-editor:
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.