Hi,
(This may have been documented or answered before but I haven't found it.) I'm using inspector a lot to do experiments on data, that I get the data collections and inspect them and in inspector I type in message that will operate on the objects and make a plot for visualization. Now I want to build the routines into a GUI. I would like to have two main areas on the window, one plot area for chart and another being script area for type in Smalltalk codes to operate on objects and the chart. I have no problem in getting plots on specified data nor building menus for displaying different plot each at a time however I don't know how to script them using a code area. Is there any example that I can learn from? Or any tips on most important Classes to look at? Thanks in advance! Best Regards, Jim G _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Smacc would be an ideal way to do scripting from a Text Window and have any UI action to run it.. ( Hope I am not misunderstanding your query..) -skrish On Mon, Nov 2, 2009 at 12:00 PM, Jim Guo <[hidden email]> wrote: Hi, _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Hi, Sudhakar,
Thank you. I'm using Jun for plotting. I know little about Smacc if it's for such tasks I'll learn to use it. On Mon, Nov 2, 2009 at 2:41 PM, Sudhakar Krishnamachari <[hidden email]> wrote: > Smacc would be an ideal way to do scripting from a Text Window and have any > UI action to run it.. > > ( Hope I am not misunderstanding your query..) > -skrish > On Mon, Nov 2, 2009 at 12:00 PM, Jim Guo <[hidden email]> wrote: >> >> Hi, >> >> (This may have been documented or answered before but I haven't found it.) >> >> I'm using inspector a lot to do experiments on data, that I get the >> data collections and inspect them and in inspector I type in message >> that will operate on the objects and make a plot for visualization. >> Now I want to build the routines into a GUI. I would like to have two >> main areas on the window, one plot area for chart and another being >> script area for type in Smalltalk codes to operate on objects and the >> chart. >> >> I have no problem in getting plots on specified data nor building >> menus for displaying different plot each at a time however I don't >> know how to script them using a code area. >> >> Is there any example that I can learn from? Or any tips on most >> important Classes to look at? Thanks in advance! >> >> Best Regards, >> >> Jim G >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > -- Best Regards, Jim G _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by J G
Hi, Tomáš
Thanks, I all try it since it reads not that complex, hope it is. Regards, Jim G 2009/11/2 Tomáš Dvořák <[hidden email]>: > If you do not plan to build your own scripting language (which is what SmaCC > would be great for) and just use smalltalk, the only obstacle left is making > the text in your scripting pane access your plot data. That is IMO > essentially the same as adding local variables to smalltalk Workspace. To > see how to do that, have a look at the AbstractWorkspace class, and follow > references from e.g. #doItEnvironment. > > Best regards.. > Tomas Dvorak > > On Mon, 02 Nov 2009 07:30:07 +0100, Jim Guo <[hidden email]> wrote: > >> Hi, >> >> (This may have been documented or answered before but I haven't found it.) >> >> I'm using inspector a lot to do experiments on data, that I get the >> data collections and inspect them and in inspector I type in message >> that will operate on the objects and make a plot for visualization. >> Now I want to build the routines into a GUI. I would like to have two >> main areas on the window, one plot area for chart and another being >> script area for type in Smalltalk codes to operate on objects and the >> chart. >> >> I have no problem in getting plots on specified data nor building >> menus for displaying different plot each at a time however I don't >> know how to script them using a code area. >> >> Is there any example that I can learn from? Or any tips on most >> important Classes to look at? Thanks in advance! >> >> Best Regards, >> >> Jim G >> _______________________________________________ >> vwnc mailing list >> [hidden email] >> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc > > > -- Best Regards, Jim G _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by J G
Hi Jim!
Jim Guo wrote: > I'm using inspector a lot to do experiments on data, that I get the > data collections and inspect them and in inspector I type in > message that will operate on the objects and make a plot for > visualization. Now I want to build the routines into a GUI. I > would like to have two main areas on the window, one plot area for > chart and another being script area for type in Smalltalk codes to > operate on objects and the chart. > > I have no problem in getting plots on specified data nor building > menus for displaying different plot each at a time however I don't > know how to script them using a code area. If you really want to be able to enter Smalltalk code into a text editor to "script" your display, you could go with something along the lines of method := Compiler new compile: codeString in: nil allowReceiver: false class: nil class environment: Smalltalk noPattern: true notifying: nil ifFail: [ nil ]. method isNil ifTrue: [ ^ nil ]. block := nil performMethod: method. block isNil ifTrue: [ ^ nil ]. testResult := [ block valueWithArguments: self testParameters ] on: Error do: [ : ex | ex return: nil ]. ^ testResult isNil ifTrue: [ nil ] ifFalse: [ block ] where codeString contains string of a block (possibly with a fixed set of input parameters added by the GUI). But beware, if you deploy this anyone could enter "ObjectMemory quit" as code and this would be working as intended... So the SmaCC solution on a special "language" might be better, if this was for production use. Or some kind of sandboxing or which objects and methods might be sent from user provided Smalltalk code... Regards Jan _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by J G
In this same direction, here I send a few lines of a custom inspector I
have (sceneWorkspace is the aspect of a subcanvas): >>initialize ... self sceneWorkspace: (Workspace on: '' asValue). self initializeWorkspaceVariables ... initializeWorkspaceVariables | objects | "get in objects all the variables you want to add to the workspace in the form (name -> object)" ... SystemUtils modifySystem: [self addWorkspaceVariables: objects]. addWorkspaceVariables: aCollection aCollection do: [:assoc| self sceneWorkspace addLocal: assoc key value: assoc value]. HTH, Andrés Jim Guo escribió: > Hi, Tomáš > > Thanks, I all try it since it reads not that complex, hope it is. > > Regards, > > Jim G > > 2009/11/2 Tomáš Dvořák <[hidden email]>: >> If you do not plan to build your own scripting language (which is what SmaCC >> would be great for) and just use smalltalk, the only obstacle left is making >> the text in your scripting pane access your plot data. That is IMO >> essentially the same as adding local variables to smalltalk Workspace. To >> see how to do that, have a look at the AbstractWorkspace class, and follow >> references from e.g. #doItEnvironment. >> >> Best regards.. >> Tomas Dvorak >> >> On Mon, 02 Nov 2009 07:30:07 +0100, Jim Guo <[hidden email]> wrote: >> >>> Hi, >>> >>> (This may have been documented or answered before but I haven't found it.) >>> >>> I'm using inspector a lot to do experiments on data, that I get the >>> data collections and inspect them and in inspector I type in message >>> that will operate on the objects and make a plot for visualization. >>> Now I want to build the routines into a GUI. I would like to have two >>> main areas on the window, one plot area for chart and another being >>> script area for type in Smalltalk codes to operate on objects and the >>> chart. >>> >>> I have no problem in getting plots on specified data nor building >>> menus for displaying different plot each at a time however I don't >>> know how to script them using a code area. >>> >>> Is there any example that I can learn from? Or any tips on most >>> important Classes to look at? Thanks in advance! >>> >>> Best Regards, >>> >>> Jim G >>> _______________________________________________ >>> vwnc mailing list >>> [hidden email] >>> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc >> >> > > > vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Thank you, Andrés, it's helpful indeed and I'll try to start from here
using your sample code before this weekend I hope, now I have to deal with something else. I'll ask again if I can't make it. Regards, Jim G On Mon, Nov 2, 2009 at 7:52 PM, andres <[hidden email]> wrote: > In this same direction, here I send a few lines of a custom inspector I > have (sceneWorkspace is the aspect of a subcanvas): > > >>initialize > ... > self sceneWorkspace: (Workspace on: '' asValue). > self initializeWorkspaceVariables > ... > > initializeWorkspaceVariables > > | objects | > > "get in objects all the variables you want to add to the workspace in > the form (name -> object)" > ... > SystemUtils modifySystem: [self addWorkspaceVariables: objects]. > > > addWorkspaceVariables: aCollection > > aCollection do: [:assoc| self sceneWorkspace addLocal: assoc key value: > assoc value]. > > HTH, > Andrés > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
In reply to this post by Jan Weerts
Hi, Jan,
I have to admit that you've shown the thing I failed to ask for but have dreamed to know for years :) Now I know how to turn texts into blocks in VW. Thanks. I only need to do this occasionally so I have never tried to get an answer. I am so happy to read your example since I love all tricks of this kind. Thank you! (And thanks to all responds I've learned so much from. The community is always so nice.) In fact I am making the little thing for myself and 2-3 friends so it's OK if they feel it cool to kill the running objects using their scripts :) Regards, Jim G On Mon, Nov 2, 2009 at 6:51 PM, Jan Weerts <[hidden email]> wrote: > Hi Jim! > > Jim Guo wrote: >> I'm using inspector a lot to do experiments on data, that I get the >> data collections and inspect them and in inspector I type in >> message that will operate on the objects and make a plot for >> visualization. Now I want to build the routines into a GUI. I >> would like to have two main areas on the window, one plot area for >> chart and another being script area for type in Smalltalk codes to >> operate on objects and the chart. >> >> I have no problem in getting plots on specified data nor building >> menus for displaying different plot each at a time however I don't >> know how to script them using a code area. > > If you really want to be able to enter Smalltalk code into > a text editor to "script" your display, you could go with something > along the lines of > > method := Compiler new > compile: codeString > in: nil > allowReceiver: false > class: nil class > environment: Smalltalk > noPattern: true > notifying: nil > ifFail: [ nil ]. > method isNil ifTrue: [ ^ nil ]. > block := nil performMethod: method. > block isNil ifTrue: [ ^ nil ]. > > testResult := [ block valueWithArguments: self testParameters ] on: > Error do: [ : ex | ex return: nil ]. > ^ testResult isNil > ifTrue: [ nil ] > ifFalse: [ block ] > where codeString contains string of a block (possibly with a fixed set > of input parameters added by the GUI). > > But beware, if you deploy this anyone could enter "ObjectMemory quit" > as code and this would be working as intended... > > So the SmaCC solution on a special "language" might be better, if this > was for production use. Or some kind of sandboxing or which objects > and methods might be sent from user provided Smalltalk code... > > Regards > Jan > _______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc |
Free forum by Nabble | Edit this page |