I hope that means that you agree with my api choice. There are a
*lot* of possibilities -- several which I tried -- but I think the
above fits with the straightforward Sage/Python way of doing things.
You can only have one handler for each mouse event, but I think that's
ok. I can easily imagine teaching anybody who knows Sage this
plotting mouse api in like two minutes.
One thing for cloud.sagemath that took me some thought is -- where
exactly should the *output* of the event functions go? E.g, whne you
click the function c above prints "click". I decided to *render* this
output in the cell in which the show occurs -- but not to *store* it
anywhere in the worksheet. This means multiple users of a single
worksheet can click at the same time, and at least the output actions
are independent, though of course the global Python process state is
the same. Also, recording the clicks forever would be silly. You
don't have to worry about this with sage cell server.
The relevant file for you to look at is salvus/salvus/graphics.py, by
the way. There's a few innocent little lines in there involving
change of coordinates, which took me way too long to figure out.
> I notice some accuracy problems sometimes,
> though. For example, in the above example, when trying to put my cursor on
> the point (0,0), I get coordinates of something like (-.07, .008). I
> actually have to move it fairly far to the right of (0,0) (definitely past
> the tick mark) to get the coordinate to be nonnegative. Does anyone else
> see that?
Jason -- thanks for pointing this out -- this is a genuine bug; more
accurately, it was me just
not fully finishing the implementation yet. If you include the
fig_tight=False option, it should be *exactly* right. (You can also
pass svg=True to show to see svg output instead.)
@interact
def f0(fun=x*sin(x), mousemove='', click=''):
g = plot(fun, (0,5))
def h(p):
f0.mousemove = p
def c(p):
print "click"
f0.click = p
show(g, events={'click':c, 'mousemove':h}, gridlines=True, fig_tight=False)
Needless to say, I just need to check in my code what options are
passed to show and handle the fig_tight=True case properly. I'll fix
this right now (it should be easy).
---
Regarding sage-cell, should I make a script based on
$HOME/.sagemathcloud/ipython-notebook, which is instead
$HOME/.sagemathcloud/sagecell-server? And, should we have a file
format for a sage cell -- e.g., foo.sagecell -- which would store the
input to the cell, other config options, etc., -- this would be an
alternative to using html/javascript to embed a sage cell. Soon
people might start posting public sage cell servlets like this:
https://cloud.sagemath.com/grout/demos/master/foo.sagecell
For collaborator access, it's clear what the above should do. For
public access, I think I'll have to setup some seamless system whereby
one can run an LXC container inside a project, and have one spawned
for each client, with certain results saved in the project... or
something like that. I spent some time with LXC recently, and I'm
very, very impressed with all the progress that is being made on it
(thanks to the Linux devs/distros out there, to Docker, etc.).
>
> Thanks,
>
> Jason
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-cloud" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to
sage-cloud+...@googlegroups.com.
> To post to this group, send email to
sage-...@googlegroups.com.
> Visit this group at
http://groups.google.com/group/sage-cloud.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/sage-cloud/523AE726.8070907%40creativetrax.com.
> For more options, visit
https://groups.google.com/groups/opt_out.