From 94f3cef3011dc4f40ae39c56ef2ce57f9b767343 Mon Sep 17 00:00:00 2001
From: Tobias Schmidt <tobias.schmidt@unibas.ch>
Date: Mon, 11 Apr 2011 17:18:19 +0200
Subject: [PATCH] support for downloading multiple files in gui remote file
 loader

---
 modules/gui/pymod/scene/file_loader.py | 23 ++++++++++++-----------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/modules/gui/pymod/scene/file_loader.py b/modules/gui/pymod/scene/file_loader.py
index 90520d672..ba7efb375 100644
--- a/modules/gui/pymod/scene/file_loader.py
+++ b/modules/gui/pymod/scene/file_loader.py
@@ -21,6 +21,7 @@ from ost import gui
 from ost import info
 import ost
 import sip
+import re
 
 from PyQt4 import QtCore, QtGui, QtNetwork
 from ost.gui import FileLoader
@@ -36,17 +37,17 @@ class BaseRemoteLoader(gui.RemoteSiteLoader):
   def LoadById(self, id, selection=""):
     self.ById(id, selection)
   
-  def ById(self, id, selection=""):
-    file_name=self.GetFileName(id)
-    file = QtCore.QFile(file_name)
-    if(file.size()==0):
-        url = QtCore.QUrl(self.GetUrl(id))
-        request = QtNetwork.QNetworkRequest(url)
-        reply = self.networkmanager_.get(request)
-        self.downloads_[reply]=[id,selection]
-        return reply
-    else:
-      gui.FileLoader.LoadObject(str(file_name),str(selection))
+  def ById(self, ids, selection=""):
+    for id in re.findall('\w+', ids):
+      file_name=self.GetFileName(id)
+      file = QtCore.QFile(file_name)
+      if(file.size()==0):
+          url = QtCore.QUrl(self.GetUrl(id))
+          request = QtNetwork.QNetworkRequest(url)
+          reply = self.networkmanager_.get(request)
+          self.downloads_[reply]=[id,selection]
+      else:
+        gui.FileLoader.LoadObject(str(file_name),str(selection))
     return None
     
   def IsImg(self):
-- 
GitLab