Re: [jokosher-devel] [PATCH] for ticket #26 (Moving instruments)



Jens Geiregat a écrit :
On 8/7/06, Laszlo Pandy <laszlok2 gmail com> wrote:
[...]
> - What to do with 'bad' file-uri's? (http:// in stead of file://,
> trying to import a .txt, ...)
>

Just ignore them and tell the status bar to display "could not import
file(s): %s".
The problem with this solution is that there isn't enough space in the
statusbar to display 20 filenames. Even when displaying only the
amount of bad uri's, there is no good time/event to remove that
message from the statusbar.

About http:// uri's: Jokosher can't handle these because it uses
shutil.copy to copy the imported files to the project's audio folder.
Maybe that code should try to use gnome-vfs, and fall back to shutil
when it is not available?
Like this:
try:
   import gnomevfs
   # use a gnome-vfs copy
except ImportError:
   print "GnomeVFS not available, using shutil"
   import shutil
   try:
       file = parse_uri_to_local_file(uri)
   except URIError:
       #Display an error message
   try:
       shutil.copy(file, dest)
   except IOError:
       ...

It would be better if this was handled by some helper-class or
function though...

The plan is to support gnomevfs before 0.2 if someone gets around to implementing it. I was thinking that there should be one class that makes a nice abstraction for us. Then you would just do:

import FileOperations
FileOperations.movefile(from_place, to_place)

With this, file operations could try to use gnomevfs and default to regular python calls if that doesnt work.

Laszlo




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]