summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--TODO5
-rw-r--r--doc/uml/12800220
-rw-r--r--doc/uml/128002.diagram12
-rw-r--r--doc/uml/134530.diagram5
-rw-r--r--ranger/actions.py16
-rw-r--r--ranger/defaults/keys.py18
-rw-r--r--ranger/fm.py2
-rw-r--r--ranger/fsobject/loader.py2
-rw-r--r--ranger/gui/defaultui.py25
-rw-r--r--ranger/gui/widgets/notify.py70
-rw-r--r--ranger/gui/widgets/statusbar.py58
11 files changed, 85 insertions, 148 deletions
diff --git a/TODO b/TODO
index 3e1d5c8a..62d9478e 100644
--- a/TODO
+++ b/TODO
@@ -27,3 +27,8 @@ Bugs
    (X) #17  10/01/01  why do bookmarks disappear sometimes?
    ( ) #18  10/01/01  fix notify widget (by adding a LogView?)
    (X) #19  10/01/01  resizing after pressing g
+
+
+Ideas
+
+   ( ) #20  10/01/01  use inotify to monitor filesystem changes
diff --git a/doc/uml/128002 b/doc/uml/128002
index d0d68427..0149fe5f 100644
--- a/doc/uml/128002
+++ b/doc/uml/128002
@@ -1067,26 +1067,6 @@ ${docstring}${members}
       end
     end
 
-    class 176002 "Notify"
-      visibility package 
-      cpp_decl ""
-      java_decl ""
-      php_decl ""
-      python_2_2 python_decl "class ${name}${inherit}:
-${docstring}${members}
-"
-      idl_decl ""
-      explicit_switch_type ""
-      
-      classrelation 193666 // <generalisation>
-	relation 191618 ---|>
-	  a public
-	    python "${type}"
-	    classrelation_ref 193666 // <generalisation>
-	  b parent class_ref 156034 // Widget
-      end
-    end
-
     class 176130 "TaskView"
       visibility package 
       cpp_decl ""
diff --git a/doc/uml/128002.diagram b/doc/uml/128002.diagram
index b101cd33..09164d16 100644
--- a/doc/uml/128002.diagram
+++ b/doc/uml/128002.diagram
@@ -60,10 +60,6 @@ classcanvas 138370 class_ref 175874 // StatusBar
   draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
   xyz 682 364 2000
 end
-classcanvas 142338 class_ref 176002 // Notify
-  draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
-  xyz 682 418 2000
-end
 classcanvas 142850 class_ref 176130 // TaskView
   draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
   xyz 681 562 2000
@@ -187,14 +183,6 @@ relationcanvas 138498 relation_ref 191490 // <generalisation>
   no_role_a no_role_b
   no_multiplicity_a no_multiplicity_b
 end
-relationcanvas 142466 relation_ref 191618 // <generalisation>
-  geometry HVH
-  from ref 142338 z 2001 to point 655 437
-  line 142594 z 2001 to point 655 324
-  line 142722 z 2001 to ref 134530
-  no_role_a no_role_b
-  no_multiplicity_a no_multiplicity_b
-end
 relationcanvas 142978 relation_ref 191746 // <generalisation>
   geometry HVH
   from ref 142850 z 2001 to point 655 581
diff --git a/doc/uml/134530.diagram b/doc/uml/134530.diagram
index 82785c7f..8ddb4d31 100644
--- a/doc/uml/134530.diagram
+++ b/doc/uml/134530.diagram
@@ -54,7 +54,7 @@ classcanvas 132610 class_ref 156034 // Widget
 end
 classcanvas 133250 class_ref 135170 // BrowserColumn
   draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
-  xyz 553 430 2023
+  xyz 526 453 2023
 end
 classcanvas 133506 class_ref 135042 // TitleBar
   draw_all_relations default hide_attributes default hide_operations default hide_getset_operations default show_members_full_definition default show_members_visibility default show_members_stereotype default show_members_multiplicity default show_members_initialization default show_attribute_modifiers default member_max_width 0 show_parameter_dir default show_parameter_name default package_name_in_tab default class_drawing_mode default drawing_language default show_context_mode default auto_label_position default show_relation_modifiers default show_relation_visibility default show_infonote default shadow default show_stereotype_properties default
@@ -173,8 +173,7 @@ relationcanvas 136450 relation_ref 184706 // <association>
   no_multiplicity_a no_multiplicity_b
 end
 relationcanvas 136834 relation_ref 170626 // <association>
