Re: [Pharo-users] [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk
Hi, You probably need this: explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*]. A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children: You should also take a look at the examples from: GLMBasicExamples open Does this help now? Cheers, Doru On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/static/blog/output/galleries/ objetos/ubakye-browser.jpg
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside
comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) : https://github.com/pillar-markup/pillar-documentation/
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/scholmd/wiki [2] http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/ [3] http://programminghistorian.org/lessons/sustainable- authorship-in-plain-text-using-pandoc-and-markdown
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_______________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch https://www.iam.unibe.ch/mailman/listinfo/moose-dev
-- www.tudorgirba.com "Every thing has its own flow"
Hi Doru and Community :-), In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this: [1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel. I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible? Thanks, Offray Below is the code, for easiness of reading: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. " | browser mainTree | mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ]. browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ubakye-br... <http://mutabit.com/offray/static/blog/output/galleries/objetos/ubakye-browse...>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg <http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) : https://github.com/pillar-__markup/pillar-documentation/ <https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2] http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-markdown/ <http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/> [3] http://programminghistorian.__org/lessons/sustainable-__authorship-in-plain-... <http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text...>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Hi again, I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going: http://stackoverflow.com/questions/25215103/building-a-tree-outliner-like-gr... This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed. Cheers, Offray On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ubakye-br...
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubakye-browse...>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) : https://github.com/pillar-__markup/pillar-documentation/ <https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-markdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/> [3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in-plain-...
<http://programminghistorian.org/lessons/sustainable-authorship-in-plain-text...>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Hi Offray Well, none of the experts has come forward to help, so maybe I can comment as almost a complete beginner. I think you need two additional bits of specification in your example to get the output you want: a. To show the node titles in the #tree pane, you need to add a format: clause, which is a block taking the node as argument and returning the text to be output. b. To show the body of the selected tree node in the #body pane, you need a display: clause, which is a similar block generating the body details that you want. To give you a specific example, here is some code I have used. I am using a GlamorousBrowser to examine the tree representation of an HTML page generated by Todd Blanchard's superb HTMLCSS parser. The browser I produce is similar to yours, but without the #plugins pane. domBrowser := GLMTabulator new. domBrowser column: #details; column: #nodeDetails. domBrowser transmit to: #details; andShow: [ :a | a tree display: [ :model | model nodesSelect: [ :each | each tag = 'html'] ]; children: [ :node | node children ]; format: [ :node ||nid| node tag,' ', ((nid := node id) isNil ifTrue:[''] ifFalse:['id=',nid,' '])] ]. domBrowser transmit from: #details; to: #nodeDetails; andShow: [ :each| each text display: [:node| node innerContents ]]. domBrowser title: 'Browse HTML'. I hope this makes it clear; if not, ask again. Best wishes Peter Kenny -----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Offray Vladimir Luna Cárdenas Sent: 09 August 2014 05:08 To: pharo-users@lists.pharo.org Subject: [Pharo-users] Rephrasing my question on Stackoverflow (Re: [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk) Hi again, I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going: http://stackoverflow.com/questions/25215103/building-a-tree-outliner-like-gr... This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed. Cheers, Offray On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ub akye-browser.jpg
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubaky e-browser.jpg>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) : https://github.com/pillar-__markup/pillar-documentation/
<https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-mar kdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/> [3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in -plain-text-__using-pandoc-and-markdown
<http://programminghistorian.org/lessons/sustainable-authorship-in-pl ain-text-using-pandoc-and-markdown>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Hi Peter and community, First thanks Perter for your quick answer and sorry for my late one. Your advice worked like a charm and now I can see node information (headers and body in any panel I want). The only thing is that I get a lot of error message in a stack. They're referred to: - NonBooleanReceiver: proceed for truth - MessageNotUnderstood: AnObsoleteGLMPagerCircleButtonMorph >> isFocused (I got this one twice). I don't know how to debug the stacks and, at the beginning I was thinking that they're related with how to deal with empty values while traversing the tree, so I put some ifTrue, ifFalse messages to deal with them. Still I get the same errors. The main difference with the structure of Peter's code is that I'm not using "display:" keyword, but I don't see it used either on the treeWithChildrenByLevel example. Anyway I will replace my current GUI implementation with this code that works better and start to deal with other parts of the project and keep the community posted (and myself reading). Here is my code: (by the way, Tabs look nice on Pharo/Moose, but they're look terrible on email. There is any way to get them replace by spaces?) =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree | mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | (eachNode children) isNil ifTrue: [ #() ] ifFalse:[ eachNode children ] ]; format:[:eachNode | (eachNode header) isNil ifTrue: [ '' ] ifFalse: [ eachNode header ] ]. "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | (a text) title: 'Cuerpo | Body '; format:[:eachNode | (eachNode body) isNil ifTrue: [ '' ] ifFalse: [ eachNode body ] ] ]. (browser transmit) to: #plugins; andShow: [ :a | a text title: 'Plugins | Extensiones' ]. browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- On 08/09/2014 04:05 AM, PBKResearch wrote:
Hi Offray
Well, none of the experts has come forward to help, so maybe I can comment as almost a complete beginner. I think you need two additional bits of specification in your example to get the output you want:
a. To show the node titles in the #tree pane, you need to add a format: clause, which is a block taking the node as argument and returning the text to be output.
b. To show the body of the selected tree node in the #body pane, you need a display: clause, which is a similar block generating the body details that you want.
To give you a specific example, here is some code I have used. I am using a GlamorousBrowser to examine the tree representation of an HTML page generated by Todd Blanchard's superb HTMLCSS parser. The browser I produce is similar to yours, but without the #plugins pane.
domBrowser := GLMTabulator new. domBrowser column: #details; column: #nodeDetails. domBrowser transmit to: #details; andShow: [ :a | a tree display: [ :model | model nodesSelect: [ :each | each tag = 'html'] ]; children: [ :node | node children ]; format: [ :node ||nid| node tag,' ', ((nid := node id) isNil ifTrue:[''] ifFalse:['id=',nid,' '])] ]. domBrowser transmit from: #details; to: #nodeDetails; andShow: [ :each| each text display: [:node| node innerContents ]]. domBrowser title: 'Browse HTML'.
I hope this makes it clear; if not, ask again.
Best wishes
Peter Kenny
-----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Offray Vladimir Luna Cárdenas Sent: 09 August 2014 05:08 To: pharo-users@lists.pharo.org Subject: [Pharo-users] Rephrasing my question on Stackoverflow (Re: [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk)
Hi again,
I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going:
http://stackoverflow.com/questions/25215103/building-a-tree-outliner-like-gr...
This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed.
Cheers,
Offray
On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ub akye-browser.jpg
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubaky e-browser.jpg>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) : https://github.com/pillar-__markup/pillar-documentation/
<https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-mar kdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/> [3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in -plain-text-__using-pandoc-and-markdown
<http://programminghistorian.org/lessons/sustainable-authorship-in-pl ain-text-using-pandoc-and-markdown>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Hi again, Well, after adding the code to the proper object I don't get any error stacks. So far, so good. I'll keep you posted. Thanks again, Offray On 08/12/2014 02:08 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Peter and community,
First thanks Perter for your quick answer and sorry for my late one. Your advice worked like a charm and now I can see node information (headers and body in any panel I want). The only thing is that I get a lot of error message in a stack. They're referred to:
- NonBooleanReceiver: proceed for truth - MessageNotUnderstood: AnObsoleteGLMPagerCircleButtonMorph >> isFocused (I got this one twice).
I don't know how to debug the stacks and, at the beginning I was thinking that they're related with how to deal with empty values while traversing the tree, so I put some ifTrue, ifFalse messages to deal with them. Still I get the same errors. The main difference with the structure of Peter's code is that I'm not using "display:" keyword, but I don't see it used either on the treeWithChildrenByLevel example.
Anyway I will replace my current GUI implementation with this code that works better and start to deal with other parts of the project and keep the community posted (and myself reading).
Here is my code:
(by the way, Tabs look nice on Pharo/Moose, but they're look terrible on email. There is any way to get them replace by spaces?)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | (eachNode children) isNil ifTrue: [ #() ] ifFalse:[ eachNode children ] ]; format:[:eachNode | (eachNode header) isNil ifTrue: [ '' ] ifFalse: [ eachNode header ] ]. "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | (a text) title: 'Cuerpo | Body '; format:[:eachNode | (eachNode body) isNil ifTrue: [ '' ] ifFalse: [ eachNode body ] ]
]. (browser transmit) to: #plugins; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/09/2014 04:05 AM, PBKResearch wrote:
Hi Offray
Well, none of the experts has come forward to help, so maybe I can comment as almost a complete beginner. I think you need two additional bits of specification in your example to get the output you want:
a. To show the node titles in the #tree pane, you need to add a format: clause, which is a block taking the node as argument and returning the text to be output.
b. To show the body of the selected tree node in the #body pane, you need a display: clause, which is a similar block generating the body details that you want.
To give you a specific example, here is some code I have used. I am using a GlamorousBrowser to examine the tree representation of an HTML page generated by Todd Blanchard's superb HTMLCSS parser. The browser I produce is similar to yours, but without the #plugins pane.
domBrowser := GLMTabulator new. domBrowser column: #details; column: #nodeDetails. domBrowser transmit to: #details; andShow: [ :a | a tree display: [ :model | model nodesSelect: [ :each | each tag = 'html'] ]; children: [ :node | node children ]; format: [ :node ||nid| node tag,' ', ((nid := node id) isNil ifTrue:[''] ifFalse:['id=',nid,' '])] ]. domBrowser transmit from: #details; to: #nodeDetails; andShow: [ :each| each text display: [:node| node innerContents ]]. domBrowser title: 'Browse HTML'.
I hope this makes it clear; if not, ask again.
Best wishes
Peter Kenny
-----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Offray Vladimir Luna Cárdenas Sent: 09 August 2014 05:08 To: pharo-users@lists.pharo.org Subject: [Pharo-users] Rephrasing my question on Stackoverflow (Re: [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk)
Hi again,
I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going:
http://stackoverflow.com/questions/25215103/building-a-tree-outliner-like-gr...
This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed.
Cheers,
Offray
On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ub akye-browser.jpg
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubaky e-browser.jpg>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) :
https://github.com/pillar-__markup/pillar-documentation/
<https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-mar kdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/>
[3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in -plain-text-__using-pandoc-and-markdown
<http://programminghistorian.org/lessons/sustainable-authorship-in-pl ain-text-using-pandoc-and-markdown>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Exactly. To customize the label that appears in the tree, you need to specify a format block that will take each node as an input and should produce a string or text as an output. Cheers, Doru On Tue, Aug 12, 2014 at 9:45 PM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
Hi again,
Well, after adding the code to the proper object I don't get any error stacks. So far, so good. I'll keep you posted.
Thanks again,
Offray
On 08/12/2014 02:08 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Peter and community,
First thanks Perter for your quick answer and sorry for my late one. Your advice worked like a charm and now I can see node information (headers and body in any panel I want). The only thing is that I get a lot of error message in a stack. They're referred to:
- NonBooleanReceiver: proceed for truth - MessageNotUnderstood: AnObsoleteGLMPagerCircleButtonMorph >> isFocused (I got this one twice).
I don't know how to debug the stacks and, at the beginning I was thinking that they're related with how to deal with empty values while traversing the tree, so I put some ifTrue, ifFalse messages to deal with them. Still I get the same errors. The main difference with the structure of Peter's code is that I'm not using "display:" keyword, but I don't see it used either on the treeWithChildrenByLevel example.
Anyway I will replace my current GUI implementation with this code that works better and start to deal with other parts of the project and keep the community posted (and myself reading).
Here is my code:
(by the way, Tabs look nice on Pharo/Moose, but they're look terrible on email. There is any way to get them replace by spaces?)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | (eachNode children) isNil ifTrue: [ #() ] ifFalse:[ eachNode children ] ]; format:[:eachNode | (eachNode header) isNil ifTrue: [ '' ] ifFalse: [ eachNode header ] ]. "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | (a text) title: 'Cuerpo | Body '; format:[:eachNode | (eachNode body) isNil ifTrue: [ '' ] ifFalse: [ eachNode body ] ]
]. (browser transmit) to: #plugins; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/09/2014 04:05 AM, PBKResearch wrote:
Hi Offray
Well, none of the experts has come forward to help, so maybe I can comment as almost a complete beginner. I think you need two additional bits of specification in your example to get the output you want:
a. To show the node titles in the #tree pane, you need to add a format: clause, which is a block taking the node as argument and returning the text to be output.
b. To show the body of the selected tree node in the #body pane, you need a display: clause, which is a similar block generating the body details that you want.
To give you a specific example, here is some code I have used. I am using a GlamorousBrowser to examine the tree representation of an HTML page generated by Todd Blanchard's superb HTMLCSS parser. The browser I produce is similar to yours, but without the #plugins pane.
domBrowser := GLMTabulator new. domBrowser column: #details; column: #nodeDetails. domBrowser transmit to: #details; andShow: [ :a | a tree display: [ :model | model nodesSelect: [ :each | each tag = 'html'] ]; children: [ :node | node children ]; format: [ :node ||nid| node tag,' ', ((nid := node id) isNil ifTrue:[''] ifFalse:['id=',nid,' '])] ]. domBrowser transmit from: #details; to: #nodeDetails; andShow: [ :each| each text display: [:node| node innerContents ]]. domBrowser title: 'Browse HTML'.
I hope this makes it clear; if not, ask again.
Best wishes
Peter Kenny
-----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Offray Vladimir Luna Cárdenas Sent: 09 August 2014 05:08 To: pharo-users@lists.pharo.org Subject: [Pharo-users] Rephrasing my question on Stackoverflow (Re: [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk)
Hi again,
I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going:
http://stackoverflow.com/questions/25215103/building-a- tree-outliner-like-graphical-interface-in-pharo-smalltalk-using-moose
This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed.
Cheers,
Offray
On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ub akye-browser.jpg
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubaky e-browser.jpg>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) :
https://github.com/pillar-__markup/pillar-documentation/
<https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-mar kdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in- scholarly-markdown/>
[3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in -plain-text-__using-pandoc-and-markdown
<http://programminghistorian.org/lessons/sustainable-authorship-in-pl ain-text-using-pandoc-and-markdown>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
-- www.tudorgirba.com "Every thing has its own flow"
By the way, I updated the answer on Stack Overflow, with the proper credits to Peter: http://stackoverflow.com/questions/25215103/building-a-tree-outliner-like-gr... And just for curiosity. Why adding the code to the object message on the class browser ended with error stacks? Cheers, Offray On 08/12/2014 02:45 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
Well, after adding the code to the proper object I don't get any error stacks. So far, so good. I'll keep you posted.
Thanks again,
Offray
On 08/12/2014 02:08 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Peter and community,
First thanks Perter for your quick answer and sorry for my late one. Your advice worked like a charm and now I can see node information (headers and body in any panel I want). The only thing is that I get a lot of error message in a stack. They're referred to:
- NonBooleanReceiver: proceed for truth - MessageNotUnderstood: AnObsoleteGLMPagerCircleButtonMorph >> isFocused (I got this one twice).
I don't know how to debug the stacks and, at the beginning I was thinking that they're related with how to deal with empty values while traversing the tree, so I put some ifTrue, ifFalse messages to deal with them. Still I get the same errors. The main difference with the structure of Peter's code is that I'm not using "display:" keyword, but I don't see it used either on the treeWithChildrenByLevel example.
Anyway I will replace my current GUI implementation with this code that works better and start to deal with other parts of the project and keep the community posted (and myself reading).
Here is my code:
(by the way, Tabs look nice on Pharo/Moose, but they're look terrible on email. There is any way to get them replace by spaces?)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | (eachNode children) isNil ifTrue: [ #() ] ifFalse:[ eachNode children ] ]; format:[:eachNode | (eachNode header) isNil ifTrue: [ '' ] ifFalse: [ eachNode header ] ]. "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | (a text) title: 'Cuerpo | Body '; format:[:eachNode | (eachNode body) isNil ifTrue: [ '' ] ifFalse: [ eachNode body ] ]
]. (browser transmit) to: #plugins; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/09/2014 04:05 AM, PBKResearch wrote:
Hi Offray
Well, none of the experts has come forward to help, so maybe I can comment as almost a complete beginner. I think you need two additional bits of specification in your example to get the output you want:
a. To show the node titles in the #tree pane, you need to add a format: clause, which is a block taking the node as argument and returning the text to be output.
b. To show the body of the selected tree node in the #body pane, you need a display: clause, which is a similar block generating the body details that you want.
To give you a specific example, here is some code I have used. I am using a GlamorousBrowser to examine the tree representation of an HTML page generated by Todd Blanchard's superb HTMLCSS parser. The browser I produce is similar to yours, but without the #plugins pane.
domBrowser := GLMTabulator new. domBrowser column: #details; column: #nodeDetails. domBrowser transmit to: #details; andShow: [ :a | a tree display: [ :model | model nodesSelect: [ :each | each tag = 'html'] ]; children: [ :node | node children ]; format: [ :node ||nid| node tag,' ', ((nid := node id) isNil ifTrue:[''] ifFalse:['id=',nid,' '])] ]. domBrowser transmit from: #details; to: #nodeDetails; andShow: [ :each| each text display: [:node| node innerContents ]]. domBrowser title: 'Browse HTML'.
I hope this makes it clear; if not, ask again.
Best wishes
Peter Kenny
-----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Offray Vladimir Luna Cárdenas Sent: 09 August 2014 05:08 To: pharo-users@lists.pharo.org Subject: [Pharo-users] Rephrasing my question on Stackoverflow (Re: [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk)
Hi again,
I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going:
http://stackoverflow.com/questions/25215103/building-a-tree-outliner-like-gr...
This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed.
Cheers,
Offray
On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ub akye-browser.jpg
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubaky e-browser.jpg>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) :
https://github.com/pillar-__markup/pillar-documentation/
<https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-mar kdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in-scholarly-markdown/>
[3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in -plain-text-__using-pandoc-and-markdown
<http://programminghistorian.org/lessons/sustainable-authorship-in-pl ain-text-using-pandoc-and-markdown>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
I do not understand exactly what you did. Could you be more explicit about where the error happened? Also, the code you provide depends on the data you have. This makes it difficult for us to reproduce the issue. If you want to have quicker answers you could try providing an example that works with simpler objects, or at least provide a script to setup the data as you need it. Cheers, Doru On Tue, Aug 12, 2014 at 10:03 PM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
By the way, I updated the answer on Stack Overflow, with the proper credits to Peter:
http://stackoverflow.com/questions/25215103/building-a- tree-outliner-like-graphical-interface-in-pharo-smalltalk- using-moose/25273015#25273015
And just for curiosity. Why adding the code to the object message on the class browser ended with error stacks?
Cheers,
Offray
On 08/12/2014 02:45 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
Well, after adding the code to the proper object I don't get any error stacks. So far, so good. I'll keep you posted.
Thanks again,
Offray
On 08/12/2014 02:08 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Peter and community,
First thanks Perter for your quick answer and sorry for my late one. Your advice worked like a charm and now I can see node information (headers and body in any panel I want). The only thing is that I get a lot of error message in a stack. They're referred to:
- NonBooleanReceiver: proceed for truth - MessageNotUnderstood: AnObsoleteGLMPagerCircleButtonMorph >> isFocused (I got this one twice).
I don't know how to debug the stacks and, at the beginning I was thinking that they're related with how to deal with empty values while traversing the tree, so I put some ifTrue, ifFalse messages to deal with them. Still I get the same errors. The main difference with the structure of Peter's code is that I'm not using "display:" keyword, but I don't see it used either on the treeWithChildrenByLevel example.
Anyway I will replace my current GUI implementation with this code that works better and start to deal with other parts of the project and keep the community posted (and myself reading).
Here is my code:
(by the way, Tabs look nice on Pharo/Moose, but they're look terrible on email. There is any way to get them replace by spaces?)
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | (eachNode children) isNil ifTrue: [ #() ] ifFalse:[ eachNode children ] ]; format:[:eachNode | (eachNode header) isNil ifTrue: [ '' ] ifFalse: [ eachNode header ] ]. "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | (a text) title: 'Cuerpo | Body '; format:[:eachNode | (eachNode body) isNil ifTrue: [ '' ] ifFalse: [ eachNode body ] ]
]. (browser transmit) to: #plugins; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/09/2014 04:05 AM, PBKResearch wrote:
Hi Offray
Well, none of the experts has come forward to help, so maybe I can comment as almost a complete beginner. I think you need two additional bits of specification in your example to get the output you want:
a. To show the node titles in the #tree pane, you need to add a format: clause, which is a block taking the node as argument and returning the text to be output.
b. To show the body of the selected tree node in the #body pane, you need a display: clause, which is a similar block generating the body details that you want.
To give you a specific example, here is some code I have used. I am using a GlamorousBrowser to examine the tree representation of an HTML page generated by Todd Blanchard's superb HTMLCSS parser. The browser I produce is similar to yours, but without the #plugins pane.
domBrowser := GLMTabulator new. domBrowser column: #details; column: #nodeDetails. domBrowser transmit to: #details; andShow: [ :a | a tree display: [ :model | model nodesSelect: [ :each | each tag = 'html'] ]; children: [ :node | node children ]; format: [ :node ||nid| node tag,' ', ((nid := node id) isNil ifTrue:[''] ifFalse:['id=',nid,' '])] ]. domBrowser transmit from: #details; to: #nodeDetails; andShow: [ :each| each text display: [:node| node innerContents ]]. domBrowser title: 'Browse HTML'.
I hope this makes it clear; if not, ask again.
Best wishes
Peter Kenny
-----Original Message----- From: Pharo-users [mailto:pharo-users-bounces@lists.pharo.org] On Behalf Of Offray Vladimir Luna Cárdenas Sent: 09 August 2014 05:08 To: pharo-users@lists.pharo.org Subject: [Pharo-users] Rephrasing my question on Stackoverflow (Re: [Moose-dev] Re: Tree/Outliners of playgrounds, markdown inside comments and some quick medium size dreams for Pharo/Smalltalk)
Hi again,
I'm testing my luck in Stackoverflow to see if I can get more eyes and keep the conversation going:
http://stackoverflow.com/questions/25215103/building-a- tree-outliner-like-graphical-interface-in-pharo-smalltalk-using-moose
This community is very responsive but I feel I'm not understanding quickly/properly enough the main logic of tree-like browsers on Moose. So, any extra help is welcomed.
Cheers,
Offray
On 08/07/2014 03:28 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Doru and Community :-),
In the screenshot at [1] you can see my explorations. I took the code from treeWithChildrenByeLevel in the GLMBasicExamples and modified it until I got this:
[1] http://www.enlightenment.org/ss/e-53e3dee6777744.68598023.jpg
So I have now a browser which shows a tree made of UbakyeNodes (a tree like data structure I defined), but I would like not to show the Ubakye Nodes, but the titles of each node (headers) and the contents (bodies) of them when selected. With your help I have understood that I need to pass the collection of all children (not just the headers of them), but I don't know who to sellect something particular in that collection to be shown on the browser, like headers of nodes in the #tree panel or bodies in the #body panel.
I would like to change also the size of each panel to be more like the shown in the screenshot, instead of the default one and be relative to window size. Is this possible?
Thanks,
Offray
Below is the code, for easiness of reading:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- " Another exploration of Outliners provided by Glamorous Toolkit and browsers. This code was obtained by running 'GLMBasicExamples open' and then browsing until 'treeWithChildrenByLevel'. Some code was modified to open explicitely the browser on the world and starting to hack on it. "
| browser mainTree |
mainTree := UbakyeNode new. mainTree becomeDefaultTree.
browser := GLMTabulator new. browser column: #tree; column: [ :c | c row: #body; row: #plugins ]. (browser transmit) to: #tree; andShow: [ :a | (a tree) title: mainTree header; children: [ :eachNode | eachNode children. ] "Children must return a collection" ]. (browser transmit) to: #body; from: #tree; andShow: [ :a | a text title: 'Cuerpo | Body ' ]. (browser transmit) to: #plugins; from: #tree port: #selectionPath; andShow: [ :a | a text title: 'Plugins | Extensiones' ].
browser openOn: mainTree children. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On 08/05/2014 12:19 AM, Tudor Girba wrote:
Hi,
You probably need this:
explorer transmit to: #tree; andShow: [:a | a tree display: headers; *children: [:eachNode | eachNode theMessageYouUseToGoToTheChildrenOfANode ]*].
A tree is a recursive structure, and to describe it you need: - a way to construct the root elements. This is the result of applying display: to the input object. So, display: either takes a collection or a block that will return a collection when executed. - a way to define the children for each node. This is the result of applying children:
You should also take a look at the examples from: GLMBasicExamples open
Does this help now?
Cheers, Doru
On Sun, Jul 27, 2014 at 4:59 PM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
Hi,
Answering to myself: I have solved the code that selects the headers of the main tree. The key is to create a new collection containing only node names. Here is the code:
"*************************" | mainTree node1 node2 explorer headers |
mainTree := UbakyeNode header: 'Arbol raÃz' body: ''.
node1 := UbakyeNode header: 'Nodo 1' body: 'Texto 1'.
node2 := UbakyeNode header: 'Nodo 2' body: 'Texto 2'.
mainTree addNode: node1; addNode: node2.
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
headers := (mainTree children) collect: [:node | node header].
explorer transmit to: #tree; andShow: [:a | a tree display: headers].
explorer openOn: mainTree.
"*************************"
Now I need to make the children sellectable, and that all the contents of the tree can be updated with a shortcut.
I will keep you posted.
Cheers,
Offray
On 07/26/2014 09:01 PM, Offray Vladimir Luna Cárdenas wrote:
Hi again,
I will be using this thread to update my advances and questions about how to build an outliner in Pharo Smalltalk. If there is a better method like starting a new thread for particular questions, or a less narrative style, please let me know.
The idea is to use the tools provided by Moose to build a quick outliner that can be extended to suit my needs on academical writing. This is kind of a strange approach in the sense that I'm not following the tutorials with a predefined problems (make a game and so) but trying to start with a real (in the sense of closer) problem (making an outliner) and to see which knowledge I need to solve this necessity. In that sense is more like the Freire's alphabetization of adults in Brazil.
So, the things I have done so far was to search for a good model to start with. Something already done that can be used as scaffolding for my outliner. The Help System seems like a good start for an outliner (in fact it is already one), so I have taken the Help-Core system and start to use it as a base for my project.
After that I have used the Moose browsers to build a simple interface, as seen here:
http://mutabit.com/offray/__static/blog/output/galleries/__objetos/ub akye-browser.jpg
<http://mutabit.com/offray/static/blog/output/galleries/objetos/ubaky e-browser.jpg>
The part I want to deal with is this:
===============
explorer := GLMTabulator new title: (mainTree header). explorer column: #tree; column: #body.
explorer transmit to: #tree; andShow: [:a | a tree display: mainTree children ].
explorer openOn: mainTree.
===============
So, instead of "display: mainTree children" I need something that takes the get names (headers) of the two nodes and the contents in the right panel. For that I think that I need to learn some iterators. I have already a "header" method for the nodes. Any clue would be appreciated and I will keep you posted on my advances.
Cheers,
Offray
On 07/21/2014 12:58 PM, Offray Vladimir Luna Cárdenas wrote:
Hi Damien,
Thanks for your answer. Comments below.
On 07/21/2014 11:09 AM, Damien Cassou wrote:
On Sat, Jul 19, 2014 at 2:47 AM, Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>> wrote:
The first idea that comes to mind is using STON for storage nodes and tree information, so I can interchange it with the flatland files world and keep it readable. Sounds that reasonable?
without more information, it is hard to stay. Try with STON and change if that does not work :-). We have XML and JSON generators as well.
This is a kind of raw preview of I'm talking about:
http://www.enlightenment.org/__ss/e-53cd4f36f021e9.68569046.__jpg
<http://www.enlightenment.org/ss/e-53cd4f36f021e9.68569046.jpg>
Of course in this case, it is just a Help browser with a Playground window over it, but I would like to have something like Playgrounds inside the help browser. I was trying to build a custom browser with Glamour, but seems that Help Browser already has the machinery I'm looking for.
So my first question is how to use the Help Browser class as a template for my outliner class? And can I put a Playground where the plain text is located right now?
The second thing I would like to do is to add pandoc's markdown inside comments, but I don't like the syntax of comments in Smalltalk because single quotes are fairly easy to find in light markup language like markdown. Is difficult to change it to create something more like python (with """) or Lua (with -[]- )?
There is only one syntax for comments in Pharo. Instead of Markdown, you might want to have a look at Pillar which is implemented in Pharo and can generate Markdown (and html, and pdf) :
https://github.com/pillar-__markup/pillar-documentation/
<https://github.com/pillar-markup/pillar-documentation/>
I have seen Pillar. Seems really interesting, but Pandocs markdown support academic citation in several formats and I have already long docs wrote on that format integrated in my workflow from Zotero and even there is a growing community working on Scholarly Markdown[1][2] so I would like to stick with it as much as I can for my own writing. That being said. I would like also a better integration between Smalltalk outliners and all the academic publication work flow, including working better with pandoc as a external library.
[1] https://github.com/scholmd/__scholmd/wiki <https://github.com/scholmd/scholmd/wiki> [2]
http://blog.martinfenner.org/__2013/06/29/metadata-in-__scholarly-mar kdown/
<http://blog.martinfenner.org/2013/06/29/metadata-in- scholarly-markdown/>
[3]
http://programminghistorian.__org/lessons/sustainable-__authorship-in -plain-text-__using-pandoc-and-markdown
<http://programminghistorian.org/lessons/sustainable-authorship-in-pl ain-text-using-pandoc-and-markdown>
Thanks again, this conversation with people in the community is very valuable to me,
Offray
_________________________________________________ Moose-dev mailing list Moose-dev@iam.unibe.ch <mailto:Moose-dev@iam.unibe.ch> https://www.iam.unibe.ch/__mailman/listinfo/moose-dev <https://www.iam.unibe.ch/mailman/listinfo/moose-dev>
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
-- www.tudorgirba.com "Every thing has its own flow"
Hi, On 08/12/2014 03:13 PM, Tudor Girba wrote:
I do not understand exactly what you did. Could you be more explicit about where the error happened?
I'm not able to reproduce it again. But as soon as I can catch it again, I will be doing it.
Also, the code you provide depends on the data you have. This makes it difficult for us to reproduce the issue. If you want to have quicker answers you could try providing an example that works with simpler objects, or at least provide a script to setup the data as you need it.
That's why I was asking (in other thread) how to point to my code online. I'm using SmalltalkHub to share this learning project here: http://smalltalkhub.com/#!/~Offray/Ubakye/ but would be nice to point to a published snippets of code about this questions. May be I just don't understand how to point to specific code online like usually happens with DVCS like fossil or git. Anyway if you can load my code from this repository you can then open a Playground and run: UbakyeBrowser open. to see the context I'm talking about. Meanwhile, let me illustrate my next question with a image. I have already a browser with three panels, as shown here: http://www.enlightenment.org/ss/e-53ea868b320b20.66100223.jpg - The tree panel, at the left for showing node titles (headers). - The content panel, at the top right for showing node content (bodies). - The code panel, at the bottom right for writing Smalltalk code. I'm able to send message from code panel to another "external" objects, like the usual Transcript, but I would like to be able to send messages from the code panel to the tree that is being shown in the browser. I would like to start with adding nodes to the current tree, and changing its values. How can be this done? Thanks for Glamorous Toolkit. I'm really enjoying being able to prototype new tools as fast, despite of being a newbie (¡Power to the (newbie) user! --also). Cheers, Offray
Hi again, I'm looking at the code at Updataeble Browser in the Basic Examples and I have done some small modifications. The code I have (see below) is running without error, so I suppose that nodes are being added, but the tree view is not updated. My guess is that this is done with "updateOn:" message, but I would like to know, what I'm missing. Here is my code =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree | mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #preview. browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.] icon: GLMUIThemeExtraIcons glamorousAdd entitled: 'Add an item in the collection'. browser act: [:b | b entity removeLast. b update ] icon: GLMUIThemeExtraIcons glamorousRemove entitled: 'Remove last item from the collection'. browser updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemRemoved from: #yourself. (browser transmit) to: #preview; andShow: [ :a | a tree title: mainTree header; children: [:eachNode | eachNode children ]; format: [:eachNode | eachNode header ]. a text title: 'Text']. browser openOn: mainTree. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- An UbakyeNode is a simple data structure with a header (text), a body (text) and a list of children, wich are also Ubakye nodes. Any advice is welcomed, as always, Offray On 08/12/2014 04:42 PM, Offray Vladimir Luna Cárdenas wrote:
Hi,
On 08/12/2014 03:13 PM, Tudor Girba wrote:
I do not understand exactly what you did. Could you be more explicit about where the error happened?
I'm not able to reproduce it again. But as soon as I can catch it again, I will be doing it.
Also, the code you provide depends on the data you have. This makes it difficult for us to reproduce the issue. If you want to have quicker answers you could try providing an example that works with simpler objects, or at least provide a script to setup the data as you need it.
That's why I was asking (in other thread) how to point to my code online. I'm using SmalltalkHub to share this learning project here:
http://smalltalkhub.com/#!/~Offray/Ubakye/
but would be nice to point to a published snippets of code about this questions. May be I just don't understand how to point to specific code online like usually happens with DVCS like fossil or git.
Anyway if you can load my code from this repository you can then open a Playground and run:
UbakyeBrowser open.
to see the context I'm talking about.
Meanwhile, let me illustrate my next question with a image. I have already a browser with three panels, as shown here:
http://www.enlightenment.org/ss/e-53ea868b320b20.66100223.jpg
- The tree panel, at the left for showing node titles (headers). - The content panel, at the top right for showing node content (bodies). - The code panel, at the bottom right for writing Smalltalk code.
I'm able to send message from code panel to another "external" objects, like the usual Transcript, but I would like to be able to send messages from the code panel to the tree that is being shown in the browser. I would like to start with adding nodes to the current tree, and changing its values. How can be this done?
Thanks for Glamorous Toolkit. I'm really enjoying being able to prototype new tools as fast, despite of being a newbie (¡Power to the (newbie) user! --also).
Cheers,
Offray
Hi, Please take a look at the examples from GLMBasicExamples. Here are some related methods:: updateableBrowser updateableIndividualPresentations Cheers, Doru On Wed, Aug 13, 2014 at 2:19 AM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
Hi again,
I'm looking at the code at Updataeble Browser in the Basic Examples and I have done some small modifications. The code I have (see below) is running without error, so I suppose that nodes are being added, but the tree view is not updated. My guess is that this is done with "updateOn:" message, but I would like to know, what I'm missing.
Here is my code
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree | mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #preview. browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.] icon: GLMUIThemeExtraIcons glamorousAdd entitled: 'Add an item in the collection'. browser act: [:b | b entity removeLast. b update ] icon: GLMUIThemeExtraIcons glamorousRemove entitled: 'Remove last item from the collection'. browser updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemRemoved from: #yourself. (browser transmit) to: #preview; andShow: [ :a | a tree title: mainTree header; children: [:eachNode | eachNode children ]; format: [:eachNode | eachNode header ]. a text title: 'Text']. browser openOn: mainTree. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
An UbakyeNode is a simple data structure with a header (text), a body (text) and a list of children, wich are also Ubakye nodes.
Any advice is welcomed, as always,
Offray
On 08/12/2014 04:42 PM, Offray Vladimir Luna Cárdenas wrote:
Hi,
On 08/12/2014 03:13 PM, Tudor Girba wrote:
I do not understand exactly what you did. Could you be more explicit about where the error happened?
I'm not able to reproduce it again. But as soon as I can catch it again, I will be doing it.
Also, the code you provide depends on the data you have. This makes it
difficult for us to reproduce the issue. If you want to have quicker answers you could try providing an example that works with simpler objects, or at least provide a script to setup the data as you need it.
That's why I was asking (in other thread) how to point to my code online. I'm using SmalltalkHub to share this learning project here:
http://smalltalkhub.com/#!/~Offray/Ubakye/
but would be nice to point to a published snippets of code about this questions. May be I just don't understand how to point to specific code online like usually happens with DVCS like fossil or git.
Anyway if you can load my code from this repository you can then open a Playground and run:
UbakyeBrowser open.
to see the context I'm talking about.
Meanwhile, let me illustrate my next question with a image. I have already a browser with three panels, as shown here:
http://www.enlightenment.org/ss/e-53ea868b320b20.66100223.jpg
- The tree panel, at the left for showing node titles (headers). - The content panel, at the top right for showing node content (bodies). - The code panel, at the bottom right for writing Smalltalk code.
I'm able to send message from code panel to another "external" objects, like the usual Transcript, but I would like to be able to send messages from the code panel to the tree that is being shown in the browser. I would like to start with adding nodes to the current tree, and changing its values. How can be this done?
Thanks for Glamorous Toolkit. I'm really enjoying being able to prototype new tools as fast, despite of being a newbie (¡Power to the (newbie) user! --also).
Cheers,
Offray
-- www.tudorgirba.com "Every thing has its own flow"
Hi Offray, As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem. For the tree to get updated on node addition or removal, you need to use GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect: updateOn: GLMItemAdded from: #yourself; So, make sure you are using appropriate collection object. usman On Wed, Aug 13, 2014 at 2:19 AM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
Hi again,
I'm looking at the code at Updataeble Browser in the Basic Examples and I have done some small modifications. The code I have (see below) is running without error, so I suppose that nodes are being added, but the tree view is not updated. My guess is that this is done with "updateOn:" message, but I would like to know, what I'm missing.
Here is my code
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- | browser mainTree | mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #preview. browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.] icon: GLMUIThemeExtraIcons glamorousAdd entitled: 'Add an item in the collection'. browser act: [:b | b entity removeLast. b update ] icon: GLMUIThemeExtraIcons glamorousRemove entitled: 'Remove last item from the collection'. browser updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemRemoved from: #yourself. (browser transmit) to: #preview; andShow: [ :a | a tree title: mainTree header; children: [:eachNode | eachNode children ]; format: [:eachNode | eachNode header ]. a text title: 'Text']. browser openOn: mainTree. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
An UbakyeNode is a simple data structure with a header (text), a body (text) and a list of children, wich are also Ubakye nodes.
Any advice is welcomed, as always,
Offray
On 08/12/2014 04:42 PM, Offray Vladimir Luna Cárdenas wrote:
Hi,
On 08/12/2014 03:13 PM, Tudor Girba wrote:
I do not understand exactly what you did. Could you be more explicit about where the error happened?
I'm not able to reproduce it again. But as soon as I can catch it again, I will be doing it.
Also, the code you provide depends on the data you have. This makes it
difficult for us to reproduce the issue. If you want to have quicker answers you could try providing an example that works with simpler objects, or at least provide a script to setup the data as you need it.
That's why I was asking (in other thread) how to point to my code online. I'm using SmalltalkHub to share this learning project here:
http://smalltalkhub.com/#!/~Offray/Ubakye/
but would be nice to point to a published snippets of code about this questions. May be I just don't understand how to point to specific code online like usually happens with DVCS like fossil or git.
Anyway if you can load my code from this repository you can then open a Playground and run:
UbakyeBrowser open.
to see the context I'm talking about.
Meanwhile, let me illustrate my next question with a image. I have already a browser with three panels, as shown here:
http://www.enlightenment.org/ss/e-53ea868b320b20.66100223.jpg
- The tree panel, at the left for showing node titles (headers). - The content panel, at the top right for showing node content (bodies). - The code panel, at the bottom right for writing Smalltalk code.
I'm able to send message from code panel to another "external" objects, like the usual Transcript, but I would like to be able to send messages from the code panel to the tree that is being shown in the browser. I would like to start with adding nodes to the current tree, and changing its values. How can be this done?
Thanks for Glamorous Toolkit. I'm really enjoying being able to prototype new tools as fast, despite of being a newbie (¡Power to the (newbie) user! --also).
Cheers,
Offray
Hi Usman, On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url: http://smalltalkhub.com/#!/~Offray/Ubakye/ and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way). Anyway this is the part where I define a UbakyeNode: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- and the children method is the one which uses a colection: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children" ^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers, Offray
Hi Offray, some notes about your code: browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.] this would change the block parameter "newNode", but the block parameter is supposed to deliver the object you'll act on, the browser for example. I think you wanted to write this code: browser act: [ :b | |newNode| newNode := UbakyeNode header: 'nuevoNodo' body: ''. b entity addNode: newNode . if you call "b update" like you did in the "remove action" your browse tree update will work. changing OrderedCollection to GLMAnnouncingCollection should work, but you'll have to define the appropiate announcer source #children instead of #yourself. #yourself gives the mainTree, and that does not work as your mainTree is not a GLMAnnouncingCollection. updateOn: GLMItemAdded from: #children There are two things I don't understand 1. setting updateOn: on the browser does not work: browser updateOn: GLMItemAdded from: #children. but setting it on the tree (browser transmit) to: #preview; andShow: [ :a | a tree "-->" updateOn: GLMItemAdded from: #children; title: mainTree header; children: [:eachNode | eachNode children ]; format: [:eachNode | eachNode header ]. a text title: 'Text']. updates the tree when adding an element by the + button 2. is there a way to get the currently selected tree node? Otherwise all new nodes only added to the first node. There are plenty of examples, but no one with add/remove or selection on trees. Nicolai 2014-08-13 21:37 GMT+02:00 Offray Vladimir Luna Cárdenas <offray@riseup.net> :
Hi Usman,
On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url:
http://smalltalkhub.com/#!/~Offray/Ubakye/
and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way).
Anyway this is the part where I define a UbakyeNode:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
and the children method is the one which uses a colection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children"
^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use
GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers,
Offray
Hi, The important visual objects, such as the selection, are reflected on the ports of the pane containing the presentation. The tree has two ports that are relevant for selection: - #selection will give you the selected node - #selectionPath will give you the path from the selected node to the root You can do like this: a tree act: [:treePresentation | treePresentation selection inspect ] entitled: 'Inspect selection'; act: [:treePresentation | treePresentation selectionPath inspect ] entitled: 'Inspect selection path' Cheers, Doru On Thu, Aug 14, 2014 at 1:32 AM, Nicolai Hess <nicolaihess@web.de> wrote:
Hi Offray,
some notes about your code:
browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.]
this would change the block parameter "newNode", but the block parameter is supposed to deliver the object you'll act on, the browser for example. I think you wanted to write this code:
browser act: [ :b | |newNode|
newNode := UbakyeNode header: 'nuevoNodo' body: ''. b entity addNode: newNode .
if you call "b update" like you did in the "remove action" your browse tree update will work.
changing OrderedCollection to GLMAnnouncingCollection should work, but you'll have to define the appropiate announcer source #children instead of #yourself. #yourself gives the mainTree, and that does not work as your mainTree is not a GLMAnnouncingCollection.
updateOn: GLMItemAdded from: #children
There are two things I don't understand
1. setting updateOn: on the browser does not work:
browser updateOn: GLMItemAdded from: #children.
but setting it on the tree
(browser transmit) to: #preview; andShow: [ :a | a tree "-->" updateOn: GLMItemAdded from: #children;
title: mainTree header; children: [:eachNode | eachNode children ];
format: [:eachNode | eachNode header ]. a text title: 'Text'].
updates the tree when adding an element by the + button
2. is there a way to get the currently selected tree node? Otherwise all new nodes only added to the first node.
There are plenty of examples, but no one with add/remove or selection on trees.
Nicolai
2014-08-13 21:37 GMT+02:00 Offray Vladimir Luna Cárdenas < offray@riseup.net>:
Hi Usman,
On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url:
http://smalltalkhub.com/#!/~Offray/Ubakye/
and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way).
Anyway this is the part where I define a UbakyeNode:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
and the children method is the one which uses a colection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children"
^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use
GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers,
Offray
-- www.tudorgirba.com "Every thing has its own flow"
Ah, calling act: on the tree, that makes sense. 2014-08-14 7:11 GMT+02:00 Tudor Girba <tudor@tudorgirba.com>:
Hi,
The important visual objects, such as the selection, are reflected on the ports of the pane containing the presentation.
The tree has two ports that are relevant for selection: - #selection will give you the selected node - #selectionPath will give you the path from the selected node to the root
You can do like this: a tree act: [:treePresentation | treePresentation selection inspect ] entitled: 'Inspect selection'; act: [:treePresentation | treePresentation selectionPath inspect ] entitled: 'Inspect selection path'
Cheers, Doru
On Thu, Aug 14, 2014 at 1:32 AM, Nicolai Hess <nicolaihess@web.de> wrote:
Hi Offray,
some notes about your code:
browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.]
this would change the block parameter "newNode", but the block parameter is supposed to deliver the object you'll act on, the browser for example. I think you wanted to write this code:
browser act: [ :b | |newNode|
newNode := UbakyeNode header: 'nuevoNodo' body: ''. b entity addNode: newNode .
if you call "b update" like you did in the "remove action" your browse tree update will work.
changing OrderedCollection to GLMAnnouncingCollection should work, but you'll have to define the appropiate announcer source #children instead of #yourself. #yourself gives the mainTree, and that does not work as your mainTree is not a GLMAnnouncingCollection.
updateOn: GLMItemAdded from: #children
There are two things I don't understand
1. setting updateOn: on the browser does not work:
browser updateOn: GLMItemAdded from: #children.
but setting it on the tree
(browser transmit) to: #preview; andShow: [ :a | a tree "-->" updateOn: GLMItemAdded from: #children;
title: mainTree header; children: [:eachNode | eachNode children ];
format: [:eachNode | eachNode header ]. a text title: 'Text'].
updates the tree when adding an element by the + button
2. is there a way to get the currently selected tree node? Otherwise all new nodes only added to the first node.
There are plenty of examples, but no one with add/remove or selection on trees.
Nicolai
2014-08-13 21:37 GMT+02:00 Offray Vladimir Luna Cárdenas < offray@riseup.net>:
Hi Usman,
On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url:
http://smalltalkhub.com/#!/~Offray/Ubakye/
and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way).
Anyway this is the part where I define a UbakyeNode:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
and the children method is the one which uses a colection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children"
^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use
GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers,
Offray
-- www.tudorgirba.com
"Every thing has its own flow"
Hi Nicolai and Doru and community, This is working like a charm. I can add an remove nodes to selected nodes on any place of the tree, as you can see in this screenshot: http://www.enlightenment.org/ss/e-53eff22637d2c7.34692752.jpg I have some questions: - I have an issue still and is that once I have deleted a particular node, its parent should be now the selected node. If this doesn't happen, deleting and adding nodes with nothing selected becomes problematic. How can I reassign the selection to a node's parent? - This is more like a curiosity on good practices. The more I write on UbakyeBrowser>>buildBrowser, the more a lateral panel becomes red. I imagine that this is related with the extension of the code and some kind of reminder for modularization. Being the tree and its behaviour the more complex part of the interface I think that is the first candidate for this to happen. There is any reading I can see for advice on this? Following the advice of Doru, here is a way to see the code and launching the last version in a default Moose: =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Gofer new smalltalkhubUser: 'Offray' project: 'Ubakye'; package: 'Ubakye'; load. UbakyeBrowser open. =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Some time ago I said that I was approaching to the fun part of the Smalltalk joyride, and now if feels even closer! :-) https://twitter.com/offrayLC/status/493979407011561473/photo/1 Thanks, Offray On 08/14/2014 12:11 AM, Tudor Girba wrote:
Hi,
The important visual objects, such as the selection, are reflected on the ports of the pane containing the presentation.
The tree has two ports that are relevant for selection: - #selection will give you the selected node - #selectionPath will give you the path from the selected node to the root
You can do like this: a tree act: [:treePresentation | treePresentation selection inspect ] entitled: 'Inspect selection'; act: [:treePresentation | treePresentation selectionPath inspect ] entitled: 'Inspect selection path'
Cheers, Doru
On Thu, Aug 14, 2014 at 1:32 AM, Nicolai Hess <nicolaihess@web.de <mailto:nicolaihess@web.de>> wrote:
Hi Offray,
some notes about your code:
browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.]
this would change the block parameter "newNode", but the block parameter is supposed to deliver the object you'll act on, the browser for example. I think you wanted to write this code:
browser act: [ :b | |newNode|
newNode := UbakyeNode header: 'nuevoNodo' body: ''. b entity addNode: newNode .
if you call "b update" like you did in the "remove action" your browse tree update will work.
changing OrderedCollection to GLMAnnouncingCollection should work, but you'll have to define the appropiate announcer source #children instead of #yourself. #yourself gives the mainTree, and that does not work as your mainTree is not a GLMAnnouncingCollection.
updateOn: GLMItemAdded from: #children
There are two things I don't understand
1. setting updateOn: on the browser does not work:
browser updateOn: GLMItemAdded from: #children.
but setting it on the tree
(browser transmit) to: #preview; andShow: [ :a | a tree "-->" updateOn: GLMItemAdded from: #children;
title: mainTree header; children: [:eachNode | eachNode children ];
format: [:eachNode | eachNode header ]. a text title: 'Text'].
updates the tree when adding an element by the + button
2. is there a way to get the currently selected tree node? Otherwise all new nodes only added to the first node.
There are plenty of examples, but no one with add/remove or selection on trees.
Nicolai
2014-08-13 21:37 GMT+02:00 Offray Vladimir Luna Cárdenas <offray@riseup.net <mailto:offray@riseup.net>>:
Hi Usman,
On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url:
http://smalltalkhub.com/#!/~__Offray/Ubakye/ <http://smalltalkhub.com/#!/~Offray/Ubakye/>
and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way).
Anyway this is the part where I define a UbakyeNode:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-__=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-__=-=-=-=-=-
and the children method is the one which uses a colection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-__=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children"
^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-__=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers,
Offray
-- www.tudorgirba.com <http://www.tudorgirba.com>
"Every thing has its own flow"
Offray Vladimir Luna Cárdenas wrote:
but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way).
You might try STON or Fuel. Fuel is now included with Pharo, so you won't need to load it. STON is on SmalltalkHub. https://github.com/svenvc/ston/blob/master/ston-paper.md http://rmod.inria.fr/web/software/Fuel cheers -ben
Hi, If you want to provide a completely executable example, you could use Gofer. In your case, it would look as in the script below. This could be used in a fresh Moose image: Gofer new smalltalkhubUser: 'Offray' project: 'Ubakye'; package: 'Ubakye'; load. mainTree := UbakyeNode new. mainTree becomeDefaultTree. browser := GLMTabulator new. browser column: #preview. browser act: [:newNode | newNode := UbakyeNode header: 'nuevoNodo' body: ''. mainTree addNode: newNode.] icon: GLMUIThemeExtraIcons glamorousAdd entitled: 'Add an item in the collection'. browser act: [:b | b entity removeLast. b update ] icon: GLMUIThemeExtraIcons glamorousRemove entitled: 'Remove last item from the collection'. browser updateOn: GLMItemAdded from: #yourself; updateOn: GLMItemRemoved from: #yourself. (browser transmit) to: #preview; andShow: [ :a | a tree title: mainTree header; children: [:eachNode | eachNode children ]; format: [:eachNode | eachNode header ]. a text title: 'Text']. browser openOn: mainTree. Doru On Wed, Aug 13, 2014 at 9:37 PM, Offray Vladimir Luna Cárdenas < offray@riseup.net> wrote:
Hi Usman,
On 08/13/2014 02:16 AM, Usman Bhatti wrote:
Hi Offray,
As Doru mentioned, without a complete example it is difficult to reproduce and analyze your problem.
My main issue is that I don't know how to share a complete example except by sharing this url:
http://smalltalkhub.com/#!/~Offray/Ubakye/
and advising to upload the code and run "UbakyeBrowser open". In file based frameworks I can point to a specific file which contains the model of my defined objects, but I don't know how to share my own defined objects/messages in Smalltalk except by this or by manually cutting and pasting to email (it should be a better way).
Anyway this is the part where I define a UbakyeNode:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Object subclass: #UbakyeNode instanceVariableNames: 'header headers key icon body children parent node' classVariableNames: '' category: 'Ubakye-Model' =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
and the children method is the one which uses a colection:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- UbakyeNode>>children "Returns the receivers list of children"
^ children ifNil: [children := OrderedCollection new] =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
For the tree to get updated on node addition or removal, you need to use
GLMAnnouncingCollection to group your nodes. Hence, when you add a new node in your announcing collection object, this code comes into effect:
updateOn: GLMItemAdded from: #yourself;
So, make sure you are using appropriate collection object.
I tried changing OrderedCollection in the children message by GLMAnnouncingCollection, but the header message started to fail. Can I pass my children collection to a GLMAnnouncingCollection just in the interface or need I to change the object definition for the UbakyeNode, and if this is the case, how can I access the header of a UbakyeNode stored in this kind of collection? I know is kind of dumb to ask without proper context, but I hope that the SmalltalkHub repository (or other method) can be used to share my own defined object to make better questions.
usman
Cheers,
Offray
-- www.tudorgirba.com "Every thing has its own flow"
participants (6)
-
Ben Coman -
Nicolai Hess -
Offray Vladimir Luna Cárdenas -
PBKResearch -
Tudor Girba -
Usman Bhatti