[Sugar-devel] Accessing external media from within an activity (was: Re: Problem listing journal objects)

Tomeu Vizoso tomeu at sugarlabs.org
Thu Aug 27 11:28:10 EDT 2009


On Thu, Aug 27, 2009 at 16:30, Jim Simmons<nicestep at gmail.com> wrote:
> Tomeu,
>
> What you're saying seems to contradict what others have told me.  I
> have three places I run Sugar:

I must have explained myself badly because what you say below matches
my knowledge.

Perhaps I should have been more explicitly that I was talking about
the Journal and not about the DS?

Regards,

Tomeu

> 1).  My XO, running .82.   Files on removable media are listed using
> the datastore API as if they were Journal entries.
>
> 2).  A linux box running Fedora 10, using the Sugar environment that
> ships with it which is a buggier version of what I have on my XO and
> does pretty much the same thing.  I had to remove sorting in my
> datastore query because this was broken in Fedora 10.
>
> 3).  Another Linux box running Fedora 11, with the .84 Sugar
> environment that ships with it.  With this one the datastore API I was
> using does not list files on thumb drives.  The files are visible in
> the Journal activity and probably in the ObjectChooser, but cannot be
> retrieved using the datastore API.  Several people were of the opinion
> that the datastore API in .84 only deals with the Journal proper and I
> would have to use POSIX commands to list out files on thumb drives.
> That is what I am planning to do.
>
> I haven't tried this on SoaS lately, so I don't know how this might
> work on the latest .84.
>
> James Simmons
>
>
> On Thu, Aug 27, 2009 at 4:30 AM, Tomeu Vizoso<tomeu at sugarlabs.org> wrote:
>> On Wed, Aug 26, 2009 at 17:09, Jim Simmons<nicestep at gmail.com> wrote:
>>> Eben,
>>>
>>> I have given some thought to how I would implement getting image files
>>> from removable media and I think I have a workable plan.  Before I
>>> describe it I'd like to confess that it is *not* true that .84 code
>>> will show objects on the root directory of a thumb drive.  It won't
>>> show *anything* on a thumb drive, as some of you have pointed out.
>>> .82 shows every file whether it is on a thumb drive or in the Journal.
>>>  It is shown as a flat list with no way to tell what came from where.
>>
>> 0.84 should display all files in the thumb drive in the same flat
>> view, if it doesn't is because there's a bug somewhere.
>>
>>> What I think I might do is emulate this behavior in .84.  Python has
>>> an os.walk() function that will list out all the files within a
>>> subdirectory.  I was thinking that after I load the table with Journal
>>> objects I could do the os.walk() for the directory /media, which is
>>> where all the removable media seems to get mounted.  In my table model
>>> I would store the filename and a wrapper class for a Journal object.
>>> If there is an actual Journal object in there it would call the object
>>> to get a path to the image file in the Journal.  If not, it would
>>> simply get a real path to a file on a removable device.
>>
>> This is very close to what should be happening in 0.84.
>>
>>> I would not check for mounts, etc.  Instead, my Activity has a Refresh
>>> button which reloads everything.  The user would know when he needs to
>>> use it.
>>>
>>> I might put some sort of icon in the table rows so the user knows
>>> which entries are from the Journal and which are from thumb drives,
>>> etc.
>>>
>>> I suppose the ObjectChooser should be improved as much as possible,
>>> but I doubt I'll ever use it myself.  If you want to load only one
>>> file into an Activity you could just as easily restore the file from
>>> the Journal.  If you need to load more than one file having a modal
>>> dialog pop up each time just slows you down.
>>
>> Agreed, multiple selections would help there I guess.
>>
>> Regards,
>>
>> Tomeu
>>
>>> James Simmons
>



-- 
«Sugar Labs is anyone who participates in improving and using Sugar.
What Sugar Labs does is determined by the participants.» - David
Farning


More information about the Sugar-devel mailing list