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...
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:
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
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."
On 20 July 2017 at 09:49, Tudor Girba tudor@tudorgirba.com 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:icon:on:entitled:with:. Take a look at: GLMBasicExamples>>pharoScript.
This example is especially relevant, I'm not sure how I missed it before.
On 19 July 2017 at 23:58, Andrei Chis chisvasileandrei@gmail.com wrote:
Or you can just reuse an inspector:
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?
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.
Thanks for these tips. It's text that I want to update. I'll experiment a bit and shout if I get stuck.
On Thu, Jul 20, 2017 at 10:01 AM, Luke Gorrie luke@snabb.co wrote:
On 19 July 2017 at 23:58, Andrei Chis chisvasileandrei@gmail.com wrote:
Or you can just reuse an inspector:
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?
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 :)
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.
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 Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
Hi again Andrei,
On 19 July 2017 at 23:58, Andrei Chis chisvasileandrei@gmail.com wrote:
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.
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.
On Thu, Jul 20, 2017 at 1:24 PM, Luke Gorrie luke@snabb.co wrote:
Hi again Andrei,
On 19 July 2017 at 23:58, Andrei Chis chisvasileandrei@gmail.com wrote:
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.
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.
GLMPresentation>>requestRefresh will be called when an update is needed. Currently this method raises a GLMPresentationRefreshRequest event, which is only handled by fast table presentation. The easies solution would be add:
GLMRubricTextPresentation>>requestRefresh self update
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
On 22 July 2017 at 16:35, Andrei Chis chisvasileandrei@gmail.com wrote:
GLMPresentation>>requestRefresh will be called when an update is needed. Currently this method raises a GLMPresentationRefreshRequest event, which is only handled by fast table presentation. The easies solution would be add:
GLMRubricTextPresentation>>requestRefresh self update
Thanks for this tip. Sounds nice and easy :).
Hi again Andrei,
I noticed something very curious with this example:
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'
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?
On Fri, Jul 21, 2017 at 6:15 PM, Luke Gorrie luke@snabb.co wrote:
Hi again Andrei,
I noticed something very curious with this example:
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'
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?
Can you give me more details about what doesn't work? What do you mean by action button?
Moose-dev mailing list Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
On 22 July 2017 at 16:37, Andrei Chis chisvasileandrei@gmail.com wrote:
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?
Can you give me more details about what doesn't work? What do you mean by action button?
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...)
Hi Andrei,
One more follow-on question about this script:
On 19 July 2017 at 23:58, Andrei Chis chisvasileandrei@gmail.com wrote:
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'
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.
On Sat, Jul 22, 2017 at 3:24 PM, Luke Gorrie luke@snabb.co wrote:
Hi Andrei,
One more follow-on question about this script:
On 19 July 2017 at 23:58, Andrei Chis chisvasileandrei@gmail.com wrote:
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'
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.
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 Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
On 22 July 2017 at 16:39, Andrei Chis chisvasileandrei@gmail.com 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?
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 luke@snabb.co wrote:
On 22 July 2017 at 16:39, Andrei Chis chisvasileandrei@gmail.com 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 Moose-dev@list.inf.unibe.ch https://www.list.inf.unibe.ch/listinfo/moose-dev
-- www.tudorgirba.com www.feenk.com
"Beauty is where we see it."
On 22 July 2017 at 17:13, Tudor Girba tudor@tudorgirba.com wrote:
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
Thanks!
On 22 July 2017 at 17:13, Tudor Girba tudor@tudorgirba.com wrote:
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
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.