Author: duncan
Date: Sun Jan 28 17:14:05 2007
New Revision: 9064

Modified:
   branches/rel-1-6/freevo/ChangeLog
   branches/rel-1-6/freevo/src/item.py
   branches/rel-1-6/freevo/src/plugins/shoppingcart.py

Log:
[ 1645468 ] shoppingcart: Copying directories fails
Fix applied, also allowed move and copy to the root media menu.


Modified: branches/rel-1-6/freevo/ChangeLog
==============================================================================
--- branches/rel-1-6/freevo/ChangeLog   (original)
+++ branches/rel-1-6/freevo/ChangeLog   Sun Jan 28 17:14:05 2007
@@ -17,6 +17,7 @@
  * Fixed auto shutdown not calling the mount command (B#1632754)
  * Fixed manual record when month is December (B#1621615)
  * Fixed shopping cart for items with two or more subitems (B#1620425)
+ * Fixed shopping cart for when copying directories (B#1645468)
  * Fixed video thumbnails not being shown with subitems (B#1620452)
  * Fixed video thumbnails not being shown for playlists (B#1623905)
  * Fixed webserver 'genre' module generated html (B#1622456)

Modified: branches/rel-1-6/freevo/src/item.py
==============================================================================
--- branches/rel-1-6/freevo/src/item.py (original)
+++ branches/rel-1-6/freevo/src/item.py Sun Jan 28 17:14:05 2007
@@ -80,7 +80,11 @@
                     d = destdir
                 if not os.path.isdir(d):
                     os.makedirs(d)
-                shutil.copy(f, d)
+                if os.path.isdir(f):
+                    dst = os.path.join(d, os.path.split(f)[1])
+                    shutil.copytree(f, dst)
+                else:
+                    shutil.copy2(f, d)
 
 
     def move_possible(self):

Modified: branches/rel-1-6/freevo/src/plugins/shoppingcart.py
==============================================================================
--- branches/rel-1-6/freevo/src/plugins/shoppingcart.py (original)
+++ branches/rel-1-6/freevo/src/plugins/shoppingcart.py Sun Jan 28 17:14:05 2007
@@ -48,7 +48,7 @@
 import config
 import shutil
 import util
-from gui.PopupBox import PopupBox
+from gui import PopupBox, AlertBox
 import rc
 import event as em
 import menu
@@ -70,8 +70,11 @@
     def moveHere(self, arg=None, menuw=None):
         popup = PopupBox(text=_('Moving files...'))
         popup.show()
-        for cartfile in self.cart:
-            cartfile.files.move(self.item.dir)
+        try:
+            for cartfile in self.cart:
+                cartfile.files.move(self.item.dir)
+        except OSError, e:
+            print 'Mode failed \'%s\'' % e
         popup.destroy()
         self.cart = []
         rc.post_event(em.MENU_BACK_ONE_MENU)
@@ -80,8 +83,11 @@
     def copyHere(self, arg=None, menuw=None):
         popup = PopupBox(text=_('Copying files...'))
         popup.show()
-        for cartfile in self.cart:
-            cartfile.files.copy(self.item.dir)
+        try:
+            for cartfile in self.cart:
+                cartfile.files.copy(self.item.dir)
+        except OSError, e:
+            print 'Copy failed \'%s\'' % e
         popup.destroy()
         self.cart = []
         rc.post_event(em.MENU_BACK_ONE_MENU)
@@ -109,7 +115,7 @@
         self.item = item
         myactions = []
 
-        if self.item.parent and self.item.parent.type != 'dir':
+        if self.item.parent and self.item.parent.type not in 
('dir','mediamenu'):
             # only activate this for directory items
             return []
 
@@ -123,7 +129,8 @@
                 myactions.append((self.copyHere, _('Cart: Copy Files Here')))
 
             if not item in self.cart:
-                myactions.append((self.addToCart, _('Add Directory to Cart'), 
'cart:add'))
+                if self.item.parent and self.item.parent.type == 'dir':
+                    myactions.append((self.addToCart, _('Add Directory to 
Cart'), 'cart:add'))
 
         elif hasattr(item, 'files') and item.files and 
item.files.copy_possible() and \
                  not item in self.cart:

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to