Here's the idea I had for the curses based editor. You take our pretty printing system, and rewrite it so that instead of building up the 2d string expression like it does now, it builds it up in blocks. Each block would be an object that contains it's string form. You can append blocks to the the side of other blocks, or extend them in a direction with whitespace, and so on. This is all things that the pretty printer does now to make things work, but it does it by just manipulating the strings directly. My idea is to have it put in proxy object that hold the strings, so you can tell afterword what the block structure is.
Then, you use curses to manipulate these blocks. It should be easy to create a keyboard interface to maneuver the block structure. Then, the tricky part is to build the interface to actually manipulate the block structure, in real time. Suppose I had x**2 already entered and printed. If I have the cursor fully to the right of the expression (i.e., in an empty block to the right of the x**2 block), and I type /, it should call the "division" hook, which will add a block with -- below the block with the printed x**2, and then add an empty block below that where the cursor will be placed. Then, if I type y, it will change the empty block to contain y. If I keep the cursor below the -- but to the right of the y, and I type + z, it should create two blocks to the right of y, one with " + " and one with z, *and*, it should extend the -- block above it to ----- and extend and recenter the x**2 block. Much of this logic is already implemented in the pretty printer. You'll just need to restructure it to handle keeping track of the blocks after they are built, and also some restructuring relating to manipulating individual blocks after they are built. You'll probably need to do some restructuring to make it print expressions that aren't fully built (like just "x +"). And you'll obviously need to hook into curses to do keyboard shortcuts and interface for all this (but if you use a good curses frontend, this is not difficult). This is just the backend. For the frontend, you could create a simple repl (in curses) for demonstration purposes. Ideally, this would be hooked into a real Python curses repl, like bpython, or a future IPython curses console. I wouldn't worry to much about the frontend, except getting what is necessary to actually use the thing. If you want to do the equation editor in an interface other than curses, I'm afraid I don't have many suggestions for you. You'll have to come up with the ideas yourself. We don't already have a printer written in any other backend that you can manipulate, so you'd either have to find one yourself and hook it into SymPy, or start from scratch somehow. Aaron Meurer On Wed, Apr 4, 2012 at 1:08 PM, Vishesh Kumar <[email protected]> wrote: > Hi > > Thanks for the advice Stefan, I finally managed to get the matplot lib > functionality to work! It's such a charm (especially after the continual > failure of pyglet). In plotting 3-D surfaces, it gave me an error that > autoscalezon takes only two arguments, three given. That seemed like a tiny > error, I managed to fix in my own branch. I don't think that merits a pull > request or anything, does it? And if not, how does one go about covering > that with a fix? =) > > To Aaron, and any interested mentor, I would really like to work the > equation editor idea, and need some assistance and guidance on how to make a > schedule, and what all topics or ground I am expected to cover in a summer. > Also, what is the possibility of contributing in ways not directly relevant > to the equation editor, like the random idea for the plotting module I put > in my application? Would that be considered relevant to my summer work, if > selected? It's probably better to keep it on topic (though you are of course free to work on extraneous stuff if you have time). > > > On Monday, 2 April 2012 22:47:51 UTC+5:30, Stefan Krastanov wrote: >> >> Hi, >> >> I can not say anything about the equation editor, but I may try to >> help with the plotting module. Whenever you decide to try to make it >> work again just contact us and describe the problem. To clone it and >> use it you have to do (more or less) the following: >> >> - install git >> - clone sympy from github.com/sympy/sympy.git >> - make a new branch >> - go onto that new branch (i.e. checkout it) >> - pull onto your new empty branch the branch in which the plotting >> module is developed (git pull https://github.com/Krastanov/sympy.git >> plotting) >> - play with it (You will need matplotlib installed. It would be also >> very useful to install ipython (which anyway you may need for other >> possible projects)) >> >> If you are working on a linux or mac system you can find step by step >> explanations in the "developer workflow" page in our documentation. >> >> Stefan > > -- > You received this message because you are subscribed to the Google Groups > "sympy" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/sympy/-/Blj0HTDMxJEJ. > > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sympy?hl=en. -- You received this message because you are subscribed to the Google Groups "sympy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
