Paned notifications to children on changing childs resize property



Hi, first time poster here, so please be gentle :-)

(I've reposted, because I think subscribing with gmail instead of
googlemail caused my messages to not be posted)

I have nested Panes, with the feature that double-clicking the handle will
"rebalance" them. If the widgets are created with resize False, then the
rebalance does not work properly with deeply nested panes. If I set child2
resize to True the rebalance is perfect. Unfortunately with True the
behaviour on resizing the window is bad with children not growing, or
collapsing as the window border sweeps them up, instead of evenly
growing/shrinking. If I set resize to True. do the rebalance, then set
child2's resize back to False, many paned positions will jump to an
incorrect position, but the window behaviour is the desired even
growing/shrinking. When changing resize to False the container sends a
notification to the widget, and when control returns to the main loop, the
notification is processed, causing the Paned handle to move.

As near as I can tell, the widgets get an initial allocation at creation,
but when we set resize to True and then call set_position on Paned, the
allocation does not get updated. When the main loop processes the
notification I think the child is reading it's old, original allocation,
and requesting that much from the parent Paned. The Paned is then trying to
oblige all these requests for allocation, which destroys the desired
positions.

A final wrinkle is that if resize is set back to False (messing up the
balancing) then performing the rebalance multiple times will eventually
reach an evenly distribution of space. The number of times this must be
done is related to the depth of nesting.

So my first question is does my description make sense? Or have I made an
incorrect leap of logic somewhere?

I've tried lots of workarounds trying to fix the issue, but so far none
have worked. So I'm now at the point where I can think of the following
possible approaches, but I'm simply not sure if they will work:

   1. There is some simple way to stop/block/delete that damn notification,
   2. There is some simple way to quietly set the allocation that doesn't
   cause the Paned position to move,
   3. Getting a little more involved, perhaps override the function that
   sends the sizes to the children, forcing balanced appropriate values if we
   are in rebalance call, otherwise call the super class function,
   4. Or the extreme of sub-classing Container or Box to create a
   "MultiPaned" widget that can have 0 < n < inf. children, but be resized
   with dragging like a Paned widget.

Some advice on the feasibility, or pointers to examples would be awesome.
Of course a better idea that I haven't thought of myself would also be
great.

For background I'm the current maintainer of Terminator
<http://gnometerminator.blogspot.com/p/introduction.html>, a Python
application using the libvte widget to "tile" terminals. For reference here
is the issue <https://bugs.launchpad.net/bugs/1520969>.

To be honest the lack of a MultiPaned type widget causes real problems
trying to get some parts of Terminator to work. Some of the recursive
gymnastics are horrible and frequently cause buggy behaviour. If only Paned
(like QSplitter) could have more than 2 children.

--

Regards
Steve


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]