Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv10622/src/plugins
Modified Files:
shoppingcart.py
Log Message:
o use os.system to move because Python 2.2.3 has no shutil.move
o add menu shortcuts
o add support to add directories to the cart
Index: shoppingcart.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/shoppingcart.py,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** shoppingcart.py 9 Dec 2003 23:29:46 -0000 1.1
--- shoppingcart.py 14 Dec 2003 11:53:03 -0000 1.2
***************
*** 11,17 ****
--- 11,24 ----
#
# Todo:
+ # o handle fxd files
+ # o also add metafiles like covers to the cart
#
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.2 2003/12/14 11:53:03 dischi
+ # o use os.system to move because Python 2.2.3 has no shutil.move
+ # o add menu shortcuts
+ # o add support to add directories to the cart
+ #
# Revision 1.1 2003/12/09 23:29:46 mikeruelle
# make it a little easier to move multiple files around
***************
*** 49,52 ****
--- 56,60 ----
import rc
import event as em
+ import menu
class PluginInterface(plugin.ItemPlugin):
***************
*** 69,73 ****
popup.show()
for cartfile in cartfiles:
! shutil.move(cartfile, self.item.dir)
os.unlink(self.pfile)
popup.destroy()
--- 77,82 ----
popup.show()
for cartfile in cartfiles:
! # python 2.2 has no shutil.move
! os.system('mv "%s" "%s"' % (cartfile, self.item.dir))
os.unlink(self.pfile)
popup.destroy()
***************
*** 89,96 ****
else:
cartfiles = util.read_pickle(self.pfile)
! cartfiles.append(self.item.filename)
util.save_pickle(cartfiles, self.pfile)
! rc.post_event(em.MENU_BACK_ONE_MENU)
!
def deleteCart(self, arg=None, menuw=None):
if (os.path.isfile(self.pfile) != 0):
--- 98,111 ----
else:
cartfiles = util.read_pickle(self.pfile)
! if self.item.type == 'dir':
! cartfiles.append(self.item.dir)
! else:
! cartfiles.append(self.item.filename)
util.save_pickle(cartfiles, self.pfile)
! if isinstance(menuw.menustack[-1].selected, menu.MenuItem):
! rc.post_event(em.MENU_BACK_ONE_MENU)
! else:
! rc.post_event(em.Event(em.OSD_MESSAGE, arg=_('Added to Cart')))
!
def deleteCart(self, arg=None, menuw=None):
if (os.path.isfile(self.pfile) != 0):
***************
*** 105,115 ****
else:
cartfiles = util.read_pickle(self.pfile)
! if item.type == 'dir' and len(cartfiles) > 0:
! myactions.append((self.moveHere, _('Move Files Here')))
! myactions.append((self.copyHere, _('Copy Files Here')))
elif hasattr(item, 'filename'):
! myactions.append((self.addToCart, _('Add File to Cart')))
if (os.path.isfile(self.pfile) != 0):
myactions.append((self.deleteCart, _('Delete Cart')))
return myactions
--- 120,138 ----
else:
cartfiles = util.read_pickle(self.pfile)
!
! if item.type == 'dir':
! if len(cartfiles) > 0:
! myactions.append((self.moveHere, _('Cart: Move Files Here')))
! myactions.append((self.copyHere, _('Cart: Copy Files Here')))
! if not item.dir in cartfiles:
! myactions.append((self.addToCart, _('Add Directory to Cart'),
'cart:add'))
!
elif hasattr(item, 'filename'):
! if not item.filename in cartfiles:
! myactions.append((self.addToCart, _('Add File to Cart'), 'cart:add'))
!
if (os.path.isfile(self.pfile) != 0):
myactions.append((self.deleteCart, _('Delete Cart')))
+
return myactions
-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive? Does it
help you create better code? SHARE THE LOVE, and help us help
YOU! Click Here: http://sourceforge.net/donate/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog