Differents behaviours of my application

Tomeu Vizoso tomeu at tomeuvizoso.net
Wed Nov 19 15:41:00 EST 2008


2008/11/19 Aleix Palet <aleix.palet at gmail.com>:
> 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!
> 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!!

Hmm, can we see the code of your activity class?

Thanks,

Tomeu

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



More information about the Devel mailing list