-  from ref 129666 z 2007 to point 564 94
-  line 137090 z 2007 to ref 128258
+  from ref 129666 z 2007 to ref 128258
   no_role_a no_role_b
   no_multiplicity_a no_multiplicity_b
 end
diff --git a/ranger/actions.py b/ranger/actions.py
index c1ea7485..62b55b81 100644
--- a/ranger/actions.py
+++ b/ranger/actions.py
@@ -177,6 +177,13 @@ class Actions(EnvironmentAware, SettingsAware):
 		lines = trimmed_lines_of_docstring(command.__doc__)
 		pager.set_source(lines)
 	
+	def display_log(self):
+		if not hasattr(self.ui, 'open_pager'):
+			return
+
+		pager = self.ui.open_pager()
+		pager.set_source(self.log)
+	
 	def display_file(self):
 		if not hasattr(self.ui, 'open_embedded_pager'):
 			return
@@ -275,12 +282,9 @@ class Actions(EnvironmentAware, SettingsAware):
 			pass
 	
 	def notify(self, text, duration=4, bad=False):
-		try:
-			method = self.ui.display
-		except AttributeError:
-			pass
-		else:
-			return method(text, duration=duration, bad=bad)
+		self.log.appendleft(text)
+		if hasattr(self.ui, 'notify'):
+			self.ui.notify(text, duration=duration, bad=bad)
 	
 	def mark(self, all=False, toggle=False, val=None, movedown=None):
 		"""
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index 5732b793..7cd92004 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -59,6 +59,8 @@ def initialize_commands(command_list):
 
 	bind(TAB, fm.search(order='tag'))
 
+	bind(ctrl('p'), fm.display_log())
+
 	hint('t', "show_//h//idden //p//review_files //d//irectories_first " \
 			"//a//uto_load_preview //c//ollapse_preview")
 	bind('th', fm.toggle_boolean_option('show_hidden'))
@@ -141,7 +143,7 @@ def initialize_commands(command_list):
 	bind('r', fm.open_console(cmode.OPEN_QUICK))
 
 	def test(arg):
-		arg.fm.notify("bla")
+		arg.fm.notify(str(arg.n))
 	bind('x', test)
 
 	# definitions which require their own function:
@@ -234,18 +236,18 @@ def initialize_pager_commands(command_list):
 	initialize_embedded_pager_commands(command_list)
 	bind('q', 'i', ESC, KEY_F1, lambda arg: arg.fm.ui.close_pager())
 
-def initialize_embedded_pager_commands(command_list):
-	system_functions(command_list)
-	bind, hint = make_abbreviations(command_list)
-
 	bind('j', KEY_DOWN, nwrap.move(relative=1))
 	bind('k', KEY_DOWN, nwrap.move(relative=-1))
 	bind('gg', KEY_DOWN, nwrap.move(absolute=0))
 	bind('G', KEY_DOWN, nwrap.move(absolute=-1))
-	
-	bind('q', 'i', ESC, lambda arg: arg.fm.ui.close_embedded_pager())
+
 	bind('h', wdg.move_horizontal(relative=-4))
 	bind('l', wdg.move_horizontal(relative=4))
-	bind('Q', 'ZZ', fm.exit())
+	command_list.rebuild_paths()
 
+def initialize_embedded_pager_commands(command_list):
+	system_functions(command_list)
+	bind, hint = make_abbreviations(command_list)
+
+	bind('q', 'i', ESC, lambda arg: arg.fm.ui.close_embedded_pager())
 	command_list.rebuild_paths()
diff --git a/ranger/fm.py b/ranger/fm.py
index e70e9f3c..ebb84b70 100644
--- a/ranger/fm.py
+++ b/ranger/fm.py
@@ -1,4 +1,5 @@
 from time import time
+from collections import deque
 
 from ranger.actions import Actions
 from ranger.container import Bookmarks
@@ -17,6 +18,7 @@ class FM(Actions):
 		"""Initialize FM."""
 		Actions.__init__(self)
 		self.ui = ui
+		self.log = deque(maxlen=20)
 		self.bookmarks = bookmarks
 		self.tags = tags
 		self.loader = Loader()
diff --git a/ranger/fsobject/loader.py b/ranger/fsobject/loader.py
index 3a2020fb..a67c75fb 100644
--- a/ranger/fsobject/loader.py
+++ b/ranger/fsobject/loader.py
@@ -106,7 +106,7 @@ class Loader(FileManagerAware):
 			item.load_generator = None
 			self.queue.popleft()
 		except Exception as err:
-			self.fm.ui.display(str(err), bad=True)
+			self.fm.notify(str(err), bad=True)
 	
 	def has_work(self):
 		"""Is there anything to load?"""
diff --git a/ranger/gui/defaultui.py b/ranger/gui/defaultui.py
index ccbe2578..ca233df9 100644
--- a/ranger/gui/defaultui.py
+++ b/ranger/gui/defaultui.py
@@ -10,7 +10,6 @@ class DefaultUI(UI):
 		from ranger.gui.widgets.console import Console
 		from ranger.gui.widgets.statusbar import StatusBar
 		from ranger.gui.widgets.taskview import TaskView
-		from ranger.gui.widgets.notify import Notify
 		from ranger.gui.widgets.pager import Pager
 
 		# Create a title bar
@@ -27,10 +26,6 @@ class DefaultUI(UI):
 		self.taskview.visible = False
 		self.add_child(self.taskview)
 
-		# Create the (initially hidden) notify bar
-		self.notify = Notify(self.win)
-		self.add_child(self.notify)
-
 		# Create the status bar
 		self.status = StatusBar(self.win, self.browser.main_column)
 		self.add_child(self.status)
@@ -50,23 +45,15 @@ class DefaultUI(UI):
 		UI.update_size(self)
 		y, x = self.env.termsize
 
-		notify_hei = min(max(1, y - 4), self.notify.requested_height)
-
-		self.browser.resize(1, 0, y - 1 - notify_hei, x)
-		self.taskview.resize(1, 0, y - 1 - notify_hei, x)
-		self.pager.resize(1, 0, y - 1 - notify_hei, x)
-		self.notify.resize(y - notify_hei, 0, notify_hei, x)
+		self.browser.resize(1, 0, y - 2, x)
+		self.taskview.resize(1, 0, y - 2, x)
+		self.pager.resize(1, 0, y - 2, x)
 		self.titlebar.resize(0, 0, 1, x)
 		self.status.resize(y - 1, 0, 1, x)
 		self.console.resize(y - 1, 0, 1, x)
 	
-	def poke(self):
-		UI.poke(self)
-		if self.notify.requested_height != self.notify.hei:
-			self.update_size()
-	
-	def display(self, *a, **k):
-		return self.notify.display(*a, **k)
+	def notify(self, *a, **k):
+		return self.status.notify(*a, **k)
 
 	def close_pager(self):
 		if self.console.visible:
@@ -122,4 +109,4 @@ class DefaultUI(UI):
 			self.titlebar.throbber = string
 
 	def hint(self, text=None):
-		self.status.override = text
+		self.status.hint = text
diff --git a/ranger/gui/widgets/notify.py b/ranger/gui/widgets/notify.py
deleted file mode 100644
index 8b783fdb..00000000
--- a/ranger/gui/widgets/notify.py
+++ /dev/null
@@ -1,70 +0,0 @@
-"""Notify is a bar which displays messages."""
-
-from . import Widget
-from time import time
-from collections import deque
-
-class Notify(Widget):
-	requested_height = 1
-	max_size = 5
-	textcontainer = None
-
-	def __init__(self, win):
-		Widget.__init__(self, win)
-		self.textcontainer = deque(maxlen=self.max_size)
-
-	def poke(self):
-		for i in reversed(range(len(self.textcontainer))):
-			msg = self.textcontainer[i]
-			if msg.elapse and time() > msg.elapse:
-				msg.alive = False
-				del self.textcontainer[i]
-		self.requested_height = len(self.textcontainer) + 1
-
-	def draw(self):
-		import curses, socket, os
-
-		i = 0
-		for msg in self.textcontainer:
-			if i >= self.hei - 1:
-				break
-
-			how = msg.bad and 'bad' or 'good'
-			self.color_at(i, 0, self.wid,\
-					'in_notify', 'background', how)
-			self.color('in_notify', 'message', how)
-			self.addstr(i, 0, msg.text)
-			i += 1
-
-		self.color_reset()
-	
-	def display(self, text, duration=4, bad=False):
-		msg = Message(self.textcontainer, text, duration, bad)
-		self.textcontainer.append(msg)
-		return msg
-
-class Message(object):
-	elapse = None
-	text = None
-	bad = False
-	alive = True
-	container = None
-
-	def __init__(self, container, text, duration, bad):
-		self.text = text
-		self.bad = bad
-		self.container = container
-		self.set_duration(duration)
-	
-	def set_duration(self, n=4):
-		if n:
-			self.elapse = time() + n
-		else:
-			self.elapse = None
-
-	def delete(self):
-		self.alive = False
-		try:
-			self.container.remove(self)
-		except ValueError:
-			pass
diff --git a/ranger/gui/widgets/statusbar.py b/ranger/gui/widgets/statusbar.py
index 94e62d0b..af4870aa 100644
--- a/ranger/gui/widgets/statusbar.py
+++ b/ranger/gui/widgets/statusbar.py
@@ -13,33 +13,53 @@ from os import getuid
 from time import strftime, localtime
 
 from ranger.gui.bar import Bar
+from ranger import log
 
 class StatusBar(Widget):
 	__doc__ = __doc__
 	owners = {}
 	groups = {}
 	timeformat = '%Y-%m-%d %H:%M'
-	override = None
+	hint = None
+	msg = None
 
 	old_cf = None
 	old_mtime = None
+	old_hint = None
 	result = None
 
 	def __init__(self, win, column=None):
 		Widget.__init__(self, win)
 		self.column = column
 	
+	def notify(self, text, duration=4, bad=False):
+		self.msg = Message(text, duration, bad)
+	
 	def draw(self):
 		"""Draw the statusbar"""
 
-		# each item in the returned array looks like:
-		# [ list_with_color_tags,       string       ]
-		# [ ['permissions', 'allowed'], '-rwxr-xr-x' ]
+		log("a")
 
-		if self.override and isinstance(self.override, str):
-			self._draw_message()
+		if self.hint and isinstance(self.hint, str):
+			if self.old_hint != self.hint:
+				self.need_redraw = True
+			if self.need_redraw:
+				self._draw_hint()
 			return
 
+		if self.old_hint and not self.hint:
+			self.old_hint = None
+			self.need_redraw = True
+
+		if self.msg:
+			if self.msg.is_alive():
+				log("b")
+				self._draw_message()
+				return
+			else:
+				self.msg = None
+				self.need_redraw = True
+
 		try:
 			mtime = self.env.cf.stat.st_mtime
 		except:
@@ -69,12 +89,18 @@ class StatusBar(Widget):
 		bar.shrink_by_removing(self.wid)
 
 		self.result = bar.combine()
-
+	
 	def _draw_message(self):
+		self.win.erase()
+		self.color('in_statusbar', self.msg.bad and 'bad' or 'good')
+		self.addnstr(0, 0, self.msg.text, self.wid)
+
+	def _draw_hint(self):
+		self.win.erase()
 		highlight = True
 		space_left = self.wid
 		starting_point = self.x
-		for string in self.override.split('//'):
+		for string in self.hint.split('//'):
 			highlight = not highlight
 			if highlight:
 				self.color('in_statusbar', 'text', 'highlight')
@@ -82,7 +108,7 @@ class StatusBar(Widget):
 				self.color('in_statusbar', 'text')
 
 			try:
-				self.win.addnstr(self.y, starting_point, string, space_left)
+				self.addnstr(0, starting_point, string, space_left)
 			except:
 				break
 			space_left -= len(string)
@@ -183,3 +209,17 @@ class StatusBar(Widget):
 			self.color(*part.lst)
 			self.addstr(part.string)
 		self.color_reset()
+
+from time import time
+class Message(object):
+	elapse = None
+	text = None
+	bad = False
+
+	def __init__(self, text, duration, bad):
+		self.text = text
+		self.bad = bad
+		self.elapse = time() + duration
+	
+	def is_alive(self):
+		return time() <= self.elapse
mp;id=1b28ab9044ed5f076e2dfa65999c1c3cbbadc34f'>^
33352536 ^
09492d38 ^
33352536 ^
09492d38 ^


33352536 ^
09492d38 ^

33352536 ^
b1635a5c ^
33352536 ^

09492d38 ^


2104d1a7 ^
b1635a5c ^
33352536 ^

09492d38 ^
33352536 ^














09492d38 ^

33352536 ^
6070c23e ^
09492d38 ^
33352536 ^
6070c23e ^
09492d38 ^
33352536 ^

09492d38 ^
33352536 ^
09492d38 ^
33352536 ^
09492d38 ^
33352536 ^
4a4a392d ^
09492d38 ^

33352536 ^




b1635a5c ^
33352536 ^

09492d38 ^

8aeb85f0 ^



2104d1a7 ^
8aeb85f0 ^














2104d1a7 ^
8aeb85f0 ^
2104d1a7 ^
8aeb85f0 ^
2104d1a7 ^
8aeb85f0 ^

















































































































































































































fa786ea7 ^
8aeb85f0 ^









d1c9392a ^



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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504