projects
/
findit
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d4b64a6
)
fixing src/searchfile.py
author
Alexandr Popov
<popov2al@gmail.com>
Tue, 10 Mar 2009 18:48:49 +0000
(21:48 +0300)
committer
Alexandr Popov
<popov2al@gmail.com>
Tue, 10 Mar 2009 18:48:49 +0000
(21:48 +0300)
src/searchfile.py
patch
|
blob
|
history
diff --git
a/src/searchfile.py
b/src/searchfile.py
index
d543551
..
5b663d6
100644
(file)
--- a/
src/searchfile.py
+++ b/
src/searchfile.py
@@
-5,6
+5,14
@@
class SearchFile(object):
class SearchFile(object):
+ def __init__(self, input, config, result):
+ self.path, self.count = input.get_st_par()
+ if not self.path:
+ self.path = config.get("default_start_dir")
+ if not self.count:
+ self.count = config.get("default_count")
+ self.result = result
+
def filesorter(self, dir):
import os
# Проходим по всем папкам вглубь от заданного пути
def filesorter(self, dir):
import os
# Проходим по всем папкам вглубь от заданного пути
@@
-15,17
+23,6
@@
class SearchFile(object):
yield (os.path.getsize(flpath), flpath)
def run(self):
yield (os.path.getsize(flpath), flpath)
def run(self):
- from file import File
import heapq
import heapq
- file = File(self.ui)
for fsize, fpath in heapq.nlargest(self.count, self.filesorter(self.path)):
for fsize, fpath in heapq.nlargest(self.count, self.filesorter(self.path)):
- file.add(fpath, fsize)
- file.show()
-
- def __init__(self, input, config, ui):
- self.path, self.count = input.get_st_par()
- if not self.path:
- self.path = config.get("default_start_dir")
- if not self.count:
- self.count = config.get("default_count")
- self.ui = ui
+ self.result.add(fpath, fsize)