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

Gary C Martin gary at garycmartin.com
Wed Aug 26 12:13:07 EDT 2009


Hi Jim,

On 26 Aug 2009, at 16:09, Jim Simmons 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.
>
> 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
> 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.

FWIW (though I know you're trying to support existing Sugar releases);  
I see whispers happening in git that suggest ObjectChooser might be  
visited by the new thumbnail view that is the hawk swooping towards  
the rabbit silhouetted Journal, trying to bolt for its feature freeze  
warren... If the hawk is faster than the rabbit, in the next release  
cycle (0.88), multi-selection in both Journal and ObjectChooser would  
be fine features to champion as unified ways browsing/importing  
objects! :-)

Regards,
--Gary



More information about the Sugar-devel mailing list