Howdy!
I want to build a Playground-like browser and I'd really like some help for getting the initial prototype up and running. I see two parts: - Code entry with "Go" button. - Code execution with output printed (interpreter running as unix process.) I have made a start on the "Code entry" pane like this: | composite | composite := GLMCompositePresentation new. composite title: 'Script editor'. composite text. composite act: [] iconName: #glamorousGo on: $G entitled: 'Run'. composite openOn: ''. which does look the way that I want: but the part I am missing is how to make the "Go" action (green arrow) cause a new object to be inspected in a miller column to the right (like in the Playground and the Inspector.) Could somebody please tell me how to update the example to make this happen? The next part is that I want to run the code using an interpreter running in a separate unix process (a PipeableOSProcess.) I have made a GTInspector extension to inspect this process and show its output, but I am looking for a way to automatically refresh the presentation when new output becomes available (e.g. polling at ~100ms interval and inserting new text that has been printed.) Can somebody give me a hint about how to update that presentation with the latest output of the process? Then, once the code has finished running, I want to refresh the inspector with potentially some new views based on the final result. But I would be more than satisfied to just solve the first two issues for now :-) Thanks in advance! I have read the masters thesis on Glamour and I feel like I am slowly developing a mental model but it's not all there yet. To guess it seems like I need to embed my GLMCompositePresentation into a browser based on miller-columns and to somehow send my new object to its #selection port. Or something like that... _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
Hi, You will need to use a GLMPager. This is the browser that implements the finder-like navigation. A possible way to implement something like what you described is: browser := GLMPager new showFirst: [ :composite | composite text title: 'First'; act: [ :aPresentation | aPresentation selection: 'First' ] iconName: #glamorousGo on: $G entitled: 'Run' ]; show: [ :composite | composite text title: 'Other'; act: [ :aPresentation | aPresentation selection: 'Other' ] iconName: #glamorousGo on: $G entitled: 'Run' ]; yourself. browser openOn: 'text' Or you can just reuse an inspector: browser := GTInspector new noTitle; noActions; showFirst: [ :composite | composite text title: 'Script editor'; act: [ :aPresentation | aPresentation selection: 'result' ] iconName: #glamorousGo on: $G entitled: 'Run' ]; yourself. browser openOn: 'initial script' For creating a browser that refreshes automatically have a look at GLMPresentation>>#wantsSteps, GLMPresentation >>wantsAutomaticRefresh, and GLMPresentation >>stepTime.These just use the stepping mechanism from Morphic. For this to work you'll need to create your browser in a subclass of GLMCompositePresentation and override #step. GTInspector>>step is an example. If you want to enable refresh in the inspector use GTInspector class>>enableStepRefresh. Then you need to configure your extension using #wantsAutomaticRefresh:. For the moment this will just work for #fastTable and #fastList presentations. I can tell you what you need to add to Glamour if you are using other presentations. Cheers, Andrei On Wed, Jul 19, 2017 at 10:32 PM, Luke Gorrie <[hidden email]> wrote:
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
Hi,
Here are two more pointers: - for populating a port (in your case, the #selection port), you also have the convenience method(s) GLMPresentation>>#populate:icon:on:entitled:with:. Take a look at: GLMBasicExamples>>pharoScript. - for updating a presentation, beside polling, you also can have the presentation react to announcements through GLMPresentation>>#updateOn:from:. Take a look at: GLMBasicExamples>>#updateableBrowser Please let us know if you have further questions. Cheers, Doru > On Jul 19, 2017, at 11:58 PM, Andrei Chis <[hidden email]> wrote: > > Hi, > > You will need to use a GLMPager. This is the browser that implements the finder-like navigation. > A possible way to implement something like what you described is: > > browser := GLMPager new > showFirst: [ :composite | > composite text > title: 'First'; > act: [ :aPresentation | aPresentation selection: 'First' ] > iconName: #glamorousGo > on: $G > entitled: 'Run' ]; > show: [ :composite | > composite text > title: 'Other'; > act: [ :aPresentation | aPresentation selection: 'Other' ] > iconName: #glamorousGo > on: $G > entitled: 'Run' ]; > yourself. > browser openOn: 'text' > > Or you can just reuse an inspector: > > browser := GTInspector new > noTitle; > noActions; > showFirst: [ :composite | > composite text > title: 'Script editor'; > act: [ :aPresentation | aPresentation selection: 'result' ] > iconName: #glamorousGo > on: $G > entitled: 'Run' ]; > yourself. > browser openOn: 'initial script' > > For creating a browser that refreshes automatically have a look at GLMPresentation>>#wantsSteps, GLMPresentation >>wantsAutomaticRefresh, and GLMPresentation >>stepTime.These just use the stepping mechanism from Morphic. For this to work you'll need to create your browser in a subclass of GLMCompositePresentation and override #step. GTInspector>>step is an example. > > If you want to enable refresh in the inspector use GTInspector class>>enableStepRefresh. Then you need to configure your extension using #wantsAutomaticRefresh:. For the moment this will just work for #fastTable and #fastList presentations. I can tell you what you need to add to Glamour if you are using other presentations. > > Cheers, > Andrei > > > > > > On Wed, Jul 19, 2017 at 10:32 PM, Luke Gorrie <[hidden email]> wrote: > Howdy! > > I want to build a Playground-like browser and I'd really like some help for getting the initial prototype up and running. > > I see two parts: > - Code entry with "Go" button. > - Code execution with output printed (interpreter running as unix process.) > > I have made a start on the "Code entry" pane like this: > > | composite | > composite := GLMCompositePresentation new. > composite title: 'Script editor'. > composite text. > composite act: [] iconName: #glamorousGo on: $G entitled: 'Run'. > composite openOn: ''. > > which does look the way that I want: > > <Screenshot 2017-07-19 11.55.19.png> > but the part I am missing is how to make the "Go" action (green arrow) cause a new object to be inspected in a miller column to the right (like in the Playground and the Inspector.) > > Could somebody please tell me how to update the example to make this happen? > > The next part is that I want to run the code using an interpreter running in a separate unix process (a PipeableOSProcess.) I have made a GTInspector extension to inspect this process and show its output, but I am looking for a way to automatically refresh the presentation when new output becomes available (e.g. polling at ~100ms interval and inserting new text that has been printed.) > > Can somebody give me a hint about how to update that presentation with the latest output of the process? > > Then, once the code has finished running, I want to refresh the inspector with potentially some new views based on the final result. But I would be more than satisfied to just solve the first two issues for now :-) > > Thanks in advance! I have read the masters thesis on Glamour and I feel like I am slowly developing a mental model but it's not all there yet. To guess it seems like I need to embed my GLMCompositePresentation into a browser based on miller-columns and to somehow send my new object to its #selection port. Or something like that... > > > > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.list.inf.unibe.ch/listinfo/moose-dev > > > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.list.inf.unibe.ch/listinfo/moose-dev -- www.tudorgirba.com www.feenk.com "If you interrupt the barber while he is cutting your hair, you will end up with a messy haircut." _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
On 19 July 2017 at 23:58, Andrei Chis <[hidden email]> wrote:
Great! This is exactly what I was looking for. Seems like the basic misunderstanding in my example is that there is no browser in there anywhere. The GLMCompositePresentation looks superficially like a pristine Inspector but it's not one: it doesn't have the concept of a selection, it doesn't create million columns, etc. That functionality is all added in the GTInspector subclass (and related places.) Right?
Thanks for these tips. It's text that I want to update. I'll experiment a bit and shout if I get stuck. _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Tudor Girba-2
On 20 July 2017 at 09:49, Tudor Girba <[hidden email]> wrote: Here are two more pointers: Thanks for these tips! - for populating a port (in your case, the #selection port), you also have the convenience method(s) GLMPresentation>>#populate: This example is especially relevant, I'm not sure how I missed it before. _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Luke Gorrie
On Thu, Jul 20, 2017 at 10:01 AM, Luke Gorrie <[hidden email]> wrote:
GLMCompositePresentation is a builder for constructing presentations. It can hold the created presentations and display them using an arrangement. By default it displays them using a tab widget. Transmissions are added by browsers. For example the tabulator is a browser where the user has to define all transmissions between panes as well as how they are arranged on screen. The inspector is a browser that hardcodes the transmissions between panes and also has a predefined UI. Each pane can have ports. Transmissions are added between the ports of panes. To populate those ports, panes display presentations. For example, when you select an element in a presentation, the presentation populates the selection port of the pane that displays the presentation. This triggers the transmissions associated with that port. Hope this makes things a bit more clear :)
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
Hi again Andrei,
On 19 July 2017 at 23:58, Andrei Chis <[hidden email]> wrote:
Could you please tell me how to do this for text? For my use case of showing the incremental output of a running Unix process it seems to make the most sense to display in a text presentation (could make a list of lines instead...) and to poll frequently on a stepping callback. _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
Hi again Andrei,
I noticed something very curious with this example:
If add add one more line: browser and then "Do it and go" then the action button does not work anymore. Is this some side-effect where the GTInspector instance behaves differently when it is being inspected by another GTInspector? _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
Hi Andrei,
One more follow-on question about this script: On 19 July 2017 at 23:58, Andrei Chis <[hidden email]> wrote:
Can you tell me how to access the script when producing the result? I have tried adding a second argument to the #act: block, and I have tried calling 'browser entity', but in both cases I get the original value of the text area rather than the current one. _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Luke Gorrie
On Thu, Jul 20, 2017 at 1:24 PM, Luke Gorrie <[hidden email]> wrote:
GLMPresentation>> GLMRubricTextPresentation>> self update
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Luke Gorrie
On Fri, Jul 21, 2017 at 6:15 PM, Luke Gorrie <[hidden email]> wrote:
Can you give me more details about what doesn't work? What do you mean by action button?
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Luke Gorrie
On Sat, Jul 22, 2017 at 3:24 PM, Luke Gorrie <[hidden email]> wrote:
Since the presentation is a text presentation 'aPresentation text' will return its current text. The second parameter will be the entity on which the browser was opened which is the original text. Cheers, Andrei
_______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
On 22 July 2017 at 16:37, Andrei Chis <[hidden email]> wrote:
Could be easiest for me to file a bug. I'll wait until I am able to download the latest Moose image to reproduce it there first (Jenkins still not working for me...) _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
On 22 July 2017 at 16:39, Andrei Chis <[hidden email]> wrote:
Thanks for that tip! I'm a little confused about the overlap between the Glamour concepts (panes, ports, transmissions) and the Smalltalk API functions (feels like a layer above that obscures what is below a bit.) Getting there in my understanding slowly... Is there some API reference documentation for Glamour that I might be overlooking somewhere btw? _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Andrei Chis
On 22 July 2017 at 16:35, Andrei Chis <[hidden email]> wrote:
Thanks for this tip. Sounds nice and easy :). _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Luke Gorrie
Hi,
Please read this: http://www.themoosebook.org/book/index.html#h1buildingbrowserswithglamour In particular, this can be useful: http://www.themoosebook.org/book/index.html#h2sketchingbrowsers Cheers, Doru > On Jul 22, 2017, at 4:42 PM, Luke Gorrie <[hidden email]> wrote: > > On 22 July 2017 at 16:39, Andrei Chis <[hidden email]> wrote: > > Since the presentation is a text presentation 'aPresentation text' will return its current text. The second parameter will be the entity on which the browser was opened which is the original text. > > Thanks for that tip! > > I'm a little confused about the overlap between the Glamour concepts (panes, ports, transmissions) and the Smalltalk API functions (feels like a layer above that obscures what is below a bit.) > > Getting there in my understanding slowly... > > Is there some API reference documentation for Glamour that I might be overlooking somewhere btw? > _______________________________________________ > Moose-dev mailing list > [hidden email] > https://www.list.inf.unibe.ch/listinfo/moose-dev -- www.tudorgirba.com www.feenk.com "Beauty is where we see it." _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
On 22 July 2017 at 17:13, Tudor Girba <[hidden email]> wrote: Please read this: Thanks! _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
In reply to this post by Tudor Girba-2
On 22 July 2017 at 17:13, Tudor Girba <[hidden email]> wrote: Please read this: This documentation is really excellent. Thanks for the link. I wish I'd found it sooner! I had found the Glamour chapter of Deep into Pharo, and the Masters thesis on Glamour, but these do not cover the API used by the examples nearly so well as the moose book. _______________________________________________ Moose-dev mailing list [hidden email] https://www.list.inf.unibe.ch/listinfo/moose-dev |
Free forum by Nabble | Edit this page |