summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--code/directory.py15
-rw-r--r--code/fm.py4
-rw-r--r--code/fsobject.py9
-rw-r--r--code/ui.py6
-rw-r--r--ranger2
-rw-r--r--test/tc_directory.py3
6 files changed, 30 insertions, 9 deletions
diff --git a/code/directory.py b/code/directory.py
index ef68d35f..da7c0948 100644
--- a/code/directory.py
+++ b/code/directory.py
@@ -1,5 +1,5 @@
 import fsobject
-import file
+import file, debug
 
 class Directory(fsobject.FSObject):
 	def __init__(self, path):
@@ -19,10 +19,17 @@ class Directory(fsobject.FSObject):
 		self.content_loaded = True
 		import os
 		if self.exists:
-			self.filenames = os.listdir(self.path)
+			basenames = os.listdir(self.path)
+			mapped = map(lambda name: os.path.join(self.path, name), basenames)
+			self.filenames = list(mapped)
+			self.infostring = ' %d' % len(self.filenames)
+			debug.log('infostring set!')
 			self.files = []
 			for name in self.filenames:
-				f = file.File(name)
+				if os.path.isdir(name):
+					f = Directory(name)
+				else:
+					f = file.File(name)
 				f.load()
 				self.files.append(f)
 	
@@ -36,7 +43,7 @@ class Directory(fsobject.FSObject):
 	
 	def __getitem__(self, key):
 		if not self.accessible: raise fsobject.NotLoadedYet()
-		return self.filenames[key]
+		return self.files[key]
 
 if __name__ == '__main__':
 	d = Directory('.')
diff --git a/code/fm.py b/code/fm.py
index c2fe30a4..6631aee4 100644
--- a/code/fm.py
+++ b/code/fm.py
@@ -1,5 +1,5 @@
 import sys
-import ui, debug, directory
+import ui, debug, directory, fstype
 
 class FM():
 	def __init__(self, options, environment):
@@ -25,6 +25,8 @@ class FM():
 		try:
 			while 1:
 				try:
+#					if type(self.env.cf) is directory.Directory:
+#						self.env.cf.load_content_once()
 					self.ui.feed(self.env.directories, self.env.pwd, self.env.cf, self.env.termsize)
 					self.ui.draw()
 				except KeyboardInterrupt:
diff --git a/code/fsobject.py b/code/fsobject.py
index 1e194ac9..148976d2 100644
--- a/code/fsobject.py
+++ b/code/fsobject.py
@@ -17,6 +17,8 @@ class FSObject(object):
 		self.islink = False
 		self.brokenlink = False
 		self.stat = None
+		self.infostring = None
+		self.permissions = None
 		self.type = fstype.Unknown
 
 	# load() reads useful information about the file from the file system
@@ -34,10 +36,17 @@ class FSObject(object):
 
 			if os.path.isdir(self.path):
 				self.type = fstype.Directory
+				self.infostring = '--'
 			elif os.path.isfile(self.path):
 				self.type = fstype.File
+				self.infostring = ' %d' % self.stat.st_size
+			else:
+				self.type = fstype.Unknown
+				self.infostring = None
+
 		except OSError:
 			self.islink = False
+			self.infostring = None
 			self.type = fstype.Nonexistent
 			self.exists = False
 			self.accessible = False
diff --git a/code/ui.py b/code/ui.py
index 7d8fd828..3994d7ce 100644
--- a/code/ui.py
+++ b/code/ui.py
@@ -1,4 +1,4 @@
-import curses
+import curses, debug
 class UI():
 	def __init__(self, options):
 		self.scr = curses.initscr()
@@ -31,7 +31,9 @@ class UI():
 		import time
 		self.scr.erase()
 		for i in range(1, len(self.pwd)):
-			self.scr.addstr(i, 0, self.pwd[i])
+			f = self.pwd.files[i]
+			self.scr.addstr(i, 0, f.path)
+			if f.infostring: self.scr.addstr(i, 50, f.infostring)
 		self.scr.refresh()
 
 	def get_next_key(self):
diff --git a/ranger b/ranger
index 8e63ec86..4973e42f 100644
--- a/ranger
+++ b/ranger
@@ -15,7 +15,7 @@ def main():
 	import locale
 	locale.setlocale(locale.LC_ALL, 'en_US.utf8')
 
-	path = '.'
+	path = '..'
 	opt = options.get()
 	env = environment.Environment()
 
diff --git a/test/tc_directory.py b/test/tc_directory.py
index 69717ba2..f97f9913 100644
--- a/test/tc_directory.py
+++ b/test/tc_directory.py
@@ -1,7 +1,7 @@
 import unittest
 import sys, os
 sys.path.append('../code')
-import directory, fsobject, file
+import directory, fsobject, file, debug
 
 TESTDIR = os.path.realpath(os.path.join(os.path.dirname(sys.argv[0]), 'testdir'))
 TESTFILE = os.path.join(TESTDIR, 'testfile5234148')
@@ -30,6 +30,7 @@ class Test1(unittest.TestCase):
 		# Get the filenames you expect it to have and sort both before
 		# comparing. I don't expect any order after only loading the filenames.
 		assumed_filenames = os.listdir(TESTDIR)
+		assumed_filenames = list(map(lambda str: os.path.join(TESTDIR, str), assumed_filenames))
 		assumed_filenames.sort()
 		dir.filenames.sort()
 
m <vc@akkartik.com> 2015-05-17 02:22:41 -0700 1391 - avoid unsigned integers' href='/akkartik/mu/commit/035call.cc?h=hlt&id=ac0e9db526dc15cf91f4c45c4586ddcc19e9708c'>ac0e9db5 ^
ca01193d ^
363be37f ^
50eab110 ^



1fa53058 ^


ec926027 ^
31401373 ^
ec926027 ^



ca01193d ^
363be37f ^
69e14325 ^
5eb49929 ^
e2240eb4 ^

363be37f ^
77cdc6d0 ^

dd2e01e4 ^
77cdc6d0 ^

31401373 ^
d72f3799 ^
0b0cfb6f ^
7284d503 ^
67573caf ^




7284d503 ^

ac0e9db5 ^

31401373 ^
67573caf ^
ec926027 ^
7c8493b3 ^

31401373 ^
795f5244 ^
ec926027 ^
dcfca05e ^

31401373 ^
1fa53058 ^



795f5244 ^
dcfca05e ^
f89378d5 ^
2142ccfc ^

f3760b0f ^
1b76245c ^
2142ccfc ^

f1a6f323 ^
9cf71627 ^
5810092d ^
513bfed8 ^




2142ccfc ^
77cdc6d0 ^

dd2e01e4 ^
77cdc6d0 ^

012d2ee1 ^
af085cf6 ^




3eeea0a2 ^

9cf71627 ^
5f98a10c ^

1ead3562 ^
2cb36cd0 ^

5f98a10c ^
2cb36cd0 ^

5f98a10c ^
1ead3562 ^
2cb36cd0 ^

5f98a10c ^
2cb36cd0 ^
7284d503 ^
64cf0a59 ^
69e14325 ^


df8bb4c3 ^
f6d47435 ^
95b2a140 ^
5eb49929 ^
31401373 ^
795f5244 ^
5eb49929 ^

f1e953d0 ^
ec926027 ^

ac0e9db5 ^
2e8c5d39 ^
77cdc6d0 ^
dd2e01e4 ^
77cdc6d0 ^


31401373 ^
b75e94b3 ^
9fdda88b ^
5f98a10c ^
8eff7919 ^
f6d47435 ^
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