On Sunday, May 12, 2024 at 4:17:19 PM UTC-5 [email protected] wrote:
I have devised a script that can [swap the body and VR3 panes]. You can
put it into a button for easy activation, or you could make it into a
command in the Settings tree and bind it to a keystroke.
Thomas, your private email on this topic was a Eureka moment for me. I
realized that we Leo devs aren't aware of the hierarchy of Leo's Qt widgets.
The following script helps cure that ignorance:
"""Scripts to discover Leo's Qt Widget hierarchy."""
g.cls()
total = 0
def w_name(w):
name = w.objectName() or 'no name'
return f"<{name}>:{ w.__class__.__name__}"
def dump(tag, w, level=0):
global total
total += 1
ws = (level * 2) * ' '
print(f"{id(w):<14} lvl {level:2}: {ws}{tag}:{w_name(w)}")
def dump_children(w, level=0):
if 1: # Specify wanted classes...
wanted = (
'DynamicWindow', 'Frame', 'Layout',
'Splitter', 'Stacked', 'Text', 'Widget')
children = [z for z in w.children()
if any (z2 in z.__class__.__name__ for z2 in wanted)]
else: # Specifiy unwanted classes...
ignore = ('action', 'animation', 'menu')
children = [z for z in w.children()
if not any (z2 in z.__class__.__name__.lower() for z2 in
ignore)]
if children:
for i, child in enumerate(children):
dump(f"child {i}", child, level + 1)
dump_children(child, level + 1)
def full_dump(tag, w, level=0):
print('')
print(f"Full dump of {w_name(w)} at {id(w)}...\n")
dump(tag, w)
dump_children(w)
if 1:
full_dump('c.frame.top.parent()', c.frame.top.parent())
else:
flc = c.free_layout # free layout controller
top_splitter = flc.get_top_splitter()
dump('c.frame.top.parent()', c.frame.top.parent())
dump('c.frame.top', c.frame.top)
full_dump('top_splitter', top_splitter)
print('')
print(f"total objects: {total}")
And here is the output:
Full dump of <qt_tabwidget_stackedwidget>:QStackedWidget at 2877793745520...
2877793745520 lvl 0:
c.frame.top.parent():<qt_tabwidget_stackedwidget>:QStackedWidget
2877793745840 lvl 1: child 0:<no name>:QStackedLayout
2877687572080 lvl 1: child 1:<MainWindow>:DynamicWindow
2877793745200 lvl 2: child 0:<_layout>:QLayout
2877687572560 lvl 2: child 1:<centralwidget>:QWidget
2877687572880 lvl 3: child 0:<mainVLayout>:QVBoxLayout
2877687573040 lvl 3: child 1:<main_splitter>:NestedSplitter
2877793731920 lvl 4: child 0:<no name>:NestedSplitter
2877692019248 lvl 5: child 0:<bodyFrame>:QFrame
2877692019408 lvl 6: child 0:<innerBodyFrame>:QFrame
2877692019728 lvl 7: child
0:<bodyStackedWidget>:QStackedWidget
2877793746480 lvl 8: child 0:<no name>:QStackedLayout
2877692019888 lvl 8: child 1:<bodyPage2>:QWidget
2877692020368 lvl 9: child
0:<richTextEdit>:LeoQTextBrowser
2877793746320 lvl 10: child
0:<qt_scrollarea_viewport>:QWidget
2877793746640 lvl 10: child
1:<qt_scrollarea_hcontainer>:QWidget
2877793550416 lvl 11: child 0:<no name>:QBoxLayout
2877793731440 lvl 10: child
2:<qt_scrollarea_vcontainer>:QWidget
2877793746800 lvl 11: child 0:<no name>:QBoxLayout
2877692020848 lvl 9: child 1:<bodyVLayout>:QVBoxLayout
2877692021168 lvl 7: child 1:<bodyInnerGrid>:QGridLayout
2877692021008 lvl 6: child 1:<bodyGrid>:QGridLayout
2877793732080 lvl 5: child
1:<qt_splithandle_viewrendered_pane>:NestedSplitterHandle
2877692019568 lvl 5: child
2:<qt_splithandle_bodyFrame>:NestedSplitterHandle
2877687573200 lvl 4: child 1:<secondary_splitter>:NestedSplitter
2877687574640 lvl 5: child 0:<logFrame>:QFrame
2877687574800 lvl 6: child 0:<logInnerFrame>:QFrame
2877687575120 lvl 7: child 0:<logTabWidget>:QTabWidget
2877793746480 lvl 8: child
0:<qt_tabwidget_stackedwidget>:QStackedWidget
2877793731440 lvl 9: child 0:<no name>:QStackedLayout
2877687575920 lvl 9: child 1:<spellTab>:QWidget
2877687576080 lvl 10: child
0:<spellVLayout>:QVBoxLayout
2877687576240 lvl 10: child 1:<spellFrame>:QFrame
2877687576400 lvl 11: child
0:<spellVLayout>:QVBoxLayout
2877687576560 lvl 12: child
0:<spellGrid>:QGridLayout
2877692018768 lvl 11: child
1:<leo_spell_listBox>:QListWidget
2877793746320 lvl 12: child
0:<qt_scrollarea_viewport>:QWidget
2877793746640 lvl 12: child
1:<qt_scrollarea_hcontainer>:QWidget
2877793743600 lvl 13: child 0:<no
name>:QBoxLayout
2877793746800 lvl 12: child
2:<qt_scrollarea_vcontainer>:QWidget
2877793743920 lvl 13: child 0:<no
name>:QBoxLayout
2877695206864 lvl 9: child
2:<log-widget>:LeoQTextBrowser
2877793746800 lvl 10: child
0:<qt_scrollarea_viewport>:QWidget
2877793746640 lvl 10: child
1:<qt_scrollarea_hcontainer>:QWidget
2877793746320 lvl 11: child 0:<no name>:QBoxLayout
2877793743920 lvl 10: child
2:<qt_scrollarea_vcontainer>:QWidget
2877793746320 lvl 11: child 0:<no name>:QBoxLayout
2877687575280 lvl 7: child 1:<logInnerGrid>:QGridLayout
2877687575440 lvl 6: child 1:<logGrid>:QGridLayout
2877687573360 lvl 5: child 1:<outlineFrame>:QFrame
2877687573680 lvl 6: child 0:<outlineInnerFrame>:QFrame
2877687574000 lvl 7: child 0:<treeWidget>:LeoQTreeWidget
2877793746480 lvl 8: child
0:<qt_scrollarea_viewport>:QWidget
2877793731440 lvl 8: child
1:<qt_scrollarea_hcontainer>:QWidget
2877793746800 lvl 9: child 0:<no name>:QBoxLayout
2877793743920 lvl 8: child
2:<qt_scrollarea_vcontainer>:QWidget
2877793743600 lvl 9: child 0:<no name>:QBoxLayout
2877687574480 lvl 7: child 1:<outlineInnerGrid>:QGridLayout
2877687574320 lvl 6: child 1:<outlineGrid>:QGridLayout
2877687573840 lvl 5: child
2:<qt_splithandle_>:NestedSplitterHandle
2877687574960 lvl 5: child
3:<qt_splithandle_>:NestedSplitterHandle
2877687573520 lvl 4: child
2:<qt_splithandle_>:NestedSplitterHandle
2877793732240 lvl 4: child
3:<qt_splithandle_>:NestedSplitterHandle
2877692021328 lvl 3: child 2:<minibufferFrame>:QFrame
2877692022928 lvl 4: child 0:<minibufferHLayout>:QHBoxLayout
total objects: 65
I'll say more later.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/a0ed3069-ed29-4241-a8d9-ea6f74bb75cdn%40googlegroups.com.