summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--ranger/defaults/keys.py8
-rw-r--r--ranger/fm.py11
-rw-r--r--ranger/fsobject/directory.py14
-rw-r--r--ranger/fsobject/loader.py31
-rw-r--r--ranger/gui/widgets/process_manager.py12
5 files changed, 65 insertions, 11 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 2a775ab9..fe657fdd 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -193,14 +193,20 @@ def initialize_process_manager_commands(command_list):
 	def bind(*args):
 		command_list.bind(args[-1], *args[:-1])
 
+	def do(method, *args, **kw):
+		return lambda widget, n: getattr(widget, method)(*args, **kw)
+
 	def do_fm(method, *args, **kw):
-		return lambda con: getattr(con.fm, method)(*args, **kw)
+		return lambda widget, n: getattr(con.fm, method)(*args, **kw)
 
 	bind('j', KEY_DOWN, wdg.move(relative=1))
 	bind('k', KEY_UP, wdg.move(relative=-1))
 	bind('gg', wdg.move(absolute=0))
 	bind('G', wdg.move(absolute=-1))
+	bind('K', lambda wdg, n: wdg.process_move(0))
+	bind('J', lambda wdg, n: wdg.process_move(-1))
 
+	bind('dd', do('process_remove'))
 	bind('P', ESC, ctrl('d'), lambda wdg, n: wdg.fm.ui.close_pman())
 
 	command_list.rebuild_paths()
diff --git a/ranger/fm.py b/ranger/fm.py
index ce62e94c..a1b1339a 100644
--- a/ranger/fm.py
+++ b/ranger/fm.py
@@ -75,11 +75,12 @@ class FM(Actions):
 
 					key = self.ui.get_next_key()
 
-					if self.input_blocked and \
-							time() > self.input_blocked_until:
-						self.input_blocked = False
-					if not self.input_blocked:
-						self.ui.handle_key(key)
+					if key > 0:
+						if self.input_blocked and \
+								time() > self.input_blocked_until:
+							self.input_blocked = False
+						if not self.input_blocked:
+							self.ui.handle_key(key)
 
 					gc_tick += 1
 					if gc_tick > TICKS_BEFORE_COLLECTING_GARBAGE:
diff --git a/ranger/fsobject/directory.py b/ranger/fsobject/directory.py
index 8fb4d0ac..f5aeade4 100644
--- a/ranger/fsobject/directory.py
+++ b/ranger/fsobject/directory.py
@@ -165,8 +165,10 @@ class Directory(FileSystemObject, SettingsAware):
 
 		self.content_loaded = True
 		self.loading = False
-#		yield
-#		yield
+
+	def unload(self):
+		self.loading = False
+		self.load_generator = None
 
 	def load_content(self, schedule=False):
 		"""
@@ -175,7 +177,7 @@ class Directory(FileSystemObject, SettingsAware):
 		"""
 
 		self.load_once()
-
+		
 		if schedule is None:
 			schedule = self.size > 30
 
@@ -319,8 +321,9 @@ class Directory(FileSystemObject, SettingsAware):
 		
 	def load_content_once(self, *a, **k):
 		"""Load the contents of the directory if not done yet"""
-		if not self.content_loaded and not self.loading:
-			self.load_content(*a, **k)
+		if not self.content_loaded:
+			if not self.loading:
+				self.load_content(*a, **k)
 			return True
 		return False
 
@@ -329,6 +332,7 @@ class Directory(FileSystemObject, SettingsAware):
 		Load the contents of the directory if it's
 		outdated or not done yet
 		"""
+
 		if self.load_content_once(*a, **k): return True
 
 		if self.old_show_hidden != self.settings.show_hidden:
diff --git a/ranger/fsobject/loader.py b/ranger/fsobject/loader.py
index 5923ff95..7b051d53 100644
--- a/ranger/fsobject/loader.py
+++ b/ranger/fsobject/loader.py
@@ -35,6 +35,37 @@ class Loader(object):
 		while obj in self.queue:
 			self.queue.remove(obj)
 		self.queue.appendleft(obj)
+	
+	def move(self, _from, to):
+		try:
+			item = self.queue[_from]
+		except IndexError:
+			return
+
+		del self.queue[_from]
+
+		if to == 0:
+			self.queue.appendleft(item)
+		elif to == -1:
+			self.queue.append(item)
+		else:
+			raise NotImplementedError
+	
+	def remove(self, item=None, index=None):
+		if item is not None and index is None:
+			for test, i in zip(self.queue, range(len(self.queue))):
+				if test == item:
+					index = i 
+					break
+			else:
+				return
+
+		if index is not None:
+			if item is None:
+				item = self.queue[index]
+			if hasattr(item, 'unload'):
+				item.unload()
+			del self.queue[index]
 
 	def work(self):
 		"""
diff --git a/ranger/gui/widgets/process_manager.py b/ranger/gui/widgets/process_manager.py
index ae372112..7a0f8357 100644
--- a/ranger/gui/widgets/process_manager.py
+++ b/ranger/gui/widgets/process_manager.py
@@ -73,6 +73,18 @@ class ProcessManager(Widget, Accumulator):
 
 		self.color_reset()
 
+	def process_remove(self, i=None):
+		if i is None:
+			i = self.pointer
+
+		self.fm.loader.remove(index=i)
+	
+	def process_move(self, absolute, i=None):
+		if i is None:
+			i = self.pointer
+
+		self.fm.loader.move(_from=i, to=absolute)
+
 	def press(self, key):
 		try:
 			tup = self.env.keybuffer.tuple_without_numbers()
mes Booth <boothj5@gmail.com> 2015-05-27 23:11:58 +0100 Renamed verifcation functions' href='/danisanti/profani-tty/commit/stabbertests/test_connect.c?id=5aab876ab547b1e8d534eab022cf17139415bf9d'>5aab876a ^
7f98e013 ^


db9376d8 ^







6640a089 ^
a48b9fce ^
db9376d8 ^
a522d022 ^
db9376d8 ^

37600846 ^
f17afcf5 ^
37600846 ^
a48b9fce ^
37600846 ^
a48b9fce ^
7f98e013 ^
37600846 ^


a48b9fce ^



7f98e013 ^
37600846 ^


a48b9fce ^



7f98e013 ^
37600846 ^



a522d022 ^
f8c5ed57 ^

7f98e013 ^
f8c5ed57 ^



a522d022 ^
37600846 ^
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95