jrg96 / turtlejs

Turtle Art port from Sugar Activity to Sugar Web Activity
http://ghostalgorithm.github.io/turtlejs/
GNU General Public License v3.0
5 stars 4 forks source link

Integrate Sugar-Web/Sugarizer container #5

Closed llaske closed 10 years ago

llaske commented 10 years ago

Now work both on Sugar 0.100+ and Sugarizer

jrg96 commented 10 years ago

Thanks for your help :)

llaske commented 10 years ago

Hi Jorge,

It was a pleasure ! Your work is so amazing that I was immediately interested to include it in the Sugarizer package. It's the case now, you could find it into the last git commit of [1].

The next step could be to save the content in the journal. Do you already think to that ? Usually, web activities save their context using a JSON string then reload it at start of the activity. I could help on this too if you explain to me how you store in memory the current context.

Tell me.

Best regards from France.

          Lionel.

[1] https://github.com/llaske/Sugarizer

2014-04-19 5:05 GMT+02:00 Jorge Alberto Gómez López < notifications@github.com>:

Thanks for your help :)

— Reply to this email directly or view it on GitHubhttps://github.com/GhostAlgorithm/turtlejs/pull/5#issuecomment-40859219 .

jrg96 commented 10 years ago

Hi Lionel,

yes, with Walter Bender, we thought about that, but at the moment, we're trying to implement all blocks first in order to write once the export/import routines (html_js/importexport.js), we thought about two icons as you see, the import icon (open a .tb or .ta file) and the export icon (generate the .ta or .tb file in some way, now, without the extension because the browser dowsn't allow it :S )

but now, I don't really know how to save context into the journal, maybe could you please give me some reference or examples in order to how to see the process?

Thanks, Jorge

llaske commented 10 years ago

Hi Jorge,

In my opinion, you don't need at all an icon to generate in a pure journal way of working. The context of an activity is its current state. In your case, the state of the activity is the list of all blocks selected by the user. The standard way of working of Sugar activities is that when you close the activity the current state is automatically saved in the journal and when the activity is relaunch, the last context is retrieved from the journal. So the activity will reopen in its last state. If the user want to create a new context, he use "Start new" menu item in the activity icon menu.

For web activities the context is usually a JSON string which a bunch of JavaScript objects. You could find an example in my LOLActivity [1]. Loading context is call here [2]. Saving context is call each time the board change [3]. The Load/Save process is here [4].

I had a look on the TB format in a recent example [5] shared by Walter. In fact it could be serialized directly in a JSON string. So if you could generate easily something that look like to a TB, it will be very easy to save it in the context.

Best regards from France.

       Lionel.

[1] http://activities.sugarlabs.org/en/sugar/addon/4717 [2] https://github.com/llaske/LOLActivity/blob/master/js/activity.js#L28 [3] https://github.com/llaske/LOLActivity/blob/master/js/app.js#L138 [4] https://github.com/llaske/LOLActivity/blob/master/js/app.js#L183 [5] https://github.com/walterbender/turtleart/blob/master/samples/math-heart.tb

2014-04-20 17:31 GMT+02:00 Jorge Alberto Gómez López < notifications@github.com>:

Hi Lionel,

yes, with Walter Bender, we thought about that, but at the moment, we're trying to implement all blocks first in order to write once the export/import routines (html_js/importexport.js), we thought about two icons as you see, the import icon (open a .tb or .ta file) and the export icon (generate the .ta or .tb file in some way, now, without the extension because the browser dowsn't allow it :S )

but now, I don't really know how to save context into the journal, maybe could you please give me some reference or examples in order to how to see the process?

Thanks, Jorge

— Reply to this email directly or view it on GitHubhttps://github.com/GhostAlgorithm/turtlejs/pull/5#issuecomment-40897241 .

llaske commented 10 years ago

Hi Jorge,

I've seen your huge work on TurtleJS since last version. It's very great. Congratulation for that.

I've just sent you a new pull request because I'm working on a new release of Sugarizer so I've worked to adapt activities to any screen size, including the smallest 480x320. I've done a first adaptation of TurtleJS to ensure that the Stop button of the activity is always visible and to shorten the toolbar. It's a good first step so TurtleJS is now usable on smartphones.

I've seen too that you've done good progress on import. It's very cool to have possibility to download an existing .TA file. I would like to work with you on the export to journal feature. The only things to do is to have a way to generate the current instructions as JSON string. Once it will be done, I will update the "$("#save-bt").click(...)" to do the write to journal stuff. I've already done that on several activities. BTW I've tried to stringify the content of "block_tracker.get_starter_blocks()" but it don't work :-( Can you explain where I can find current turtle instructions to do the work ?

Best regards from France.

          Lionel.
jrg96 commented 10 years ago

Hello Lionel :D

Maybe as you already saw.... I have implemented most of the export functionality with little things missing, so I think you can start to with the journal... Just see the JavaScript of save bt, I already made the huge work to generate the json, so you only receive a string :3