7258 7618 7837: let the win() stuff to windows, fix url/uri handling with non-ascii characters under linux and mac (not tested under mac)

This commit is contained in:
Jérôme Rapinat 2014-07-17 15:20:47 +02:00
parent 42ce347ff5
commit 66b051d3f0
2 changed files with 10 additions and 4 deletions

View File

@ -520,7 +520,10 @@ class GalleryTab(ButtonTab, DbGUIElement):
else: else:
files = sel_data.get_uris() files = sel_data.get_uris()
for file in files: for file in files:
if win():
d = conv_to_unicode((file.replace('\0',' ').strip()), None) d = conv_to_unicode((file.replace('\0',' ').strip()), None)
else:
d = file
protocol, site, mfile, j, k, l = urlparse(d) protocol, site, mfile, j, k, l = urlparse(d)
if protocol == "file": if protocol == "file":
name = url2pathname(mfile) name = url2pathname(mfile)

View File

@ -184,9 +184,12 @@ class MediaView(ListView):
#modern file managers provide URI_LIST. For Windows split sel_data.data #modern file managers provide URI_LIST. For Windows split sel_data.data
files = sel_data.get_uris() files = sel_data.get_uris()
for file in files: for file in files:
if win():
clean_string = conv_to_unicode( clean_string = conv_to_unicode(
file.replace('\0',' ').replace("\r", " ").strip(), file.replace('\0',' ').replace("\r", " ").strip(),
None) None)
else:
clean_string = file
protocol, site, mfile, j, k, l = urlparse(clean_string) protocol, site, mfile, j, k, l = urlparse(clean_string)
if protocol == "file": if protocol == "file":
name = url2pathname(mfile) name = url2pathname(mfile)