Re: Downloading Scratch project to XO

2008-12-18 Thread pgf
philipp wrote:
 > Hi Bert, John
 > 
 > There is a bug in copy-from-journal, it is adding an additional dot 
 > before the file extension. Otherwise it is working.
 > 
 > [o...@localhost ~]$ copy-from-journal -o 
 > 07474cf4-4883-4ded-a994-ab5511cfc29c /tmp/test.sb
 > /home/olpc/.sugar/default/data/07474cf4-4883-4ded-a994-ab5511cfc29c -> 
 > /tmp/test..sb
 > 
 > My workaround in scratch-activity looks like this:
 > if [ -n "$object_id" ] ; then
 >  filename="$SUGAR_ACTIVITY_ROOT/instance/temp.sb"
 >  copy-from-journal -o "$object_id" "$filename"
 >  filename="$SUGAR_ACTIVITY_ROOT/instance/temp..sb"
 > else
 >  filename=""
 > fi

will you file a ticket on this?  (or perhaps at least update #5571.)

paul
=-
 paul fox, p...@laptop.org
 give one laptop, get one laptop --- http://www.laptop.com/xo
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-17 Thread Philipp Kocher
Hi Bert, John

There is a bug in copy-from-journal, it is adding an additional dot 
before the file extension. Otherwise it is working.

[o...@localhost ~]$ copy-from-journal -o 
07474cf4-4883-4ded-a994-ab5511cfc29c /tmp/test.sb
/home/olpc/.sugar/default/data/07474cf4-4883-4ded-a994-ab5511cfc29c -> 
/tmp/test..sb

My workaround in scratch-activity looks like this:
if [ -n "$object_id" ] ; then
filename="$SUGAR_ACTIVITY_ROOT/instance/temp.sb"
copy-from-journal -o "$object_id" "$filename"
filename="$SUGAR_ACTIVITY_ROOT/instance/temp..sb"
else
filename=""
fi
# run Squeak VM with Scratch image
exec /usr/bin/squeak \
-vm-display-X11 \
-swapbtn \
-sugarBundleId $bundle_id \
-sugarActivityId $activity_id \
ScratchXO.image \
"$filename"

Philipp

Bert Freudenberg wrote:
> The simplest would be something like
> 
> if [ -n "$object_id" ] ; then
> filename="$SUGAR_ACTIVITY_ROOT/instance/temp.sb"
> copy-from-journal -o "$object_id" "$filename"
> #... append "$filename" to Scratch command line ...
> fi
> 
> (assuming the Scratch wrapper still basically looks like the Etoys one)
> 
> - Bert -
> 
> On 17.12.2008, at 00:51, John Maloney wrote:
> 
>> Hi, Bert.
>>
>> Thanks for the help on this.
>>
>> To clarify, what I was doing was using the clipboard to move a 
>> downloaded Scratch project file. I dragged it from the Journal to the 
>> clipboard, then went to the Scratch activity and dropped it onto the 
>> Scratch window. So that's a somewhat different path from trying to 
>> open the project directly in the Journal. It would be great to get 
>> both paths working eventually.
>>
>> Re: But this retrieval could be done in the Scratch wrapper script.
>>
>> Cool! That would be an easy solution for me if the wrapper script is 
>> not too complex. Could you give me a hint about what the wrapper 
>> script would look like?
>>
>> Meanwhile, I will try to make the drag-n-drop-from-clipboard solution 
>> work.
>>
>> -- John
>>
>>
>> On Dec 16, 2008, at 6:35 PM, Bert Freudenberg wrote:
>>
>>> Not quite, Sugar will not actually pass the file name of the Journal 
>>> entry when launching the activity. Instead, it passes the id of a 
>>> datastore object, and the activity is supposed to retrieve that from 
>>> the datastore. But this retrieval could be done in the Scratch 
>>> wrapper script.
>>>
>>> - Bert -
>>>
>>> On 17.12.2008, at 00:35, John Maloney wrote:
>>>
 Hi, Bert.

 Re: does Scratch accept a .sb file on its command line?

 Yes, it does.

 The problem is that the journal is changing the file extension to 
 something like .bin, and Scratch doesn't think a .bin file is a 
 Scratch project file and simply ignores it.

 I believe the issue is just that we need one extra file in the 
 Scratch activity info to tells the Journal that Scratch handles the 
 file extensions .sb and .sprite. I figured out what that file should 
 have in it a few weeks back but haven't yet had a chance to try it.

 I'll give it a try and, if it works, I'll release a new version of 
 Scratch on the XO that includes that file.

 -- John

 On Dec 15, 2008, at 2:46 PM, Bert Freudenberg wrote:

> John,
>
> does Scratch accept a .sb file on its command line?
>
> If so, the launcher script could get the file from the Journal and 
> pass it on.
>
> - Bert -
>
> On 15.12.2008, at 18:53, John Maloney wrote:
>
>> Hi, Phillipp.
>>
>> Thanks for reporting this problem. I believe there is a way to tell
>> the XO to associate the .sb file extension with Scratch. I will look
>> into that and let you know if I figure it out.
>>
>> -- John
>>
>>
>> On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:
>>
>>> Hi
>>>
>>> I would like to download Scratch projects from a local server to the
>>> XO.
>>>
>>> On the server I added the following line to the file 
>>> /etc/mime.types:
>>> application/scratch sb
>>>
>>> The apache server is now sending files with sb-extension with mime
>>> type application/scratch.
>>>
>>> On the XO the mime type gets stored in the datastore metadata-file.
>>> After adding the following line to the Scratch activity/
>>> activity.info file, Scratch gets started when clicking on the
>>> Scratch project in the Journal:
>>> mime_types = application/scratch
>>>
>>> The problem is that the project doesn't get opened. The scratch
>>> start script bin/scratch-activity gets called with the -u argument
>>> holding a datastore object ID, but the script doesn't handle the -u
>>> argument.
>>>
>>> How can I convert a datastore object ID to a filename, so scratch
>>> can open the project? And how do I get the necessary permissions to
>>> access the file?
>>>
>>> T

Re: Downloading Scratch project to XO

2008-12-17 Thread Bert Freudenberg
The simplest would be something like

if [ -n "$object_id" ] ; then
filename="$SUGAR_ACTIVITY_ROOT/instance/temp.sb"
copy-from-journal -o "$object_id" "$filename"
#... append "$filename" to Scratch command line ...
fi

(assuming the Scratch wrapper still basically looks like the Etoys one)

- Bert -

On 17.12.2008, at 00:51, John Maloney wrote:

> Hi, Bert.
>
> Thanks for the help on this.
>
> To clarify, what I was doing was using the clipboard to move a  
> downloaded Scratch project file. I dragged it from the Journal to  
> the clipboard, then went to the Scratch activity and dropped it onto  
> the Scratch window. So that's a somewhat different path from trying  
> to open the project directly in the Journal. It would be great to  
> get both paths working eventually.
>
> Re: But this retrieval could be done in the Scratch wrapper script.
>
> Cool! That would be an easy solution for me if the wrapper script is  
> not too complex. Could you give me a hint about what the wrapper  
> script would look like?
>
> Meanwhile, I will try to make the drag-n-drop-from-clipboard  
> solution work.
>
>   -- John
>
>
> On Dec 16, 2008, at 6:35 PM, Bert Freudenberg wrote:
>
>> Not quite, Sugar will not actually pass the file name of the  
>> Journal entry when launching the activity. Instead, it passes the  
>> id of a datastore object, and the activity is supposed to retrieve  
>> that from the datastore. But this retrieval could be done in the  
>> Scratch wrapper script.
>>
>> - Bert -
>>
>> On 17.12.2008, at 00:35, John Maloney wrote:
>>
>>> Hi, Bert.
>>>
>>> Re: does Scratch accept a .sb file on its command line?
>>>
>>> Yes, it does.
>>>
>>> The problem is that the journal is changing the file extension to  
>>> something like .bin, and Scratch doesn't think a .bin file is a  
>>> Scratch project file and simply ignores it.
>>>
>>> I believe the issue is just that we need one extra file in the  
>>> Scratch activity info to tells the Journal that Scratch handles  
>>> the file extensions .sb and .sprite. I figured out what that file  
>>> should have in it a few weeks back but haven't yet had a chance to  
>>> try it.
>>>
>>> I'll give it a try and, if it works, I'll release a new version of  
>>> Scratch on the XO that includes that file.
>>>
>>> -- John
>>>
>>> On Dec 15, 2008, at 2:46 PM, Bert Freudenberg wrote:
>>>
 John,

 does Scratch accept a .sb file on its command line?

 If so, the launcher script could get the file from the Journal  
 and pass it on.

 - Bert -

 On 15.12.2008, at 18:53, John Maloney wrote:

> Hi, Phillipp.
>
> Thanks for reporting this problem. I believe there is a way to  
> tell
> the XO to associate the .sb file extension with Scratch. I will  
> look
> into that and let you know if I figure it out.
>
>   -- John
>
>
> On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:
>
>> Hi
>>
>> I would like to download Scratch projects from a local server  
>> to the
>> XO.
>>
>> On the server I added the following line to the file /etc/ 
>> mime.types:
>> application/scratch sb
>>
>> The apache server is now sending files with sb-extension with  
>> mime
>> type application/scratch.
>>
>> On the XO the mime type gets stored in the datastore metadata- 
>> file.
>> After adding the following line to the Scratch activity/
>> activity.info file, Scratch gets started when clicking on the
>> Scratch project in the Journal:
>> mime_types = application/scratch
>>
>> The problem is that the project doesn't get opened. The scratch
>> start script bin/scratch-activity gets called with the -u  
>> argument
>> holding a datastore object ID, but the script doesn't handle  
>> the -u
>> argument.
>>
>> How can I convert a datastore object ID to a filename, so scratch
>> can open the project? And how do I get the necessary  
>> permissions to
>> access the file?
>>
>> Thanks,
>> Philipp
>> Pepyride School
>> Cambodia
> ___
> Devel mailing list
> Devel@lists.laptop.org
> http://lists.laptop.org/listinfo/devel



___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-16 Thread John Maloney
Hi, Bert.

Thanks for the help on this.

To clarify, what I was doing was using the clipboard to move a  
downloaded Scratch project file. I dragged it from the Journal to the  
clipboard, then went to the Scratch activity and dropped it onto the  
Scratch window. So that's a somewhat different path from trying to  
open the project directly in the Journal. It would be great to get  
both paths working eventually.

Re: But this retrieval could be done in the Scratch wrapper script.

Cool! That would be an easy solution for me if the wrapper script is  
not too complex. Could you give me a hint about what the wrapper  
script would look like?

Meanwhile, I will try to make the drag-n-drop-from-clipboard solution  
work.

-- John


On Dec 16, 2008, at 6:35 PM, Bert Freudenberg wrote:

> Not quite, Sugar will not actually pass the file name of the Journal  
> entry when launching the activity. Instead, it passes the id of a  
> datastore object, and the activity is supposed to retrieve that from  
> the datastore. But this retrieval could be done in the Scratch  
> wrapper script.
>
> - Bert -
>
> On 17.12.2008, at 00:35, John Maloney wrote:
>
>> Hi, Bert.
>>
>> Re: does Scratch accept a .sb file on its command line?
>>
>> Yes, it does.
>>
>> The problem is that the journal is changing the file extension to  
>> something like .bin, and Scratch doesn't think a .bin file is a  
>> Scratch project file and simply ignores it.
>>
>> I believe the issue is just that we need one extra file in the  
>> Scratch activity info to tells the Journal that Scratch handles the  
>> file extensions .sb and .sprite. I figured out what that file  
>> should have in it a few weeks back but haven't yet had a chance to  
>> try it.
>>
>> I'll give it a try and, if it works, I'll release a new version of  
>> Scratch on the XO that includes that file.
>>
>>  -- John
>>
>> On Dec 15, 2008, at 2:46 PM, Bert Freudenberg wrote:
>>
>>> John,
>>>
>>> does Scratch accept a .sb file on its command line?
>>>
>>> If so, the launcher script could get the file from the Journal and  
>>> pass it on.
>>>
>>> - Bert -
>>>
>>> On 15.12.2008, at 18:53, John Maloney wrote:
>>>
 Hi, Phillipp.

 Thanks for reporting this problem. I believe there is a way to tell
 the XO to associate the .sb file extension with Scratch. I will  
 look
 into that and let you know if I figure it out.

-- John


 On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:

> Hi
>
> I would like to download Scratch projects from a local server to  
> the
> XO.
>
> On the server I added the following line to the file /etc/ 
> mime.types:
> application/scratch sb
>
> The apache server is now sending files with sb-extension with mime
> type application/scratch.
>
> On the XO the mime type gets stored in the datastore metadata- 
> file.
> After adding the following line to the Scratch activity/
> activity.info file, Scratch gets started when clicking on the
> Scratch project in the Journal:
> mime_types = application/scratch
>
> The problem is that the project doesn't get opened. The scratch
> start script bin/scratch-activity gets called with the -u argument
> holding a datastore object ID, but the script doesn't handle the  
> -u
> argument.
>
> How can I convert a datastore object ID to a filename, so scratch
> can open the project? And how do I get the necessary permissions  
> to
> access the file?
>
> Thanks,
> Philipp
> Pepyride School
> Cambodia
 ___
 Devel mailing list
 Devel@lists.laptop.org
 http://lists.laptop.org/listinfo/devel
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-16 Thread Bert Freudenberg
Not quite, Sugar will not actually pass the file name of the Journal  
entry when launching the activity. Instead, it passes the id of a  
datastore object, and the activity is supposed to retrieve that from  
the datastore. But this retrieval could be done in the Scratch wrapper  
script.

- Bert -

On 17.12.2008, at 00:35, John Maloney wrote:

> Hi, Bert.
>
> Re: does Scratch accept a .sb file on its command line?
>
> Yes, it does.
>
> The problem is that the journal is changing the file extension to  
> something like .bin, and Scratch doesn't think a .bin file is a  
> Scratch project file and simply ignores it.
>
> I believe the issue is just that we need one extra file in the  
> Scratch activity info to tells the Journal that Scratch handles the  
> file extensions .sb and .sprite. I figured out what that file should  
> have in it a few weeks back but haven't yet had a chance to try it.
>
> I'll give it a try and, if it works, I'll release a new version of  
> Scratch on the XO that includes that file.
>
>   -- John
>
>
> On Dec 15, 2008, at 2:46 PM, Bert Freudenberg wrote:
>
>> John,
>>
>> does Scratch accept a .sb file on its command line?
>>
>> If so, the launcher script could get the file from the Journal and  
>> pass it on.
>>
>> - Bert -
>>
>> On 15.12.2008, at 18:53, John Maloney wrote:
>>
>>> Hi, Phillipp.
>>>
>>> Thanks for reporting this problem. I believe there is a way to tell
>>> the XO to associate the .sb file extension with Scratch. I will look
>>> into that and let you know if I figure it out.
>>>
>>> -- John
>>>
>>>
>>> On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:
>>>
 Hi

 I would like to download Scratch projects from a local server to  
 the
 XO.

 On the server I added the following line to the file /etc/ 
 mime.types:
 application/scratch sb

 The apache server is now sending files with sb-extension with mime
 type application/scratch.

 On the XO the mime type gets stored in the datastore metadata-file.
 After adding the following line to the Scratch activity/
 activity.info file, Scratch gets started when clicking on the
 Scratch project in the Journal:
 mime_types = application/scratch

 The problem is that the project doesn't get opened. The scratch
 start script bin/scratch-activity gets called with the -u argument
 holding a datastore object ID, but the script doesn't handle the -u
 argument.

 How can I convert a datastore object ID to a filename, so scratch
 can open the project? And how do I get the necessary permissions to
 access the file?

 Thanks,
 Philipp
 Pepyride School
 Cambodia
>>>
>>> ___
>>> Devel mailing list
>>> Devel@lists.laptop.org
>>> http://lists.laptop.org/listinfo/devel
>>
>>
>>
>>
>



___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-16 Thread John Maloney
Hi, Bert.

Re: does Scratch accept a .sb file on its command line?

Yes, it does.

The problem is that the journal is changing the file extension to  
something like .bin, and Scratch doesn't think a .bin file is a  
Scratch project file and simply ignores it.

I believe the issue is just that we need one extra file in the Scratch  
activity info to tells the Journal that Scratch handles the file  
extensions .sb and .sprite. I figured out what that file should have  
in it a few weeks back but haven't yet had a chance to try it.

I'll give it a try and, if it works, I'll release a new version of  
Scratch on the XO that includes that file.

-- John


On Dec 15, 2008, at 2:46 PM, Bert Freudenberg wrote:

> John,
>
> does Scratch accept a .sb file on its command line?
>
> If so, the launcher script could get the file from the Journal and  
> pass it on.
>
> - Bert -
>
> On 15.12.2008, at 18:53, John Maloney wrote:
>
>> Hi, Phillipp.
>>
>> Thanks for reporting this problem. I believe there is a way to tell
>> the XO to associate the .sb file extension with Scratch. I will look
>> into that and let you know if I figure it out.
>>
>>  -- John
>>
>>
>> On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:
>>
>>> Hi
>>>
>>> I would like to download Scratch projects from a local server to the
>>> XO.
>>>
>>> On the server I added the following line to the file /etc/ 
>>> mime.types:
>>> application/scratch sb
>>>
>>> The apache server is now sending files with sb-extension with mime
>>> type application/scratch.
>>>
>>> On the XO the mime type gets stored in the datastore metadata-file.
>>> After adding the following line to the Scratch activity/
>>> activity.info file, Scratch gets started when clicking on the
>>> Scratch project in the Journal:
>>> mime_types = application/scratch
>>>
>>> The problem is that the project doesn't get opened. The scratch
>>> start script bin/scratch-activity gets called with the -u argument
>>> holding a datastore object ID, but the script doesn't handle the -u
>>> argument.
>>>
>>> How can I convert a datastore object ID to a filename, so scratch
>>> can open the project? And how do I get the necessary permissions to
>>> access the file?
>>>
>>> Thanks,
>>> Philipp
>>> Pepyride School
>>> Cambodia
>>
>> ___
>> Devel mailing list
>> Devel@lists.laptop.org
>> http://lists.laptop.org/listinfo/devel
>
>
>
>

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-15 Thread Andrés Monroy-Hernández
Hi Philipp,

I am not sure if this helps, but our apache config file has this for
the Scratch file extension:
   AddType application/x-scratch-project sb

My impression is that what you descrie has to do more with how the XO
operating system handles the Scratch file type and/or with how to
create the correct system call for Scratch to open a file.

For the first, probably someone at OLPC might be able to you more, for
the latter perhaps John know can help.

Best.

2008/12/14 Philipp Kocher :
> Hi
>
> I would like to download Scratch projects from a local server to the XO.
>
> On the server I added the following line to the file /etc/mime.types:
> application/scratch sb
>
> The apache server is now sending files with sb-extension with mime type
> application/scratch.
>
> On the XO the mime type gets stored in the datastore metadata-file. After
> adding the following line to the Scratch activity/activity.info file,
> Scratch gets started when clicking on the Scratch project in the Journal:
> mime_types = application/scratch
>
> The problem is that the project doesn't get opened. The scratch start script
> bin/scratch-activity gets called with the -u argument holding a datastore
> object ID, but the script doesn't handle the -u argument.
>
> How can I convert a datastore object ID to a filename, so scratch can open
> the project? And how do I get the necessary permissions to access the file?
>
> Thanks,
> Philipp
> Pepyride School
> Cambodia
>



-- 
Andrés
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-15 Thread Bert Freudenberg
John,

does Scratch accept a .sb file on its command line?

If so, the launcher script could get the file from the Journal and  
pass it on.

- Bert -

On 15.12.2008, at 18:53, John Maloney wrote:

> Hi, Phillipp.
>
> Thanks for reporting this problem. I believe there is a way to tell
> the XO to associate the .sb file extension with Scratch. I will look
> into that and let you know if I figure it out.
>
>   -- John
>
>
> On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:
>
>> Hi
>>
>> I would like to download Scratch projects from a local server to the
>> XO.
>>
>> On the server I added the following line to the file /etc/mime.types:
>> application/scratch sb
>>
>> The apache server is now sending files with sb-extension with mime
>> type application/scratch.
>>
>> On the XO the mime type gets stored in the datastore metadata-file.
>> After adding the following line to the Scratch activity/
>> activity.info file, Scratch gets started when clicking on the
>> Scratch project in the Journal:
>> mime_types = application/scratch
>>
>> The problem is that the project doesn't get opened. The scratch
>> start script bin/scratch-activity gets called with the -u argument
>> holding a datastore object ID, but the script doesn't handle the -u
>> argument.
>>
>> How can I convert a datastore object ID to a filename, so scratch
>> can open the project? And how do I get the necessary permissions to
>> access the file?
>>
>> Thanks,
>> Philipp
>> Pepyride School
>> Cambodia
>
> ___
> Devel mailing list
> Devel@lists.laptop.org
> http://lists.laptop.org/listinfo/devel




___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Re: Downloading Scratch project to XO

2008-12-15 Thread John Maloney
Hi, Phillipp.

Thanks for reporting this problem. I believe there is a way to tell  
the XO to associate the .sb file extension with Scratch. I will look  
into that and let you know if I figure it out.

-- John


On Dec 14, 2008, at 8:03 PM, Philipp Kocher wrote:

> Hi
>
> I would like to download Scratch projects from a local server to the  
> XO.
>
> On the server I added the following line to the file /etc/mime.types:
> application/scratch sb
>
> The apache server is now sending files with sb-extension with mime  
> type application/scratch.
>
> On the XO the mime type gets stored in the datastore metadata-file.  
> After adding the following line to the Scratch activity/ 
> activity.info file, Scratch gets started when clicking on the  
> Scratch project in the Journal:
> mime_types = application/scratch
>
> The problem is that the project doesn't get opened. The scratch  
> start script bin/scratch-activity gets called with the -u argument  
> holding a datastore object ID, but the script doesn't handle the -u  
> argument.
>
> How can I convert a datastore object ID to a filename, so scratch  
> can open the project? And how do I get the necessary permissions to  
> access the file?
>
> Thanks,
> Philipp
> Pepyride School
> Cambodia

___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel


Downloading Scratch project to XO

2008-12-14 Thread Philipp Kocher
Hi

I would like to download Scratch projects from a local server to the XO.

On the server I added the following line to the file /etc/mime.types:
application/scratch sb

The apache server is now sending files with sb-extension with mime type 
application/scratch.

On the XO the mime type gets stored in the datastore metadata-file. 
After adding the following line to the Scratch activity/activity.info 
file, Scratch gets started when clicking on the Scratch project in the 
Journal:
mime_types = application/scratch

The problem is that the project doesn't get opened. The scratch start 
script bin/scratch-activity gets called with the -u argument holding a 
datastore object ID, but the script doesn't handle the -u argument.

How can I convert a datastore object ID to a filename, so scratch can 
open the project? And how do I get the necessary permissions to access 
the file?

Thanks,
Philipp
Pepyride School
Cambodia
___
Devel mailing list
Devel@lists.laptop.org
http://lists.laptop.org/listinfo/devel