[Sugar-devel] Accessing external media from within an activity (was: Re: Problem listing journal objects)
nicestep at gmail.com
Wed Aug 26 11:09:50 EDT 2009
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.
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.
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
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,
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.
On Wed, Aug 26, 2009 at 8:53 AM, Eben Eliason<eben at laptop.org> wrote:
> On Wed, Aug 19, 2009 at 5:43 AM, Sascha
> Silbe<sascha-ml-ui-sugar-devel at silbe.org> wrote:
>> On Wed, Aug 19, 2009 at 08:41:28AM +0200, Tomeu Vizoso wrote:
>>> The public API is the POSIX one, though I don't know how this will be
>>> affected by future versions of Rainbow.
>> I can't find anything regarding mount points in POSIX 2001. How do you
>> expect Jims activity to discover them?
>> Two ways come to my mind:
>> a) parse /proc/mounts periodically
>> Linux-only, time-wasting but future-proof
>> b) use what the Journal is using internally, i.e. the Gnome way of the day
>> cross-platform (as much as Gnome/Sugar are), event-driven, but likely to
>> break on next release
>> Just as a reminder: The intended workflow for Jims activity seems to be:
>> 1. Start activity
>> 2. Plug in USB stick with photos
>> 3. Select and/or manage(?) photo from within the activity
>> Answering "use POSIX" is like "use a computer", it doesn't help getting the
>> job done. If the answer is "we want the user to copy the photos to the data
>> store first", that doesn't get the job done either, but it's a policy and
>> can be catered for (i.e. documented).
> The way I saw this working would be to extend the object chooser to
> allow multiple sources, including external media. Where there is
> currently a Journal icon in the chooser, we would also show any USB
> sticks and SD cards present, and these would be selectable (with the
> Journal the default, of course). Any activity could then invoke the
> object chooser to select objects from the Journal or from external
> media, without the overhead of building their own UI. Once the objects
> are loaded into the activity, they can be bundled up and saved as
> We even have some preliminary design sketches for this feature:
>> CU Sascha
>> -----BEGIN PGP SIGNATURE-----
>> Version: GnuPG v1.4.9 (GNU/Linux)
>> -----END PGP SIGNATURE-----
>> Sugar-devel mailing list
>> Sugar-devel at lists.sugarlabs.org
More information about the Sugar-devel