Problems with the ui* family of functions

classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Problems with the ui* family of functions

Martin Kunz

Hi,

The ui* family of functions are to my mind a valuable extension of Octave, thanks to everyone who was involved in their development!

Thanks also to Andreas Weber for the helpful example he posted recently [1] !

I am having some trouble with the ui* functions, though. Before submitting bug reports I wanted to make sure that the problem is not sitting in front of the screen.
Please have a look the attached sample script. It plots a sine wave that can be zoomed into in x-direction with a slider.
  1. If I drag the slider with the mouse, the yticks often change their length and the yticklabels move a bit horizontally. This does not happen if I click on the arrow buttons at the sides of the zoom slider.
  2. If I rescale the figure window interactively, the slider ends up in different places or is not visible at all. This also happens with Andreas' script (see the attached screenshot for an example). Neither refresh nor drawnow seem to help.

I am using Octave 4.2.0-rc2 on Windows 7.

[1] http://octave.1599824.n4.nabble.com/Creating-GUI-in-Octave-possible-tp4680097p4680099.html


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave

uiProblems.m (886 bytes) Download Attachment
uiProblems.png (117K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Mike Miller-4
On Fri, Oct 14, 2016 at 10:38:04 +0200, Martin Kunz wrote:

> Hi,
>
> The ui* family of functions are to my mind a valuable extension of
> Octave, thanks to everyone who was involved in their development!
>
> Thanks also to Andreas Weber for the helpful example he posted recently
> [1] !
>
> I am having some trouble with the ui* functions, though. Before
> submitting bug reports I wanted to make sure that the problem is not
> sitting in front of the screen.
> Please have a look the attached sample script. It plots a sine wave that
> can be zoomed into in x-direction with a slider.
>
>  1. If I drag the slider with the mouse, the yticks often change their
>     length and the yticklabels move a bit horizontally. This does not
>     happen if I click on the arrow buttons at the sides of the zoom slider.
>  2. If I rescale the figure window interactively, the slider ends up in
>     different places or is not visible at all. This also happens with
>     Andreas' script (see the attached screenshot for an example).
>     Neither refresh nor drawnow seem to help.
>
> I am using Octave 4.2.0-rc2 on Windows 7.

I can confirm #1 on Debian on the default branch with Qt 5, but not #2.
The figure window contents are a bit laggy when the figure window is
resized, but they always end up where they are supposed to be.

You should report both of these on the bug tracker. I can reproduce #1
without any slider or callback necessary, by simply calling xlim() in
such a way that the range is changed more or less drastically:

  plot (0:500)
  xlim ([0 500])
  xlim ([230 270])

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Pantxo
Mike Miller-4 wrote
On Fri, Oct 14, 2016 at 10:38:04 +0200, Martin Kunz wrote:
> Hi,
>
> The ui* family of functions are to my mind a valuable extension of
> Octave, thanks to everyone who was involved in their development!
>
> Thanks also to Andreas Weber for the helpful example he posted recently
> [1] !
>
> I am having some trouble with the ui* functions, though. Before
> submitting bug reports I wanted to make sure that the problem is not
> sitting in front of the screen.
> Please have a look the attached sample script. It plots a sine wave that
> can be zoomed into in x-direction with a slider.
>
>  1. If I drag the slider with the mouse, the yticks often change their
>     length and the yticklabels move a bit horizontally. This does not
>     happen if I click on the arrow buttons at the sides of the zoom slider.
>  2. If I rescale the figure window interactively, the slider ends up in
>     different places or is not visible at all. This also happens with
>     Andreas' script (see the attached screenshot for an example).
>     Neither refresh nor drawnow seem to help.
>
> I am using Octave 4.2.0-rc2 on Windows 7.

I can confirm #1 on Debian on the default branch with Qt 5, but not #2.
The figure window contents are a bit laggy when the figure window is
resized, but they always end up where they are supposed to be.

You should report both of these on the bug tracker. I can reproduce #1
without any slider or callback necessary, by simply calling xlim() in
such a way that the range is changed more or less drastically:

  plot (0:500)
  xlim ([0 500])
  xlim ([230 270])

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Hi,

I think both are known issues:
#1: https://savannah.gnu.org/bugs/?38553
#2: https://savannah.gnu.org/bugs/?44472

Pantxo
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Mike Miller-4
On Mon, Oct 17, 2016 at 13:32:18 -0700, Pantxo wrote:
> I think both are known issues:
> #1: https://savannah.gnu.org/bugs/?38553
> #2: https://savannah.gnu.org/bugs/?44472

Good catch, even though I commented on #44472 I did not remember that
the same slow resizing can turn into the widgets appearing to be stuck
in the wrong position on Windows.

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Pantxo


2016-10-17 22:44 GMT+02:00 Mike Miller <[hidden email]>:
On Mon, Oct 17, 2016 at 13:32:18 -0700, Pantxo wrote:
> I think both are known issues:
> #1: https://savannah.gnu.org/bugs/?38553
> #2: https://savannah.gnu.org/bugs/?44472

Good catch, even though I commented on #44472 I did not remember that
the same slow resizing can turn into the widgets appearing to be stuck
in the wrong position on Windows.

--
mike


Anyway I added an example inspired by #1 to bug report #38553.

Pantxo


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Martin Kunz
In reply to this post by Mike Miller-4
Thanks Pantxo and Mike for your answers!
> slow resizing can turn into the widgets appearing to be stuck
> in the wrong position on Windows.

How slow is slow? I see wrongly placed widgets over minutes with no change.


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Pantxo
Martin Kunz wrote
Thanks Pantxo and Mike for your answers!
> slow resizing can turn into the widgets appearing to be stuck
> in the wrong position on Windows.

How slow is slow? I see wrongly placed widgets over minutes with no change.


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
I think "slow" means the interpreter and the figure (gui thread) are no more synchronized: the last time the interpreter asked for a "drawnow" the gui was already being drawing the previous figure state, so in the end a "drawnow" has been dropped. And you can wait as long as you want, until a drawnow is requested by the graphics sytem (the interpreter drawnow doesn't do the job for me) this problem will stand.
What if you drag the corner of the figure just a little bitmore, do uicontrols come back to their expected positions?

I tested the following :

figure ()
uipanel ()
## Drag the corner of the figure fast enough to have uipanel misplaced
pos = get (gcf, "position");
set (gcf, "position", pos+2)
## the uipanel takes the full canvas again

Pantxo
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Mike Miller-4
On Wed, Oct 19, 2016 at 10:12:11 -0700, Pantxo wrote:
> Martin Kunz wrote
[…]
> > How slow is slow? I see wrongly placed widgets over minutes with no
> > change.
[…]
> What if you drag the corner of the figure just a little bitmore, do
> uicontrols come back to their expected positions?

Yes, sorry if I wasn't clear, I meant the speed of Octave's internal
resizing relative to the speed of the pointer.

If you move your mouse or touchpad at a speed of fewer pixels per second
does it give Octave enough time to resize the window contents correctly?
Is the incorrect placement when the figure is resized rapidly or
suddenly? This is what I remember observing in #44472 when I had access
to Windows.

--
mike

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Martin Kunz
In reply to this post by Pantxo

I think "slow" means the interpreter and the figure (gui thread) are no more
synchronized: the last time the interpreter asked for a "drawnow" the gui
was already being drawing the previous figure state, so in the end a
"drawnow" has been dropped. And you can wait as long as you want, until a
drawnow is requested by the graphics sytem (the interpreter drawnow doesn't
do the job for me) this problem will stand.
What if you drag the corner of the figure just a little bitmore, do
uicontrols come back to their expected positions? 

I tested the following :

figure ()
uipanel ()
## Drag the corner of the figure fast enough to have uipanel misplaced
pos = get (gcf, "position");
set (gcf, "position", pos+2)
## the uipanel takes the full canvas again 

Pantxo
I am running the lines quoted above. From what you wrote I conclude that you see an update of the figure while dragging the corner. This is different on my system (Win 7, Qt graphics toolkit): Whenever I drag a corner of the figure, no redrawing of the figure happens until I release the left mouse button. This is consistent with the behaviour of any other figure window here, no figure content is ever updated while I keep the left mouse button pressed.
After releasing the left mouse button, the uipanel from your example code is resized to the last (not current) figure position, i.e.:
  1. I run figure() and uipanel(). The uipanel fills the screen.
  2. I increase the figure size. The uipanel stays the same size.
  3. I increase the figure size. The uipanel grows so that it would fill the figure window extend set in 2., but as the figure is bigger now, I get a white border on the right and bottom of the figure window.

I have repeated step 3  many times with always the same result. Making the figure window successively smaller hides the 1px border on the right and the bottom (because the uipanel is then too big to fit into the figure window).

The speed of dragging does not have an influence on the result as far as I can tell.

The lines

pos = get (gcf, "position");
set (gcf, "position", pos+2)

resize the uipanel to almost the right size, but a 1px white margin on the right hand side remains.

_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Pantxo
In reply to this post by Mike Miller-4
>>1. I run figure() and uipanel(). The uipanel fills the screen.
>> 2. I increase the figure size. The uipanel stays the same size.
>> 3. I increase the figure size. The uipanel grows so that it would fill
>>    the figure window extend set in 2., but as the figure is bigger now,
>>    I get a white border on the right and bottom of the figure window.

>>I have repeated step 3  many times with always the same result. Making
>>the figure window successively smaller hides the 1px border on the right
>>and the bottom (because the uipanel is then too big to fit into the
>>figure window).
>>...

So this is consistent with what I wanted to explain: the gui thread is always "one drawnow late" and I have no idea how to fix this with the current system of (callback based) communication between the Qt figures and the interpreter. You'll have to wait until someone finds how to fix bug #44472.

Pantxo


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave
Reply | Threaded
Open this post in threaded view
|

Re: Problems with the ui* family of functions

Martin Kunz
In case it helps: I made a screencast with Andreas' demo script. The file is smaller than 1 MB and you can find it here:

http://s000.tinyupload.com/?file_id=44836872458886357929


Thanks Pantxo for the explanation!


_______________________________________________
Help-octave mailing list
[hidden email]
https://lists.gnu.org/mailman/listinfo/help-octave