summary refs log tree commit diff stats
path: root/ranger
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 /ranger
parent56134d8a42dfc0a88bab898aa8418e5c3837af16 (diff)
downloadranger-1743e8b97744bc4dbb9277e9de36c3bec31cd428.tar.gz
made copying processes work with the loader
Diffstat (limited to 'ranger')
-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
 
30' href='#n30'>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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175