[Sugar-devel] Should or should not i use PyGTK >= 2.4 widget ?

laurent bernabe laurent.bernabe at gmail.com
Tue May 31 04:27:44 EDT 2011


Thank you very much :)

This time severals instances of activities have their own drawings resumed.
:)

But is it possible to, from the journal interface, see the generated file
for a particular instance, so that i can transfer it to a folder, a usb key
(and so on ...) ? Because i would like children to be able to import easily
"graphs" files or "graphs" zip archives.

Regards

2011/5/31 Walter Bender <walter.bender at gmail.com>

>
>
> On Mon, May 30, 2011 at 12:33 PM, laurent bernabe <
> laurent.bernabe at gmail.com> wrote:
>
>>
>> 2011/5/30 Walter Bender <walter.bender at gmail.com>
>>
>>>
>>>
>>> On Mon, May 30, 2011 at 11:59 AM, laurent bernabe <
>>> laurent.bernabe at gmail.com> wrote:
>>>
>>>> Hello
>>>>
>>>> I come back to this discussion, because there is another obscure point
>>>> in my mind
>>>> => Is it possible to write a file to a usb key, though the tutorial says
>>>> that there the activity can only acess its data/instance/temp folder ?
>>>>
>>>> Apologizes if my question is too evident and unusefull . But i don't
>>>> feel yet ready for developping serailisation/sharing part of my app
>>>>
>>>
>>> No apology necessary.
>>>
>>>
>> Than you
>>
>>
>>> The standard way to share to removable media in Sugar is to simply save
>>> as usual to the Journal. From the Journal, there are mechanisms for copying
>>> files to USB (and soon, $HOME/Documents and a remote server).
>>>
>>>
>> Argh : perhaps i saved my file badly from the application to the journal
>> because (though i surcharged the method write_file of activity.activity)
>>
>>    - in the journal (in its lits form, not graphical one) i can't see any
>>    trace of saves in the dropdown menu, though i clicked on the activity keep
>>    button
>>    - maybe i did not use the journal in the good way, or it's because i
>>    did not coded the algorithm well
>>
>> All changes have been made in the learning writing gitorious.
>>
>>    - Launcher is the class inherited from activity.activity
>>    - TheDrawingAreaEventBox is the class which define the canvas, and in
>>    which i defined the serialization to the Journal
>>
>> Could someone have a look at my code and say if i bad coded the
>> serialization please ? Many thanks ( Hard beginnings for me ..., as i'm a
>> quite modest programmer )
>>
>> Regards
>>
>>
>>
>>> -walter
>>>
>>>>
>>>> Regards
>>>>
>>>>
>>>> 2011/5/29 laurent bernabe <laurent.bernabe at gmail.com>
>>>>
>>>>> ok, thank you.
>>>>> i'll have a look at the examples and try to find an example close to my
>>>>> needs.
>>>>>
>>>>> regards
>>>>>
>>>>>
>>>>> 2011/5/28 Walter Bender <walter.bender at gmail.com>
>>>>>
>>>>>>
>>>>>>
>>>>>> On Sat, May 28, 2011 at 5:04 AM, laurent bernabe <
>>>>>> laurent.bernabe at gmail.com> wrote:
>>>>>>
>>>>>>> Thank you for your answers.
>>>>>>> But i am not sure i can do my task just with an ObjectChooser. And i
>>>>>>> need your advices for the strategy i should adopt :
>>>>>>>
>>>>>>>    - I want my application to "save a graph" by writing the
>>>>>>>    coordinates in a text file => i am conviced that for this tasks, i should
>>>>>>>    use the folder data of the activity
>>>>>>>    - i want my application to "load a graph" from a previously
>>>>>>>    recorded graph
>>>>>>>    - but i also want the users to share other graphs each others :
>>>>>>>    more precisely, for users who don't have internet access (or for later
>>>>>>>    systems restores, maybe after a crash, for example) to be able to import
>>>>>>>    files from a usb key
>>>>>>>
>>>>>>> So, what is the best strategy in order to do these tasks and remain
>>>>>>> conform to Sugar best practices ?
>>>>>>>
>>>>>>
>>>>>> In general, using the Journal for these sorts of tasks is best
>>>>>> practice in Sugar. You can  set a file path with your data associated with
>>>>>> your activity's datastore instance. That file can contain anything you want.
>>>>>> It is typical to have a method that overrides the builtin write_file method
>>>>>> -- called whenever the activity is either removed from the foreground or the
>>>>>> activity exits -- from which you save data.
>>>>>>
>>>>>>     def write_file(self, file_path):
>>>>>>         ''' Write the project to the Journal. '''
>>>>>>        ...
>>>>>>
>>>>>> You can also set the mime type for this file, so as giving a hint as
>>>>>> to what activities can subsequently open it.
>>>>>>
>>>>>> Lots of examples of this out there.
>>>>>>
>>>>>> -walter
>>>>>>
>>>>>>
>>>>>>> Regards
>>>>>>>
>>>>>>>
>>>>>>> 2011/5/27 Bert Freudenberg <bert at freudenbergs.de>
>>>>>>>
>>>>>>>> Step 1: search wiki for ObjectChooser.
>>>>>>>> Step 2: find
>>>>>>>> http://wiki.sugarlabs.org/go/Activity_Team/Object_Chooser
>>>>>>>> Step 3: there is no step 3
>>>>>>>>
>>>>>>>> - Bert -
>>>>>>>>
>>>>>>>> On 27.05.2011, at 17:49, laurent bernabe wrote:
>>>>>>>>
>>>>>>>> > Thank you.
>>>>>>>> >
>>>>>>>> > I've been on Sugar Almanach page in order to find ObjectChooser
>>>>>>>> class, but i did not manage.
>>>>>>>> > (i've been here :
>>>>>>>> http://wiki.sugarlabs.org/go/Development_Team/Almanac )
>>>>>>>> > Where should i look ?
>>>>>>>> >
>>>>>>>> > Regards
>>>>>>>> >
>>>>>>>> > 2011/5/27 Gonzalo Odiard <gonzalo at laptop.org>
>>>>>>>> > If you use a FileChooserDialog, you don't have integration with
>>>>>>>> the Journal.
>>>>>>>> > You must use ObjectChooser.
>>>>>>>> >
>>>>>>>> > Gonzalo
>>>>>>>> >
>>>>>>>> > On Fri, May 27, 2011 at 11:56 AM, laurent bernabe <
>>>>>>>> laurent.bernabe at gmail.com> wrote:
>>>>>>>> > Hello,
>>>>>>>> >
>>>>>>>> > i would like to use the FileChooserDialog in my application, which
>>>>>>>> the PyGTK reference says it can be used with PyGTK >= 2.4.
>>>>>>>> > Therefore, i wonder whereas oldest OLPC has already a PyGTK >= 2.4
>>>>>>>> version.
>>>>>>>> > So, is it all right ?
>>>>>>>> >
>>>>>>>> > Regards
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Sugar-devel mailing list
>>>>>>> Sugar-devel at lists.sugarlabs.org
>>>>>>> http://lists.sugarlabs.org/listinfo/sugar-devel
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Walter Bender
>>>>>> Sugar Labs
>>>>>> http://www.sugarlabs.org
>>>>>>
>>>>>>
>>>>>
>>>>
>>>
>>>
>>> --
>>> Walter Bender
>>> Sugar Labs
>>> http://www.sugarlabs.org
>>>
>>>
>>
> f.readline() reads a single line from the file; a newline character (\n)
> is left at the end of the string, and is only omitted on the last line of
> the file if the file doesn’t end in a newline. So, in your
> readFiguresFromTextFile method, you want to test for:
>
>     if current_line != "New\n" :
>
> That change and it seems to restore properly.
>
> -walter
>
>
>
> --
> Walter Bender
> Sugar Labs
> http://www.sugarlabs.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110531/3d564dd3/attachment.html>


More information about the Sugar-devel mailing list