[Etoys] Saving to Journal

Karl Ramberg karlramberg at gmail.com
Sun Jan 18 10:22:15 EST 2009


Bert Freudenberg wrote:
>
> On 18.01.2009, at 01:59, Karl Ramberg wrote:
>
>> I figured out the issue with preview, the file I was testing had a
>> wrong format preview.
>>
>> Anyway, I'm stuck at creating entries in the Journal. Do anybody know
>> how to do this. I found some methods in SugarDataStore but can not get
>> them to work, they time out on DBus.
>
> Are you sure they time out? Don't you get a "DBusError: Traceback"? 
> Every D-Bus message is sent with a timeout, that does not mean it 
> failed because of a timeout.
>
> In the debugger that opens on #sendDBusMessage:timeout:, to see the 
> full error message click the "reply" variable in the lower right hand 
> corner. Unfortunately Python's tracebacks are much too large to fit 
> into Squeak's error message window title I do not have a good idea how 
> to display the full error message to avoid this confusion.
>
>> I want to be able to save pictures and maybe other stuff.
>> It would be neat to be able to for example make a etoys drawing
>> program and save the drawings...
>
>
> Hmm, I thought I pointed you at all the necessary documentation 
> already. Somehow I'm not doing this well apparently. Could you explain 
> what kept you from discovering this:
>
> | img file id |
> img := Form fromUser.
> file := Project squeakletDirectory fullNameFor: 'tmp.png'.
> PNGReadWriter putForm: img onFileNamed: file.
> id := SugarDataStore new create: {'title'->'Some Image'. 
> 'mime_type'->'image/png'} with: file with: true.
> id
>
> The only "trick" here is to use the squeaklet directory for the 
> temporary file. When running under Rainbow this is mapped to the 
> activity's "instance" director, the Datastore can move the file from 
> there without copying. Other directories are not writable by the 
> Datastore, if you place the file there you must pass "false" to the 
> create method and delete the file yourself afterwards.
>
> - Bert -
>
>
>
Ah, thanks. I think you explained just fine, it's just a little denser 
on the receiving  side than you thought ;-)
This makes stuff much clearer

Karl


More information about the Etoys mailing list