URL drag/drop
svn: r493
This commit is contained in:
parent
0b131dfd41
commit
380e6f8ebd
@ -254,18 +254,27 @@ class Gallery(ImageSelect):
|
|||||||
elif protocol != "":
|
elif protocol != "":
|
||||||
import urllib
|
import urllib
|
||||||
u = urllib.URLopener()
|
u = urllib.URLopener()
|
||||||
tfile,headers = u.retrieve(d)
|
try:
|
||||||
|
tfile,headers = u.retrieve(d)
|
||||||
|
except IOError, msg:
|
||||||
|
t = _("Counld not import %s") % d
|
||||||
|
|
||||||
|
GnomeErrorDialog("%s\n%s %d" % (t,msg[0],msg[1]))
|
||||||
|
return
|
||||||
mime = utils.get_mime_type(tfile)
|
mime = utils.get_mime_type(tfile)
|
||||||
photo = Photo()
|
photo = Photo()
|
||||||
photo.setMimeType(mime)
|
photo.setMimeType(mime)
|
||||||
photo.setDescription(d)
|
photo.setDescription(d)
|
||||||
photo.setLocal(1)
|
photo.setLocal(1)
|
||||||
|
photo.setPath(tfile)
|
||||||
self.savephoto(photo)
|
self.savephoto(photo)
|
||||||
try:
|
try:
|
||||||
name = RelImage.import_media_object(tfile,self.path,photo.getId())
|
name = RelImage.import_media_object(tfile,self.path,photo.getId())
|
||||||
photo.setPath(name)
|
if name != None and name != "":
|
||||||
|
photo.setPath(name)
|
||||||
except:
|
except:
|
||||||
GnomeErrorDialog(_("Could not import %s") % d)
|
photo.setPath(tfile)
|
||||||
|
w.drag_finish(context, TRUE, FALSE, time)
|
||||||
return
|
return
|
||||||
utils.modified()
|
utils.modified()
|
||||||
else:
|
else:
|
||||||
@ -274,7 +283,7 @@ class Gallery(ImageSelect):
|
|||||||
for p in self.dataobj.getPhotoList():
|
for p in self.dataobj.getPhotoList():
|
||||||
if data.data == p.getReference().getId():
|
if data.data == p.getReference().getId():
|
||||||
if index == icon_index or icon_index == -1:
|
if index == icon_index or icon_index == -1:
|
||||||
w.drag_finish(context, TRUE, FALSE, time)
|
w.drag_finish(context, FALSE, FALSE, time)
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
w.drag_finish(context, TRUE, FALSE, time)
|
w.drag_finish(context, TRUE, FALSE, time)
|
||||||
|
@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
import gtk
|
import gtk
|
||||||
import gnome.mime
|
import gnome.mime
|
||||||
|
import gnome.util
|
||||||
from gnome.ui import *
|
from gnome.ui import *
|
||||||
import string
|
import string
|
||||||
import os
|
import os
|
||||||
@ -389,8 +390,11 @@ def thumb_path(dir,mobj):
|
|||||||
type = mobj.getMimeType()
|
type = mobj.getMimeType()
|
||||||
if type[0:5] == "image":
|
if type[0:5] == "image":
|
||||||
thumb = "%s/.thumb/%s.jpg" % (dir,mobj.getId())
|
thumb = "%s/.thumb/%s.jpg" % (dir,mobj.getId())
|
||||||
RelImage.check_thumb(mobj.getPath(),thumb,const.thumbScale)
|
try:
|
||||||
return thumb
|
RelImage.check_thumb(mobj.getPath(),thumb,const.thumbScale)
|
||||||
|
return thumb
|
||||||
|
except:
|
||||||
|
return find_icon(type)
|
||||||
else:
|
else:
|
||||||
return find_icon(type)
|
return find_icon(type)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user