def get_layout(self, _saveable=False):
ans = {
'orientation': self.orientation(),
'content': []
}
if not _saveable:
ans['splitter'] = self
ans['sizes'] = self.sizes()
for i in range(self.count()):
w = self.widget(i)
if isinstance(w, NestedSplitter):
ans['content'].append(w.get_layout(_saveable=_saveable))
else:
if _saveable:
ans['content'].append(getattr(w, '_ns_id', 'UNKNOWN'))
else:
ans['content'].append(w)
return ans
def get_saveable_layout(self):
return self.get_layout(_saveable=True)def get_layout(self):
"""
Return a dict describing the layout.
Usually you would call ns.top().get_layout()
"""
def content(w):
return w.get_layout() if isinstance(w, NestedSplitter) else w
def widgets():
"""Yield an ordered list of the contained widgets."""
return (self.widget(i) for i in range(self.count()))
return {
'content': [content(w) for w in widgets()],
'orientation': self.orientation(),
'sizes': self.sizes(),
'splitter': self,
}def get_saveable_layout(self):
"""
Return a dict describing the layout.
Usually you would call ns.top().get_layout()
"""
def content(w):
return w.get_saveable_layout() if isinstance(w, NestedSplitter) else getattr(w, '_ns_id', 'UNKNOWN')
def widgets():
"""Yield an ordered list of the contained widgets."""
return (self.widget(i) for i in range(self.count()))
return {
'content': [content(w) for w in widgets()],
'orientation': self.orientation(),
'sizes': self.sizes(),
}When a pane is opened as a toplevel window by using the Open Window context menu, that pane is not a part of the ordinary nested splitter layout, so far as I can tell. How can this pane be accessed?
On Tue, Sep 29, 2020 at 10:23 PM tbp1...@gmail.com <tbp1...@gmail.com> wrote:When a pane is opened as a toplevel window by using the Open Window context menu, that pane is not a part of the ordinary nested splitter layout, so far as I can tell. How can this pane be accessed?When I execute one of these commands, the pane becomes a floating window. However, it does not become a floating window when Leo is reloaded.
The relevant code is dense and not easily understood or summarized. I'm not sure how much more effort I can justify in this area. I'll spend some more time on it, but probably not a lot more.Let me summarize what I think I know at present:1. Terry's code has no machinery to represent floating windows, as is shown in the two methods I discussed yesterday, namely ns.get_layout and ns.get_saveabke layout. It might be relatively straightforward to add a 'floating' key to the python dicts returned from those methods.
...
By adding print statements to the constructors, I see that only one VR3 plugin instance is getting created per outline. I also see that a new VR3 controller widget (ViewRenderedController3) is getting created every time the vr3-show command is run.
So the question is, what happens to the previous instance? Leaked or GCed?
There are two widgets involved here. One is the actual displayed widget, such as a QWebView. That's the one checked by vr3.ensure_text_widget(). The other one is the ViewRenderedController3 itself, which is not a display widget in itself. The latter is the one I was surprised to see is getting re-created every time I toggle the VR3 panel off and then on again. I hadn't expected that, although I suppose I should have.
I presume you are referring to the code in the command "vr":@g.command('vr')
def viewrendered(event):
"""Open render view for commander"""
global controllers, layouts
if g.app.gui.guiName() != 'qt':
return None
c = event.get('c')
if not c:
return None
h = c.hash()
vr = controllers.get(h)
if not vr:
controllers[h] = vr = ViewRenderedController(c)I had slightly modified this code. But when I restored it to your version, I still found that a new ViewRenderedController3 object gets instantiated each time the rendering panel gets hidden and then shown. What's more, I find that the same happens with the current no-docks version of the VR plugin, too.
...
I had slightly modified this code. But when I restored it to your version, I still found that a new ViewRenderedController3 object gets instantiated each time the rendering panel gets hidden and then shown. What's more, I find that the same happens with the current no-docks version of the VR plugin, too.Ok. Let's agree not to worry about this for now. We both have more important things to do.