On Fri, June 10, 2011 13:36, Jeremy Sanders wrote:
> Benjamin K. Stuhl wrote:
>
>> Hi Jeremy,
>>   I'm looking into making the control graph items nudgeable using the
>> keyboard, but I've run into a roadblock: plotwindow.selectedWidgets()
destroys and recreates the control items. Since
>> plotwindow.selectedWidgets() is regularly called from the update timer,
this means that the control items don't stick around long enough to
keep keyboard focus!
>>   Is there some way to tell if the control items really _need_ to be
>> changed (e.g. by the document change set or something), so that I can
give them a bit more longevity?
>
> Urgh - the design of controlgraphs is a bit ugly isn't it?
>
> What do you think is best?
>
>  - Reimplement them to be some part of the widget which is updated if
> necessary - quite a bit of work. You'd have the same controlgraph for
all the time for the widget.
>
>  - Only replace them if necessary - I think this will break your keyboard
> moving code still however.

For now this is probably OK, since if you have clicked on a widget
property to change something, the controlgraph has lost keyboard focus
already.

>  - Some sort of hack which checks whether a controlgraph has the keyboard
> focus on updating the document, and gives it back to the controlgraph of
the same widget after updating.
>
> I think the design for controlgraphs is not great as you could
> (theoretically) have two windows onto the same document open, breaking
the current implementation. I suspect the QPainter passed to widget draw
should actually keep track of the controlgraphs. We should probably make
a proper class for this.
>
> In the long run, I think doing this and moving to some sort of update
model to save having to destroy them all the time would be best.

Longer term, having a more intelligent update model would be valuable for
multiple reasons. I've had occasion recently to ask Veusz to plot several
hundred thousand points, and while it can do so, it's still pretty slow,
at least with antialiasing turned on. One way to speed things up a lot
would be to change the rendering system so that each widget is its own
layer, which is only updated on demand, and then the drawing code simply
composites the layers together. Right now, changing an axis label also
prompts a redraw of every curve; caching layers would circumvent this.
This might not be _too_ hard to implement naively: each widget redraws its
layer whenever it settings are changed, while the plotwindow give the
widgets new layers whenever the zoom is changed. Of course, decent export
still wants all the drawing to happen directly, rather than through a
series of composited layers. (Though that in turn has the problem that my
printer choked on the ~30 MB of postscript that the print driver produced,
so...)

Regards,
-- BKS



_______________________________________________
Veusz-discuss mailing list
[email protected]
https://mail.gna.org/listinfo/veusz-discuss

Répondre à