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 chisvasileandrei@gmail.com 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 luke@snabb.co 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 Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
Moose-dev mailing list Moose-dev@list.inf.unibe.ch 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."