Author: dmeyer
Date: Sat Apr 14 19:21:57 2007
New Revision: 9439
Modified:
trunk/ui/src/directory.py
trunk/ui/src/util.py
Log:
move freespace and totalspace to directory
Modified: trunk/ui/src/directory.py
==============================================================================
--- trunk/ui/src/directory.py (original)
+++ trunk/ui/src/directory.py Sat Apr 14 19:21:57 2007
@@ -45,7 +45,6 @@
# freevo imports
from freevo.ui import config
-import util
import menu
import fxditem
@@ -118,6 +117,27 @@
return string[0].upper() + string[1:]
+def freespace(path):
+ """
+ freespace(path) -> integer
+ Return the number of bytes available to the user on the file system
+ pointed to by path.
+ """
+ s = os.statvfs(path)
+ return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
+
+
+def totalspace(path):
+ """
+ totalspace(path) -> integer
+ Return the number of total bytes available on the file system
+ pointed to by path.
+ """
+
+ s = os.statvfs(path)
+ return s[statvfs.F_BLOCKS] * long(s[statvfs.F_BSIZE])
+
+
class DirItem(Playlist):
"""
class for handling directories
@@ -204,7 +224,7 @@
return num_items[2]
if key in ( 'freespace', 'totalspace' ):
- space = getattr(util, key)(self.dir) / 1000000
+ space = eval(key)(self.dir) / 1000000
if space > 1000:
space='%s,%s' % (space / 1000, space % 1000)
return space
Modified: trunk/ui/src/util.py
==============================================================================
--- trunk/ui/src/util.py (original)
+++ trunk/ui/src/util.py Sat Apr 14 19:21:57 2007
@@ -179,27 +179,6 @@
# misc file ops
#
-def freespace(path):
- """
- freespace(path) -> integer
- Return the number of bytes available to the user on the file system
- pointed to by path.
- """
- s = os.statvfs(path)
- return s[statvfs.F_BAVAIL] * long(s[statvfs.F_BSIZE])
-
-
-def totalspace(path):
- """
- totalspace(path) -> integer
- Return the number of total bytes available on the file system
- pointed to by path.
- """
-
- s = os.statvfs(path)
- return s[statvfs.F_BLOCKS] * long(s[statvfs.F_BSIZE])
-
-
def unlink(filename):
try:
if os.path.isdir(filename) or \
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog