JuliaGizmos / Escher.jl

Composable Web UIs in Julia
https://juliagizmos.github.io/Escher.jl
Other
335 stars 63 forks source link

Reactive.jl update broke my Escher widgets #114

Closed zznop closed 8 years ago

zznop commented 8 years ago

I can no longer get my Escher apps to run correctly after Pkg.update(). There appears to be some issue since moving from Input() to Signal() or lift to map in Reactive.jl. After the update I first started my app and got the deprecation warnings - however, they appear to be more than warnings because without correcting the deprecations my app wouldn't load at all. When I changed lift->map and Input->Signal my app loads but the tabs are broken. Both pages in the tab() widget are now displayed on the same page and switching between the tab buttons doesn't do anything. Furthermore, my leftbutton doesn't work. Everything just hangs. Here's were it ends:

EDIT

Pkg.checkout("Escher"); Pkg.build("Escher") fixed the brunt of the issue. I'd say in a perfect world that it would be awesome if all the versions in METADATA could stay compatible, but this isn't a perfect world ;) Now I'm getting

Failed to push!
    WARNING: both Patchwork and Base export "Text"; uses of it in module Main must be qualified
Signal{Escher.FillColor}(Escher.FillColor(RGB{U8}(0.204,0.204,0.204),Escher.Flow{Escher.Vertical}(Escher.Vertical(),Escher.TileList(Union{Escher.FillColor,Escher.PackedAcross{Escher.AxisCenter}}[Escher.FillColor(RGB{U8}(0.204,0.204,0.204),Escher.PackedAcross{Escher.AxisCenter}(Escher.AxisCenter(),Escher.Flow{Escher.Vertical}(Escher.Vertical(),Escher.TileList([Escher.PadContent(Escher.Side[],Escher.Length{:em}(1.0),Escher.Container(Escher.Flow{Escher.Horizontal}(Escher.Horizontal(),Escher.TileList([Escher.Image("assets/img/cateye.png","")]),false)))]),false))),Escher.FillColor(RGB{U8}(0.333,0.333,0.333),Escher.PackedAcross{Escher.AxisCenter}(Escher.AxisCenter(),Escher.Flow{Escher.Vertical}(Escher.Vertical(),Escher.TileList([Escher.Width("max",Escher.Length{:em}(50.0),Escher.ChanSend(:tabschannel,Escher.Selectable(Escher.Tabs(Escher.TileList([Escher.PadContent(Escher.Side{Escher.Horizontal}[Escher.Left(),Escher.Right()],Escher.Length{:em}(2.0),Escher.Container(Escher.FontColor(RGB{U8}(1.0,1.0,1.0),Escher.TileList([Escher.Flow{Escher.Horizontal}(Escher.Horizontal(),Escher.TileList([Escher.WithFontType(Escher.Monospace(),Escher.TileList([Escher.WithFontSize{Escher.Length{:em}}(Escher.Length{:em}(2.0),Escher.TileList(ASCIIString["Management"]))]))]),false)])))),Escher.PadContent(Escher.Side{Escher.Horizontal}[Es
....
to node
....
UndefVarError: withlastchild not defined
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/behavior.jl:186
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/layout.jl:73
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/tile.jl:92
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/layout.jl:290
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/layout.jl:266
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/embellishment.jl:175
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/tile.jl:92
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/layout.jl:290
 in render at /home/dsb/.julia/v0.4/Escher/src/basics/embellishment.jl:175
 in anonymous at /home/dsb/.julia/v0.4/Escher/src/cli/serve.jl:123
 in anonymous at /home/dsb/.julia/v0.4/Reactive/src/operators.jl:111
 in do_action at /home/dsb/.julia/v0.4/Reactive/src/core.jl:135
 in send_value! at /home/dsb/.julia/v0.4/Reactive/src/core.jl:130
 in anonymous at /home/dsb/.julia/v0.4/Reactive/src/operators.jl:88
 in do_action at /home/dsb/.julia/v0.4/Reactive/src/core.jl:135
 in send_value! at /home/dsb/.julia/v0.4/Reactive/src/core.jl:130
 in anonymous at /home/dsb/.julia/v0.4/Reactive/src/operators.jl:256
 in do_action at /home/dsb/.julia/v0.4/Reactive/src/core.jl:135
 in send_value! at /home/dsb/.julia/v0.4/Reactive/src/core.jl:130
 in send_value! at /home/dsb/.julia/v0.4/Reactive/src/core.jl:133
 in run at /home/dsb/.julia/v0.4/Reactive/src/core.jl:190
 in run at /home/dsb/.julia/v0.4/Reactive/src/core.jl:181
 [inlined code] from /home/dsb/.julia/v0.4/Reactive/src/core.jl:228
 in anonymous at task.jl:447
zznop commented 8 years ago

Looks like the faulty code is at line 186 of src/basics/behavior.jl:

render(chan::ChanSend, state) =
    withlastchild(render(chan.tile, state)) do child
        child <<
            Elem("chan-send", attributes=@d(:chan=>chan.chan))
    end

The method it's attempting to call is part of Patchwork.jl

I added export withlastchild to Patchwork.jl which fixed that issue (or so I think) - but that brought out some other issues :disappointed:

I also wanted to point out that the master branch of Escher.jl requires Patchwork 0.1.5, but the 0.1.5 tag is missing from the Patchwork repository.

shashi commented 8 years ago

Are you using the master branch of Escher?

zznop commented 8 years ago

I've tried multiple branches. I've even tried a fresh .julia directory letting Escher install it's deps. You just get the lift/map and Input/Signal deprecations and the page hangs.

               _
   _       _ _(_)_     |  A fresh approach to technical computing
  (_)     | (_) (_)    |  Documentation: http://docs.julialang.org
   _ _   _| |_  __ _   |  Type "?help" for help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 0.4.3 (2016-01-12 21:37 UTC)
 _/ |\__'_|_|_|\__'_|  |  Official http://julialang.org/ release
|__/                   |  x86_64-unknown-linux-gnu

julia> Pkg.status("Escher")
 - Escher                        0.2.1

julia> Pkg.status("Reactive")
 - Reactive                      0.3.0

julia> Pkg.status("Mux")
 - Mux                           0.2.0

julia> Pkg.status("Patchwork")
 - Patchwork                     0.1.9

When I upgrade to master - Pkg.checkout("Escher"); Pkg.build("Escher") I get the following output when attempting to run form.jl:

Listening on 0.0.0.0:5555...
UndefVarError: capture not defined
 in anonymous at /home/r2dbg/.julia/v0.4/Escher/src/cli/serve.jl:170
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/Mux.jl:15
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/Mux.jl:8
 in splitquery at /home/r2dbg/.julia/v0.4/Mux/src/basics.jl:28
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/Mux.jl:8
 in wcatch at /home/r2dbg/.julia/v0.4/Mux/src/websockets_integration.jl:12
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/Mux.jl:8
 in todict at /home/r2dbg/.julia/v0.4/Mux/src/basics.jl:21
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/Mux.jl:12 (repeats 2 times)
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/Mux.jl:8
 in anonymous at /home/r2dbg/.julia/v0.4/Mux/src/server.jl:38
 in handle at /home/r2dbg/.julia/v0.4/WebSockets/src/WebSockets.jl:382
 in on_message_complete at /home/r2dbg/.julia/v0.4/HttpServer/src/HttpServer.jl:393
 in on_message_complete at /home/r2dbg/.julia/v0.4/HttpServer/src/RequestParser.jl:104

My temp solution is running off an old version of METADATA,jl (145 commits ago) which uses Reactive 0.2.4 - but I'm itchin to remove my lift/Input() deprecations ;)

shashi commented 8 years ago

Fixed these things on master. Please try it out. You will need Reactive 0.3.0.

zznop commented 8 years ago

I'm getting the same error as issue #115 now

shashi commented 8 years ago

Please try now. I'm going to tag a fix release soon. Also added in a simple test for this stuff. You need to install ComposeDiff with Pkg.add("ComposeDiff") now to use Gadfly or Compose.

shashi commented 8 years ago

Tagged a release

zznop commented 8 years ago

When trying examples on Julia 0.5.0 I get:

Listening on 0.0.0.0:5555...
WARNING: both Reactive and Base export "foreach"; uses of it in module Main must be qualified
Error handling websocket connection:
UndefVarError: foreach not defined
 in anonymous at /home/dsb/.julia/v0.5/Escher/src/cli/serve.jl:161
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/Mux.jl:15
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/Mux.jl:8
 in splitquery at /home/dsb/.julia/v0.5/Mux/src/basics.jl:28
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/Mux.jl:8
 in wcatch at /home/dsb/.julia/v0.5/Mux/src/websockets_integration.jl:12
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/Mux.jl:8
 in todict at /home/dsb/.julia/v0.5/Mux/src/basics.jl:21
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/Mux.jl:12 (repeats 2 times)
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/Mux.jl:8
 in anonymous at /home/dsb/.julia/v0.5/Mux/src/server.jl:38
 in handle at /home/dsb/.julia/v0.5/WebSockets/src/WebSockets.jl:382
 in on_message_complete at /home/dsb/.julia/v0.5/HttpServer/src/HttpServer.jl:393
 in on_message_complete at /home/dsb/.julia/v0.5/HttpServer/src/RequestParser.jl:104^Cfatal: error thrown and no exception handler available.

However, in Julia stable it looks like your new tag is mostly workable. mc.jl loads, but about 70% of the time when you click the start button nothing happens. I'm having the same issue in my apps with the following code:

btn = Signal(Any, leftbutton)

When triggering with trigger!(s, :submit, button()) buttons work great (form.jl) - but the Signal(Any, leftbutton) style doesn't seem to work right :disappointed: (or at all in my applications).

zznop commented 8 years ago

To provide some context here's how I'm trying to execute a form operation:

dataview = Signal((Any, status_vbox("Upload a data file"))
filename = Signal(Any, "")
protocol = Signal(0)
filetype = Signal(Any, "0")
btn      = Signal(Any, leftbutton)

result = map(sampleon(btn, filename),
    sampleon(btn, protocol),
    sampleon(btn, filetype);
    typ=Any, init=nothing) do f, p, t
    run_processor(f, p, parse(Int, t), running, dataview)
end

I use this abstraction so I can control a spinner to show busy operations when processing data. run_processor crunches a static file and pushes the results as a vbox() into dataview. However, when I click the button nothing happens. No spinner and no backend terminal debug output.

dioptre commented 8 years ago

I got that foreach issue in 0.5 too - I think thats killing it!

randyzwitch commented 8 years ago

foreach ambiguity resolved with #132

zznop commented 8 years ago

I just tested the examples a day ago (since #132 was resolved) and still mc.jl only fires on button click after multiple refreshes. Yes - the foreach issue helped on Julia v0.5 but I am still not getting the examples to behave correctly.

As I stated before, when I run the mc.jl example and repeatedly adjust the parameters and submit (without refreshing the page), after a few times the animated graphic no longer renders. Perhaps this is a separate issue.

randyzwitch commented 8 years ago

Yup, having same trouble with the mc.jl example, created #137 to get all examples updated