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

2011-05-31 Thread laurent bernabe
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.ben...@gmail.com



 On Mon, May 30, 2011 at 12:33 PM, laurent bernabe 
 laurent.bern...@gmail.com wrote:


 2011/5/30 Walter Bender walter.ben...@gmail.com



 On Mon, May 30, 2011 at 11:59 AM, laurent bernabe 
 laurent.bern...@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.bern...@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.ben...@gmail.com



 On Sat, May 28, 2011 at 5:04 AM, laurent bernabe 
 laurent.bern...@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 b...@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 gonz...@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.bern...@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 

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

2011-05-31 Thread James Cameron
On Tue, May 31, 2011 at 10:27:44AM +0200, laurent bernabe wrote:
 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.

To transfer a journal entry to a USB drive, insert the USB drive,
display the journal, then drag the journal item to the icon for the USB
drive.

To transfer a file from a USB drive to the journal, insert the USB
drive, display the journal, click on the icon for the USB drive, locate
the file, drag it to the icon for the journal.

Then, to open the file in an activity, the activity must have registered
interest in the MIME type of the file, and so the open entry dialog will
contain the activity name as an option.

Try it with a text file and you will see Write offered.

-- 
James Cameron
http://quozl.linux.org.au/
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-05-28 Thread laurent bernabe
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 ?

Regards

2011/5/27 Bert Freudenberg b...@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 gonz...@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.bern...@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@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-05-28 Thread Walter Bender
On Sat, May 28, 2011 at 5:04 AM, laurent bernabe
laurent.bern...@gmail.comwrote:

 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 b...@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 gonz...@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.bern...@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@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel




-- 
Walter Bender
Sugar Labs
http://www.sugarlabs.org
___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-05-27 Thread Gonzalo Odiard
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.bern...@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@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-05-27 Thread James Simmons
Laurent,

Gonzalo is correct about ObjectChooser.  If you actually do want to
have read-only access to the file system, not the Journal, than any
version of Sugar from .82 on up should allow you to use a FileChooser.
 I use one in a couple of my Activities: Sugar Commander and Read SD
Comics, and both have been tested on Sugar .82 and later.

James Simmons


On Fri, May 27, 2011 at 10:19 AM, Gonzalo Odiard gonz...@laptop.org wrote:
 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.bern...@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@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



 ___
 Sugar-devel mailing list
 Sugar-devel@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel


___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-05-27 Thread laurent bernabe
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 gonz...@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.bern...@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@lists.sugarlabs.org
 http://lists.sugarlabs.org/listinfo/sugar-devel



___
Sugar-devel mailing list
Sugar-devel@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel


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

2011-05-27 Thread Bert Freudenberg
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 gonz...@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.bern...@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@lists.sugarlabs.org
http://lists.sugarlabs.org/listinfo/sugar-devel