Update of /cvsroot/freevo/freevo/src/plugins
In directory sc8-pr-cvs1:/tmp/cvs-serv27910
Modified Files:
file_ops.py shoppingcart.py
Log Message:
move to new Item attributes
Index: file_ops.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/file_ops.py,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** file_ops.py 28 Nov 2003 20:08:57 -0000 1.12
--- file_ops.py 29 Dec 2003 22:28:13 -0000 1.13
***************
*** 10,13 ****
--- 10,16 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.13 2003/12/29 22:28:13 dischi
+ # move to new Item attributes
+ #
# Revision 1.12 2003/11/28 20:08:57 dischi
# renamed some config variables
***************
*** 90,103 ****
create list of possible actions
"""
items = []
! if ((item.type == 'video' and item.mode == 'file') or \
! item.type in ( 'audio', 'image','playlist' )) and not item.media:
! self.item = item
! items.append((self.confirm_delete, _('Delete file'), 'delete'))
! if item.type == 'video' and hasattr(item, 'fxd_file'):
items.append((self.confirm_info_delete, _('Delete info'),
'delete_info'))
- if item.type == 'dir':
- self.item = item
- items.append((self.confirm_delete, _('Delete directory'), 'delete'))
return items
--- 93,104 ----
create list of possible actions
"""
+ self.item = item
+
items = []
! if hasattr(item, 'files') and item.files:
! if item.files.delete_possible():
! items.append((self.confirm_delete, _('Delete'), 'delete'))
! if item.files.fxd_file:
items.append((self.confirm_info_delete, _('Delete info'),
'delete_info'))
return items
***************
*** 119,162 ****
print 'can\'t delete %s' % filename
- def delete_pictures(self):
- _debug_('Deleting pictures for %s' % self.item.filename)
- if self.item.type in ('video', 'audio'):
- base = os.path.splitext(self.item.filename)[0] + '.'
- if os.path.isfile(base + 'jpg'):
- self.safe_unlink(base + 'jpg')
- if os.path.isfile(base + 'png'):
- self.safe_unlink(base + 'png')
-
- def delete_fxd(self):
- _debug_('Deleting fxd for %s' % self.item.filename)
- if self.item.type == 'video' and hasattr(self.item, 'fxd_file') and \
- os.path.isfile(self.item.fxd_file) and \
- ((not config.VIDEO_SHOW_DATA_DIR) or \
- (self.item.fxd_file.find(config.VIDEO_SHOW_DATA_DIR) != 0)):
- self.safe_unlink(self.item.fxd_file)
-
def delete_file(self):
! if self.item.type == 'dir':
! _debug_('Deleting %s' % self.item.dir)
! try:
! util.rmrf(self.item.dir)
! except:
! print 'can\'t delete %s' % self.item.dir
! else:
! _debug_('Deleting %s' % self.item.filename)
!
! self.delete_pictures()
! self.delete_fxd()
!
! if os.path.isfile(self.item.filename):
! self.safe_unlink(self.item.filename)
!
if self.menuw:
self.menuw.back_one_menu(arg='reload')
def delete_info(self):
! _debug_('Deleting info for %s' % self.item.filename)
! self.delete_pictures()
! self.delete_fxd()
if self.menuw:
self.menuw.back_one_menu(arg='reload')
--- 120,133 ----
print 'can\'t delete %s' % filename
def delete_file(self):
! _debug_('Deleting %s' % self.item.url)
! self.item.files.delete()
if self.menuw:
self.menuw.back_one_menu(arg='reload')
def delete_info(self):
! _debug_('Deleting info for %s' % self.item.url)
! self.safe_unlink(self.files.image)
! self.safe_unlink(self.files.fxd_file)
if self.menuw:
self.menuw.back_one_menu(arg='reload')
Index: shoppingcart.py
===================================================================
RCS file: /cvsroot/freevo/freevo/src/plugins/shoppingcart.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** shoppingcart.py 14 Dec 2003 11:53:03 -0000 1.2
--- shoppingcart.py 29 Dec 2003 22:28:13 -0000 1.3
***************
*** 16,19 ****
--- 16,22 ----
# -----------------------------------------------------------------------
# $Log$
+ # Revision 1.3 2003/12/29 22:28:13 dischi
+ # move to new Item attributes
+ #
# 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
***************
*** 70,106 ****
plugin.ItemPlugin.__init__(self)
self.item = None
! self.pfile = os.path.join(config.FREEVO_CACHEDIR, 'cart')
def moveHere(self, arg=None, menuw=None):
- cartfiles = util.read_pickle(self.pfile)
popup = PopupBox(text=_('Moving files...'))
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()
rc.post_event(em.MENU_BACK_ONE_MENU)
def copyHere(self, arg=None, menuw=None):
- cartfiles = util.read_pickle(self.pfile)
popup = PopupBox(text=_('Copying files...'))
popup.show()
! for cartfile in cartfiles:
! shutil.copy(cartfile, self.item.dir)
! os.unlink(self.pfile)
popup.destroy()
rc.post_event(em.MENU_BACK_ONE_MENU)
def addToCart(self, arg=None, menuw=None):
! if (os.path.isfile(self.pfile) == 0):
! cartfiles = []
! 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)
--- 73,100 ----
plugin.ItemPlugin.__init__(self)
self.item = None
! self.cart = []
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)
popup.destroy()
+ self.cart = []
rc.post_event(em.MENU_BACK_ONE_MENU)
+
def copyHere(self, arg=None, menuw=None):
popup = PopupBox(text=_('Copying files...'))
popup.show()
! for cartfile in cart:
! cartfile.files.copy(self.item.dir)
popup.destroy()
+ self.cart = []
rc.post_event(em.MENU_BACK_ONE_MENU)
+
def addToCart(self, arg=None, menuw=None):
! self.cart.append(self.item)
if isinstance(menuw.menustack[-1].selected, menu.MenuItem):
rc.post_event(em.MENU_BACK_ONE_MENU)
***************
*** 108,136 ****
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):
! os.unlink(self.pfile)
rc.post_event(em.MENU_BACK_ONE_MENU)
def actions(self, item):
self.item = item
myactions = []
- if (os.path.isfile(self.pfile) == 0):
- cartfiles = []
- 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')))
--- 102,132 ----
rc.post_event(em.Event(em.OSD_MESSAGE, arg=_('Added to Cart')))
+
def deleteCart(self, arg=None, menuw=None):
! self.cart = []
rc.post_event(em.MENU_BACK_ONE_MENU)
+
def actions(self, item):
self.item = item
myactions = []
if item.type == 'dir':
! if len(self.cart) > 0:
! for c in self.cart:
! if not c.files.move_possible():
! break
! else:
! myactions.append((self.moveHere, _('Cart: Move Files Here')))
myactions.append((self.copyHere, _('Cart: Copy Files Here')))
!
! if not item in self.cart:
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:
! myactions.append((self.addToCart, _('Add File to Cart'), 'cart:add'))
! if self.cart:
myactions.append((self.deleteCart, _('Delete Cart')))
-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials.
Become an expert in LINUX or just sharpen your skills. Sign up for IBM's
Free Linux Tutorials. Learn everything from the bash shell to sys admin.
Click now! http://ads.osdn.com/?ad_id=1278&alloc_id=3371&op=click
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog