[Scilab-users] Cannot understand scilex behavior when piping

Laurent Bonaventure laurent.bonaventure at ac-nantes.fr
Thu Oct 1 15:51:55 CEST 2015


Hello.

I'm still trying to understand the difference in behavior when opening a 
graphic windows, between:
- opening it directly from Scilex
- opening it from Scilex, but when Scilex stdin is piped

I managed to narrow down the behavior to the opening of a new graphic 
window by java.

In Scilex (Windows 7+Scilab 5.5.2), if you type:

jimport org.scilab.modules.graphic_objects.builder.Builder
jimport org.scilab.modules.graphic_objects.CallGraphicController
p=jinvoke(Builder,"createNewFigureWithAxes")
jinvoke(CallGraphicController,"setGraphicObjectProperty",p,357,%f) 
//__GO_MENUBAR_VISIBLE__, false
jinvoke(CallGraphicController,"setGraphicObjectProperty",p,355,%f) 
//__GO_TOOLBAR_VISIBLE__, false
jinvoke(CallGraphicController,"setGraphicObjectProperty",p,358,%f) 
//__GO_INFOBAR_VISIBLE__, false
jinvoke(CallGraphicController,"setGraphicObjectProperty",p,357,%t) 
//__GO_MENUBAR_VISIBLE__, true
jinvoke(CallGraphicController,"setGraphicObjectProperty",p,355,%t) 
//__GO_TOOLBAR_VISIBLE__, true
jinvoke(CallGraphicController,"setGraphicObjectProperty",p,358,%t) 
//__GO_INFOBAR_VISIBLE__, true

then you get an empty graphic window (java), and when you select 
Edit/Axes Properties, the Tk "graphic editor" window shows up immediately.

If you send the same commands to Scilex "through a pipe" (eg: cat | 
scilex) (assuming you have "cat" on your windows), then the graphic 
window appears normally, but the Tk window don't show up when you select 
Edit/Axes Properties.

Strangely, if you then close the graphic window and then reopen it (by 
sending the above commands again), the Tk windows shows up (too late).

Could someone give me a hint about what's going on here? Why isn't Tk 
interacting correctly with the java graphic window in the "pipe" case, 
while everything goes normally in the "non-pipe" case?

Thanks

Laurent Bonaventure

Le 20/09/2015 04:41, Laurent Bonaventure a écrit :
> Hello.
>
> I'm still trying to pipe instructions into scilex (Windows 7, Scilab 5.4).
>
> When I send a plot command, scilex opens the graphics window and draw my
> polyline -> Great !
>
> Then I try to open the graphics editor from within the graphics window
> (e.g. Edit/Axes properties) : nothing happens.
>
> Then I close the graphics window.
>
> Then I send the plot command again. And poof! The graphics windows opens
> AND the long awaited graphics editor too. Except that nothing works in it.
>
> I guess it's some sort of handlers problem: the graphics window cannot
> communicate correctly with the scilab kernel and get the correct
> handlers to the figure.
>
> What's more strange, is that the behaviour is correct when I start
> scilex from within an interactive console (cmd)...
>
> Steps to reproduce (you need some utility like cat from gnuwin32, or any
> way to pipe commands to scilex) :
>
> (Incorrect behaviour, with a pipe)
> <from an interactive cmd.exe>
> cat | scilex
> x = 0:0.1:10
> plot(x,cos(x))
> <the graphic window opens>
> <click on Edit/Axes properties>
> <nothing happens>
> <close the graphic window>
> plot(x,cos(x))
> <the graphic window opens, and the graphic editor too (but it isn't
> functional)>
>
> (Correct behaviour, without pipe)
> <from an interactive cmd.exe>
> scilex
> x = 0:0.1:10
> plot(x,cos(x))
> <the graphic window opens>
> <click on Edit/Axes properties>
> <the graphic editor shows up immediately and is functional>
>
> I don't understand how scilex can see any difference between both
> approaches, and why it would have a different behaviour based on that
> difference. From its point of view, there shouldn't be any difference.
>
> Ah! And the -nw switch doesn't change anything... You get exactly the
> same behaviour in both cases.
>
> Can someone give me some sort of solution, or pointers, or even give me
> an idea for a workaround. I need to pipe things in scilex, and I need
> the first approach to work correctly...
>
> Thank you.
> Laurent





More information about the users mailing list