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

Walter Bender walter.bender at gmail.com
Sat May 28 06:25:16 EDT 2011


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sugarlabs.org/archive/sugar-devel/attachments/20110528/d90136e0/attachment.html>


More information about the Sugar-devel mailing list