Ok, now with Gary's code when i do resume i get the desired behaviour in the __init__ funcion, but i don't get the code of my read_file emthod to be called. Do I have to do something special?? thanks!<div><br></div>
<div>Another thing, how can i put the toolbox in a pygame window?? because i don't get to see the toolbox whereever i put the initiating code! thanks again!!<br><br><div class="gmail_quote">2008/11/18 Gary C Martin <span dir="ltr"><<a href="mailto:gary@garycmartin.com">gary@garycmartin.com</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><div><div></div><div class="Wj3C7c">On 18 Nov 2008, at 17:55, Gary C Martin wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Aleix,<br>
<br>
On 18 Nov 2008, at 17:13, Aleix Palet wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
To do this, I've reading the wiki (which is a bit confusing) and I<br>
learned that I have to play with the read_file and write_file<br>
options. What I've done is what I write next (with the consequent<br>
problems):<br>
</blockquote>
<br>
Wiki baptism by fire :-) I think the best effort is:<br>
<br>
<a href="http://wiki.laptop.org/go/Sugar_Almanac" target="_blank">http://wiki.laptop.org/go/Sugar_Almanac</a><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- in the init method of my app, I do the the<br>
acticity.Activity.__init__ and then I create the filechooser, I<br>
choose the file and then load, I guess i shouldn't do it like this,<br>
because when my app is executed through the read_file method, first<br>
this __init__ method is called, showing me the filechooser which I<br>
don't want!<br>
</blockquote>
<br>
OK. I made some slightly naughty timing trick, after hitting the same<br>
problem (Moon activity). After asking the list Tomeu suggested the<br>
less naught trick is to see if you are offered a Journal object_id.<br>
I've been deflected by localisation/Pootle since then (my excuse), so<br>
I've not implemented this yet. It should go something like this:<br>
<br>
from sugar.datastore import datastore<br>
... ...<br>
... ...<br>
dataStore = datastore.get(self.handle.object_id)<br>
if dataStore == None:<br>
# I'm a journal virgin<br>
else:<br>
# resumed<br>
<br>
--Gary<br>
</blockquote>
<br></div></div>
OK. Serves me right for copy pasting, I of course actually meant to write the much simpler (and working):<br>
<br>
def __init__(self, handle):<br>
....<br>
....<br>
if handle.object_id == None:<br>
print "I'm a journal virgin"<br>
else:<br>
print "I was resumed"<div><div></div><div class="Wj3C7c"><br>
....<br>
....<br>
<br>
:-)<br>
<br>
--Gary<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
- another problem is that the read_file filename parameter, gives me<br>
the path of the journal file copy, which is not a .jclic,zip file,<br>
then is not the file that I want.<br>
<br>
So my questions are:<br>
<br>
- how to organize my code to get the behabiour that I want?<br>
- how to get the real path?<br>
<br>
And finally, I've got another problem which is not as important as<br>
the ones before, but if I get an asnwer I would really grateful.<br>
When I open the filechooser which is made with and wx.app, which it<br>
also has an wx.frame, then I choose the file, but I don't get the<br>
window closed and the execution returned to the main app. The window<br>
stays opened without showing anything (a grey window).<br>
<br>
Thank you for everything, maybe the questions are a bit basic, but<br>
as I said, is really hard to find some documentation in the olpc<br>
wiki. Bye!<br>
<br>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.laptop.org" target="_blank">Devel@lists.laptop.org</a><br>
<a href="http://lists.laptop.org/listinfo/devel" target="_blank">http://lists.laptop.org/listinfo/devel</a><br>
</blockquote>
<br>
_______________________________________________<br>
Devel mailing list<br>
<a href="mailto:Devel@lists.laptop.org" target="_blank">Devel@lists.laptop.org</a><br>
<a href="http://lists.laptop.org/listinfo/devel" target="_blank">http://lists.laptop.org/listinfo/devel</a><br>
</blockquote>
<br>
</div></div></blockquote></div><br></div>