Invoking "Save as..." from a browser.

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Invoking "Save as..." from a browser.

Offray
Hi,

I'm creating a menu for loading, storing files from my outliner and
updating the software. The interface is something like:

============================
buildBrowser
"Main method for building the interface for trees. Is getting long.
Needs refactoring"

browser := GLMTabulator new
        title: 'Grafoscopio'.

browser
     column: #tree span: 2;
     column: [ :c |
               c row: #nodeBody span: 2;
                 row: #nodeHeader ] span: 4.
browser
        updateOn: GLMItemAdded from: #yourself;
        updateOn: GLMItemRemoved from: #yourself.
               
(browser transmit)
     to: #tree;
     andShow: [:a | self treeOn: a].
"Creating a self updatable body pane"
(browser transmit)
     to: #nodeBody;
     from: #tree;
     andShow: [ :a | self bodyOn: a].
(browser transmit )
         from: #tree port: #selection;
         from: #nodeBody port: #text;
         when: [:node :text | text notNil];
         to: #nodeBody port: #neverland;
         transformed: [:node :text | node body: text asString].
(browser transmit)
         from: #tree;
     to: #nodeHeader;
     andShow: [ :h | self headerOn: h ].
(browser transmit )
         from: #tree port: #selection;
         from: #nodeHeader port: #text;
         when: [:node :text | text notNil];
         to: #nodeHeader port: #neverland1;
         transformed: [:node :text | node header: text asString]
============================

The "treeOn:" code for the menu is something like:

============================
treeOn: constructor
        "Shows the correspondent tree of a node"

        (constructor tree)

"Snipped code"

                act: [ UbakyeBrowser new openFromFile] entitled: 'Open/Load ...';
                act: [:x | x inspect] entitled: 'Save as ...';
                act: [:x | x inspect] entitled: 'Update Grafoscopio';
                act: [:x | x printString inspect] entitled: 'About ...'.
============================

Of course, the [:x | x inspect] is just a place holder for the real
code. In the case of a new browser, it has been replaced for [
UbakyeBrowser new openFromFile]. Now I would like to access to the
message "saveToFile" which is defined on the UbakyeBrowser-UI, but this
is different from the "Open/Load" option menu, because I'm not creating
a new browser with an existing file name as parameter, but saving the
current tree in the browser, so this doesn't seems a message to be send
to the current GLMTreePresentation tree, but to the current browser
which contains that tree (the one that was defined with "buildBrowser"
above) and that object doesn't understand the saveToFile message,
because it was defined for the UbakyeBrowser class.

So, there is any way to send messages from the a Glamorous tree to the
current instance of the UbakyeBrowser which is being displayed on the
interface and contains that tree?

As usual, I don't know if I made myself clear, but if there is any way
to make better questions, please let me know also about it.

Cheers,

Offray

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invoking "Save as..." from a browser.

Offray
Hi,

Any help with this from anybody? I would like to work on this for a
workshop tomorrow on data visualization with Pharo.

Thanks,

Offray

On 10/12/2014 11:41 PM, Offray Vladimir Luna Cárdenas wrote:

> Hi,
>
> I'm creating a menu for loading, storing files from my outliner and
> updating the software. The interface is something like:
>
> ============================
> buildBrowser
> "Main method for building the interface for trees. Is getting long.
> Needs refactoring"
>
> browser := GLMTabulator new
>      title: 'Grafoscopio'.
>
> browser
>      column: #tree span: 2;
>      column: [ :c |
>                c row: #nodeBody span: 2;
>                  row: #nodeHeader ] span: 4.
> browser
>      updateOn: GLMItemAdded from: #yourself;
>      updateOn: GLMItemRemoved from: #yourself.
>
> (browser transmit)
>      to: #tree;
>      andShow: [:a | self treeOn: a].
> "Creating a self updatable body pane"
> (browser transmit)
>      to: #nodeBody;
>      from: #tree;
>      andShow: [ :a | self bodyOn: a].
> (browser transmit )
>       from: #tree port: #selection;
>       from: #nodeBody port: #text;
>       when: [:node :text | text notNil];
>       to: #nodeBody port: #neverland;
>       transformed: [:node :text | node body: text asString].
> (browser transmit)
>       from: #tree;
>      to: #nodeHeader;
>      andShow: [ :h | self headerOn: h ].
> (browser transmit )
>       from: #tree port: #selection;
>       from: #nodeHeader port: #text;
>       when: [:node :text | text notNil];
>       to: #nodeHeader port: #neverland1;
>       transformed: [:node :text | node header: text asString]
> ============================
>
> The "treeOn:" code for the menu is something like:
>
> ============================
> treeOn: constructor
>      "Shows the correspondent tree of a node"
>
>      (constructor tree)
>
> "Snipped code"
>
>          act: [ UbakyeBrowser new openFromFile] entitled: 'Open/Load ...';
>          act: [:x | x inspect] entitled: 'Save as ...';
>          act: [:x | x inspect] entitled: 'Update Grafoscopio';
>          act: [:x | x printString inspect] entitled: 'About ...'.
> ============================
>
> Of course, the [:x | x inspect] is just a place holder for the real
> code. In the case of a new browser, it has been replaced for [
> UbakyeBrowser new openFromFile]. Now I would like to access to the
> message "saveToFile" which is defined on the UbakyeBrowser-UI, but this
> is different from the "Open/Load" option menu, because I'm not creating
> a new browser with an existing file name as parameter, but saving the
> current tree in the browser, so this doesn't seems a message to be send
> to the current GLMTreePresentation tree, but to the current browser
> which contains that tree (the one that was defined with "buildBrowser"
> above) and that object doesn't understand the saveToFile message,
> because it was defined for the UbakyeBrowser class.
>
> So, there is any way to send messages from the a Glamorous tree to the
> current instance of the UbakyeBrowser which is being displayed on the
> interface and contains that tree?
>
> As usual, I don't know if I made myself clear, but if there is any way
> to make better questions, please let me know also about it.
>
> Cheers,
>
> Offray
>
> _______________________________________________
> Moose-dev mailing list
> [hidden email]
> https://www.iam.unibe.ch/mailman/listinfo/moose-dev
>


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invoking "Save as..." from a browser.

Andrei Chis
Hi Offray,

In Glamour a presentation does not know about it's parent so what you want to do might not be possible.
Now, it's not very clear for me what you are trying to do. Is the code available somewhere? 


Cheers,
Andrei

On Fri, Oct 17, 2014 at 9:04 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:
Hi,

Any help with this from anybody? I would like to work on this for a workshop tomorrow on data visualization with Pharo.

Thanks,

Offray


On 10/12/2014 11:41 PM, Offray Vladimir Luna Cárdenas wrote:
Hi,

I'm creating a menu for loading, storing files from my outliner and
updating the software. The interface is something like:

============================
buildBrowser
"Main method for building the interface for trees. Is getting long.
Needs refactoring"

browser := GLMTabulator new
     title: 'Grafoscopio'.

browser
     column: #tree span: 2;
     column: [ :c |
               c row: #nodeBody span: 2;
                 row: #nodeHeader ] span: 4.
browser
     updateOn: GLMItemAdded from: #yourself;
     updateOn: GLMItemRemoved from: #yourself.

(browser transmit)
     to: #tree;
     andShow: [:a | self treeOn: a].
"Creating a self updatable body pane"
(browser transmit)
     to: #nodeBody;
     from: #tree;
     andShow: [ :a | self bodyOn: a].
(browser transmit )
      from: #tree port: #selection;
      from: #nodeBody port: #text;
      when: [:node :text | text notNil];
      to: #nodeBody port: #neverland;
      transformed: [:node :text | node body: text asString].
(browser transmit)
      from: #tree;
     to: #nodeHeader;
     andShow: [ :h | self headerOn: h ].
(browser transmit )
      from: #tree port: #selection;
      from: #nodeHeader port: #text;
      when: [:node :text | text notNil];
      to: #nodeHeader port: #neverland1;
      transformed: [:node :text | node header: text asString]
============================

The "treeOn:" code for the menu is something like:

============================
treeOn: constructor
     "Shows the correspondent tree of a node"

     (constructor tree)

"Snipped code"

         act: [ UbakyeBrowser new openFromFile] entitled: 'Open/Load ...';
         act: [:x | x inspect] entitled: 'Save as ...';
         act: [:x | x inspect] entitled: 'Update Grafoscopio';
         act: [:x | x printString inspect] entitled: 'About ...'.
============================

Of course, the [:x | x inspect] is just a place holder for the real
code. In the case of a new browser, it has been replaced for [
UbakyeBrowser new openFromFile]. Now I would like to access to the
message "saveToFile" which is defined on the UbakyeBrowser-UI, but this
is different from the "Open/Load" option menu, because I'm not creating
a new browser with an existing file name as parameter, but saving the
current tree in the browser, so this doesn't seems a message to be send
to the current GLMTreePresentation tree, but to the current browser
which contains that tree (the one that was defined with "buildBrowser"
above) and that object doesn't understand the saveToFile message,
because it was defined for the UbakyeBrowser class.

So, there is any way to send messages from the a Glamorous tree to the
current instance of the UbakyeBrowser which is being displayed on the
interface and contains that tree?

As usual, I don't know if I made myself clear, but if there is any way
to make better questions, please let me know also about it.

Cheers,

Offray

_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invoking "Save as..." from a browser.

Offray
Hi Andrei and thanks for your quick response,

On 10/17/2014 07:40 PM, Andrei Chis wrote:
> Hi Offray,
>
> In Glamour a presentation does not know about it's parent so what you want to do
> might not be possible.

Wow... I have been having so much learning/pleasure working with
Glamour.... but this is a stopper... I don't know to circumvent this issue.

> Now, it's not very clear for me what you are trying to do. Is the code available
> somewhere?

I'm trying to create and environment to write (interactive) documents
using a tree like metaphor so there are some kind of deep nodes which
are invisible to the exported file. Here is an screen shot of the
original tree in Pharo and the exported file from that tree side by side
here:

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/Figuras/intro-lado-lado.jpg


The pdf file of a still draft paper which was wrote completely using
this prototype here (in Spanish):

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/bootstrapping-objeto-investigacion.pdf

The original format of this file is a STON file with all the "metadata"
and deep nodes:

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/bootstrapping-objeto-investigacion.ston

I have added functionality to export to markdown from STON to produce
the pdf (using pandoc). This is the output:

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/bootstrapping-objeto-investigacion.markdown

(it can be render from the web site but is better to download it).

The code is hosted here:

http://smalltalkhub.com/#!/~Offray/Ubakye/

And can be installed following this instructions:

http://wiki.hackbo.co/doku.php/herramientas:grafoscopio:instalacion

Is my first project on Smalltalk (except from some Bots Inc, Etoys and
Scratch approaches) so is rookie code with a lot of errors.

Anyway if you can take a look of it and see in there is any way to "save
trees" to files or give any clue on how to solve the issue I really
appreciate it. I will make some test to see if I get some ideas.

Thanks again,

Offray


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invoking "Save as..." from a browser.

Andrei Chis


On Fri, Oct 17, 2014 at 10:41 PM, Offray Vladimir Luna Cárdenas <[hidden email]> wrote:
Hi Andrei and thanks for your quick response,

On 10/17/2014 07:40 PM, Andrei Chis wrote:
Hi Offray,

In Glamour a presentation does not know about it's parent so what you want to do
might not be possible.

Wow... I have been having so much learning/pleasure working with Glamour.... but this is a stopper... I don't know to circumvent this issue.

No worries. It's not so dramatic :)
Until now I really did bot get into a situation where this was a show stopper.
 


Now, it's not very clear for me what you are trying to do. Is the code available
somewhere?

I'm trying to create and environment to write (interactive) documents using a tree like metaphor so there are some kind of deep nodes which are invisible to the exported file. Here is an screen shot of the original tree in Pharo and the exported file from that tree side by side here:

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/Figuras/intro-lado-lado.jpg


The pdf file of a still draft paper which was wrote completely using this prototype here (in Spanish):

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/bootstrapping-objeto-investigacion.pdf

The original format of this file is a STON file with all the "metadata" and deep nodes:

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/bootstrapping-objeto-investigacion.ston

I have added functionality to export to markdown from STON to produce the pdf (using pandoc). This is the output:

http://mutabit.com/deltas/repos.fossil/grafoscopio/doc/tip/bootstrapping-objeto-investigacion.markdown

(it can be render from the web site but is better to download it).

The code is hosted here:

http://smalltalkhub.com/#!/~Offray/Ubakye/

And can be installed following this instructions:

http://wiki.hackbo.co/doku.php/herramientas:grafoscopio:instalacion

The script for loading STON is missing the package which causes an error.
 


Is my first project on Smalltalk (except from some Bots Inc, Etoys and Scratch approaches) so is rookie code with a lot of errors.

Cool project. It looks already impressive.
 

Anyway if you can take a look of it and see in there is any way to "save trees" to files or give any clue on how to solve the issue I really appreciate it. I will make some test to see if I get some ideas.

Replacing 'browser saveToFile' with 'self saveToFile' should solve the problem if I'm not missing anything.
UbakyeBrowser is the main browser so it's save to call method on it using self.
I still get some error when saving as there seem to be some hardcoded path to the file (/ 'home' / 'offray' / 'Documentos' / 'U' / 'Libertadores' / 'Grafoscopio' / 'bootstrapping-objeto-investigacion.ston')


Let me know if this helps or if you have any other questions.

Cheers,
Andrei

 

Thanks again,


Offray


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev


_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev
Reply | Threaded
Open this post in threaded view
|

Re: Invoking "Save as..." from a browser.

Offray
Andrei,

Thanks for your quick answer. Yesterday we made use of it at our local
workshop on Pharo and it worked like a charm. Some additional notes and
details below.

On 10/17/2014 08:58 PM, Andrei Chis wrote:

>
>
> On Fri, Oct 17, 2014 at 10:41 PM, Offray Vladimir Luna Cárdenas
> <[hidden email] <mailto:[hidden email]>> wrote:
>
>      Hi Andrei and thanks for your quick response,
>
>      On 10/17/2014 07:40 PM, Andrei Chis wrote:
>
>          Hi Offray,
>
>          In Glamour a presentation does not know about it's parent so what you
>          want to do
>          might not be possible.
>
>
>      Wow... I have been having so much learning/pleasure working with Glamour....
>      but this is a stopper... I don't know to circumvent this issue.
>
>
> No worries. It's not so dramatic :)
> Until now I really did bot get into a situation where this was a show stopper.
>
>

Yep it wasn't. Finally your proposed solution was the answer.


[...]
>
>
> The script for loading STON is missing the package which causes an error.
>
>

Yep, Sven told me about it, but I forgot to update the documentation. It
is STON-Core. Is updated now at [1].

[1] http://wiki.hackbo.co/doku.php/herramientas:grafoscopio:instalacion

>
>      Is my first project on Smalltalk (except from some Bots Inc, Etoys and
>      Scratch approaches) so is rookie code with a lot of errors.
>
>
> Cool project. It looks already impressive.
>

Thanks a lot. My idea is to make/write interactive visual notebooks on
Pharo/Moose/Roassal for Open/Citizen/Garage Science & Research. This is
a small step on that direction. Your help and the other peple of the
community has been really valuable to empower newbies like me.

>
>      Anyway if you can take a look of it and see in there is any way to "save
>      trees" to files or give any clue on how to solve the issue I really
>      appreciate it. I will make some test to see if I get some ideas.
>
>
> Replacing 'browser saveToFile' with 'self saveToFile' should solve the problem
> if I'm not missing anything.

Yep, that was the solution :-).

> UbakyeBrowser is the main browser so it's save to call method on it using self.
> I still get some error when saving as there seem to be some hardcoded path to
> the file (/ 'home' / 'offray' / 'Documentos' / 'U' / 'Libertadores' /
> 'Grafoscopio' / 'bootstrapping-objeto-investigacion.ston')


Yes, that was because I do not knew any way to "Save as", until your
advice. Last version contains no hard coded routes. You still need to
Save as before using save (we'll provide a default location for drafts
in the future), but now it should be working. If you have any time to
test it, please let me know if there are any glitches we can solve.

>
> Let me know if this helps or if you have any other questions.
>
> Cheers,
> Andrei
>

Yep it helped a lot!

Cheers,

Offray



_______________________________________________
Moose-dev mailing list
[hidden email]
https://www.iam.unibe.ch/mailman/listinfo/moose-dev