projects
/
findit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
dae7fed
)
add simple calc full directory size
author
“Alexandr
<“popov2al@gmail.com”>
Sat, 4 Apr 2009 11:09:04 +0000
(15:09 +0400)
committer
“Alexandr
<“popov2al@gmail.com”>
Sat, 4 Apr 2009 11:09:04 +0000
(15:09 +0400)
src/filesearch.py
patch
|
blob
|
history
diff --git
a/src/filesearch.py
b/src/filesearch.py
index
c8c26c4
..
2c1f3e8
100644
(file)
--- a/
src/filesearch.py
+++ b/
src/filesearch.py
@@
-31,7
+31,8
@@
class Search_File_Control(object):
start_path, count = get_data()
for fsize, fpath in nlargest(count, \
self.srch_abs.filegetter(start_path, get_stopit, label) ):
start_path, count = get_data()
for fsize, fpath in nlargest(count, \
self.srch_abs.filegetter(start_path, get_stopit, label) ):
- filelist.append([fpath, size_hum_read(fsize), fsize])
+ filelist.append([fpath, size_hum_read(fsize), int(fsize)])
+ print size_hum_read(self.srch_abs.full())
if not get_stopit():
kill_func()
self.result_out.show(filelist)
if not get_stopit():
kill_func()
self.result_out.show(filelist)
@@
-46,6
+47,7
@@
class Search_File_Abstraction(object):
def filegetter(self, startdir, get_stopit, label):
"""Generator of file sizes and paths based on os.walk."""
# Проходим по всем папкам вглубь от заданного пути
def filegetter(self, startdir, get_stopit, label):
"""Generator of file sizes and paths based on os.walk."""
# Проходим по всем папкам вглубь от заданного пути
+ self.full_dir_size = 0
for dirpath, dirnames, fnames in walk(startdir):
# Исключаем каталоги из поиска в соответствии со списком исключений
ignore_dirs = self.ignore_dirs
for dirpath, dirnames, fnames in walk(startdir):
# Исключаем каталоги из поиска в соответствии со списком исключений
ignore_dirs = self.ignore_dirs
@@
-69,9
+71,13
@@
class Search_File_Abstraction(object):
# Проверяем можем ли мы определить размер файла - иначе пропускаем его
try:
# Возвращаем размер и полный путь файла
# Проверяем можем ли мы определить размер файла - иначе пропускаем его
try:
# Возвращаем размер и полный путь файла
+ self.full_dir_size = getsize(flpath) + self.full_dir_size
yield getsize(flpath), flpath
except OSError:
continue
yield getsize(flpath), flpath
except OSError:
continue
+
+ def full(self):
+ return self.full_dir_size
class Search_File_Presentation(gtk.Window):
class Search_File_Presentation(gtk.Window):