[pitivi: 2/4] Fix #611996 even more (folders now).



commit d1175d6e0fe6000289fece67cba15de3d8902f27
Author: Alessandro Decina <alessandro d gmail com>
Date:   Sun Mar 7 23:28:28 2010 +0100

    Fix #611996 even more (folders now).

 pitivi/ui/pathwalker.py |   11 ++++++++++-
 pitivi/ui/sourcelist.py |   11 ++---------
 2 files changed, 12 insertions(+), 10 deletions(-)
---
diff --git a/pitivi/ui/pathwalker.py b/pitivi/ui/pathwalker.py
index fcfa193..a3b7548 100644
--- a/pitivi/ui/pathwalker.py
+++ b/pitivi/ui/pathwalker.py
@@ -21,8 +21,16 @@
 
 import os
 import threading
+from urllib import quote
+from urlparse import urlsplit, urlunsplit
 from pitivi.threads import Thread
 
+def quote_uri(uri):
+    parts = list(urlsplit(uri, allow_fragments=False))
+    parts[2] = quote(parts[2])
+    uri = urlunsplit(parts)
+    return uri
+
 class PathWalker(Thread):
     """
     Thread for recursively searching in a list of directories
@@ -45,7 +53,8 @@ class PathWalker(Thread):
                     return
                 uris = []
                 for afile in files:
-                    uris.append("file://%s" % os.path.join(path, afile))
+                    uris.append(quote_uri("file://%s" %
+                            os.path.join(path, afile)))
                 if uris:
                     self.callback(uris)
 
diff --git a/pitivi/ui/sourcelist.py b/pitivi/ui/sourcelist.py
index c5574b9..b2dfb8e 100644
--- a/pitivi/ui/sourcelist.py
+++ b/pitivi/ui/sourcelist.py
@@ -26,13 +26,12 @@ import pango
 import os
 import time
 
-from urllib import unquote, quote
-from urlparse import urlsplit, urlunsplit
+from urllib import unquote
 from gettext import gettext as _
 from gettext import ngettext
 
 import pitivi.ui.dnd as dnd
-from pitivi.ui.pathwalker import PathWalker
+from pitivi.ui.pathwalker import PathWalker, quote_uri
 from pitivi.ui.filelisterrordialog import FileListErrorDialog
 from pitivi.configure import get_pixmap_dir
 from pitivi.signalgroup import SignalGroup
@@ -903,12 +902,6 @@ class SourceList(gtk.VBox, Loggable):
         if directories:
             self.addFolders(directories)
 
-        def quote_uri(uri):
-            parts = list(urlsplit(uri, allow_fragments=False))
-            parts[2] = quote(parts[2])
-            uri = urlunsplit(parts)
-            return uri
-
         try:
             self.addUris([quote_uri(uri) for uri in filenames])
         except SourceListError:



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