import leo.commands.editFileCommands as efc
efc.GitDiffController(c).diff_two_revs(
rev1='aaf1825c7bb', # Thomas's last commit.
rev2='bf81d8e09da', # Latest devel commit
directory=None,
)def ns_title(self, id_):
if id_ != self.ns_provider_id():
return None
filename = self.c.shortFileName() or 'Unnamed file'
return f"Viewrendered 3: {filename}"...
free_layout.pyRemove dock-related code from four free-layout commands. This should have no effect on VR3.nested_splitter.pyMove the ns.get_title method to a separate node. Again, this should have no effect on VR3.viewrendered3.pyThe following are the changes I see after carefully studying the diffs:- [No effect on VR3] Remove qt docks code.- [No effect on VR3] Change:
fn = g.os_path_expandExpression(fn, c=c)to:fn = c.expand_path_expression(fn)- ns_provide: This method is the all-important factor method. It creates one Qt pane per commander. That's the way it has always been.Note: The new code uses self.ns_provider_id() instead of '_leo_viewrendered3'. See below.- Added ns_provider_id(self): return f"vr3_id:{self.c.shortFileName()}".Thomas, you might want to change this back so it returns '_leo_viewrendered3'. However, ns_provide will probably not be affected.- ns_provides: return [('Viewrendered 3', self.ns_provider_id())]
...
Unfortunately, changing ns_provider_id to return a constant string did not cause the VR3 pane to be global.
For VR3, I just copied the code from VR. I didn't know anything about how it all worked, the ``provides`` code and all, so I didn't make any changes. I seem to remember that at some point, I did change ``viewrendered`` to ``viewrendered3`` somewhere in the ``provider`` class, but I might not have gotten all the references (and I didn't know what significance if any it would have). I have hotkeyed VR to <ALT-F10>, and VR3 to <ALT-0>. so when I do enable VR I can pop each one up individually without needed to do an <ALT-X> command. I made sure that all the VR3 commands start with ``vr3-`` so they don't conflict with the equivalent VR ``vr-`` commands.
The upshot is :1) Making the suggested change(s) does not give us a global VR3 window;
2) All these ``ns_provider`` things seem to apply only when a floating window is opened from the splitter bar context menu. Otherwise they are not even activated.
3. So these ``ns_provider`` methods don't bear on how to get VR3 to open in a internal pane instead of a floating window.
After I deleted .leo\db folder, VR3 finally opened in an internal frame. Opening a floating VR3 window from the splitter context menu opened a second, floating window while leaving the previously opened internal pane alone. I found I had to delete both databases in the db folder to get this to work reliably.I'm speculating that I had some layout data left over from using --use-docks that was getting reused, but who really knows?
All these instances were still specific to the selected Leo outline. I'm finding that I don't mind that so much for the internal pane. I can have an open VR3 in several outlines, and when I select an outline, its instance of VR3 shows rendering for that pane. So that's not really confusing or annoying, unlike having to have multiple free-floating windows open at the same time for the several outlines, which *is* annoying.
We are not out of the woods yet. I have found that unpredictably an outline will open VR3 in a floating window, and then there doesn't seem to be a way to get it to open in the internal pane, not even closing and reopening Leo.
Some progress to report. I created a layout that puts VR3 into the right-hand pane. This is my normal layout with the outline and log panes at the left, body center, and VR3 at right. I wrote a command to load that layout. No matter what has gone wrong with the layouts (like VR3 in a free floating window with the title bar off-screen), this will open VR3 in the right hand pane.
Once I invoke this command, then VR3 will open, close, and re-open in the right pane using the command vr3-show or vr3-toggle. If I open it as a free floating window using the splitter bar context menu, VR3 will open in its own window and its title bar will include the name of the leo outline.
However, having done that once, when I close and reopen VR3 using the vr3-toggle command, it will re-open as a free-floating window with the title bar off-screen, and when moved on screen the title bar does not contain the outline's name. In this state, the only way to get VR3 to open in the internal pane again is to invoke the new vr3-use-default-layout command.
After a few minor changes, I have found that the problem behavior has been reduced to one circumstance that I know about. If I open VR3 as a free-floating window from the splitter, and then close it using either the close box on its title bar, or <ALT-F4> (this is on Windows, and <ALT-F4> is the standard Windows way to close a window from the keyboard), the next time I re-open VR3 using the vr3-toggle command it opens as a free-floating window with the title bar out of view at the top of the screen. If this window is moved into full view using keyboard controls, the title bar does not show the name of the associated outline. However, when I close this free floating window using the vr3-toggle command and then toggle it open again, it re-opens as an internal pane.
[On Windows, a window whose title bar is off-screen can be moved by pressing <ALT-Spacebar>, then <M>, then use the arrow keys to move it into full view.]
It is possible that previous use of my private experimental command vr3-use-default-layout was necessary to arrive at this point, but I can't undo it to be sure. At any rate, It's clear that closing a free-floating window using other than VR3 commands causes some change in what layout is applied by Leo, or how opening the pane is called.Note that I have not tried any of this on Linux yet.Anyone have any ideas about what might be going on here?
I think it is acceptable and maybe even desirable for the VR3 pane to open inside Leo's window instead of as a free floating window after it has been closed, since 1) you can always open it free floating again using the splitter bar context menu, and 2) How else could you tell Leo that you want it to stop being a free floating window? I suppose that's just where docks could have been useful, if only they could have been made to work correctly.
Here is the code for my experimental command to open VR3 with a fixed layout.
Note that the Viewrendered plugin suffers from the same problems as VR3 did. That is not surprising since the VR3 splitter code was taken directly from VR.
Using non-zero sizes in my layout might be better. Instead of 'sizes': [0,0,0], 'sizes': [200,200,200] would probably be better. Using "0" sizes may invite the layout machinery to make odd choices once in a while.