summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-25 06:04:49 +0100
committerhut <hut@lavabit.com>2009-12-25 06:04:49 +0100
commit1743e8b97744bc4dbb9277e9de36c3bec31cd428 (patch)
tree603c7265b59a73494078848c6a6c714ea272be76
parent56134d8a42dfc0a88bab898aa8418e5c3837af16 (diff)
downloadranger-1743e8b97744bc4dbb9277e9de36c3bec31cd428.tar.gz
made copying processes work with the loader
-rw-r--r--ranger/actions.py29
-rw-r--r--ranger/fsobject/loader.py9
2 files changed, 21 insertions, 17 deletions
diff --git a/ranger/actions.py b/ranger/actions.py
index 08495ce8..3dac209f 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -188,36 +188,31 @@ class Actions(EnvironmentAware, SettingsAware):
 	def paste(self):
 		"""Paste the selected items into the current directory"""
 		from os.path import join, isdir
+		from ranger.ext import shutil_generatorized as shutil_g
+		from ranger.fsobject.loader import LoadableObject
 		copied_files = self.env.copy
 
 		if not copied_files:
 			return
 
 		if self.env.cut:
-			msg = self.notify("Moving ...", duration=0)
-			self.ui.redraw()
 			for f in self.env.copy:
-				try:
-					shutil.move(f.path, self.env.pwd.path)
-				except (shutil.Error, IOError, OSError) as x:
-					self.notify(str(x), bad=True)
+				self.loader.add(LoadableObject(\
+						shutil_g.move(f.path, self.env.pwd.path),\
+						"moving: " + f.path))
 			self.env.copy.clear()
 			self.env.cut = False
 		else:
-			msg = self.notify("Copying ...", duration=0)
-			self.ui.redraw()
 			for f in self.env.copy:
 				if isdir(f.path):
-					try:
-						shutil.copytree(f.path, join(self.env.pwd.path, f.basename))
-					except (shutil.Error, IOError, OSError) as x:
-						self.notify(str(x), bad=True)
+					self.loader.add(LoadableObject(
+						shutil_g.copytree(f.path,
+							join(self.env.pwd.path, f.basename)),
+						"copying tree: " + str(f.path)))
 				else:
-					try:
-						shutil.copy(f.path, self.env.pwd.path)
-					except (shutil.Error, IOError, OSError) as x:
-						self.notify(str(x), bad=True)
-		msg.delete()
+					self.loader.add(LoadableObject(
+						shutil_g.copy2(f.path, self.env.pwd.path),
+						"copying: " + str(f.path)))
 
 		self.env.pwd.load_content()
 
diff --git a/ranger/fsobject/loader.py b/ranger/fsobject/loader.py
index 7b051d53..aaf38117 100644
--- a/ranger/fsobject/loader.py
+++ b/ranger/fsobject/loader.py
@@ -11,6 +11,15 @@ def status_generator():
 		yield '\\'
 		yield '|'
 
+class LoadableObject(object):
+	def __init__(self, gen, descr):
+		self.load_generator = gen
+		self.description = descr
+
+	def get_description(self):
+		return self.description
+
+
 class Loader(object):
 	seconds_of_work_time = 0.05
 
matic uninstall' href='/akspecs/ranger/commit/Makefile?h=v1.4.2&id=b0a216f59a7770f5ce35f4a56b5055c51ceec284'>b0a216f5 ^
b06433bc ^
2c5ea01d ^
b0a216f5 ^

2c5ea01d ^
2c5ea01d ^
2c5ea01d ^
582f3519 ^
b06433bc ^
582f3519 ^

94c5d83e ^
dee6cfa6 ^
e9e4b4ff ^
b0a216f5 ^


e9e4b4ff ^





ad75190c ^
e9e4b4ff ^
e9e4b4ff ^
25a4162d ^
e9e4b4ff ^
fde932f2 ^
85fd5288 ^
4ade06a6 ^

85fd5288 ^
0c2c782d ^

636d9393 ^
b0a216f5 ^
b06433bc ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78