summary refs log tree commit diff stats
path: root/code/wdisplay.py
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-11-25 17:55:34 +0100
committerhut <hut@lavabit.com>2009-11-25 17:55:34 +0100
commit5822dff7d91472bf2fc337c68f144e0ce1de09ae (patch)
tree7d40218b67f13c9c95141aa5bcb4aa292c42924a /code/wdisplay.py
parentcfbb8c84355f28bc7f669105f90c7aae0a972569 (diff)
downloadranger-5822dff7d91472bf2fc337c68f144e0ce1de09ae.tar.gz
implemented more stuff
Diffstat (limited to 'code/wdisplay.py')
-rw-r--r--code/wdisplay.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/code/wdisplay.py b/code/wdisplay.py
new file mode 100644
index 00000000..a564a6cb
--- /dev/null
+++ b/code/wdisplay.py
@@ -0,0 +1,34 @@
+import widget
+import curses
+import file, directory
+
+class WDisplay(widget.Widget):
+	def __init__(self, win, level):
+		widget.Widget.__init__(self,win)
+		self.level = level
+
+	def feed_env(self, env):
+		self.target = env.at_level(self.level)
+
+	def draw(self):
+		if type(self.target) == file.File:
+			self.draw_file()
+		elif type(self.target) == directory.Directory:
+			self.draw_directory()
+		elif self.target is None:
+			self.win.addnstr(self.y, self.x, "---", self.wid)
+		else:
+			self.win.addnstr(self.y, self.x, "unknown type.", self.wid)
+
+	def draw_file(self):
+		self.win.addnstr(self.y, self.x, "this is a file.", self.wid)
+
+	def draw_directory(self):
+		self.target.load_content_once()
+		for i in range(self.hei):
+			try:
+				f = self.target[i]
+			except IndexError:
+				break
+			self.win.addnstr(self.y + i, self.x, self.target[i].path, self.wid)
+
lavabit.com> 2009-12-31 03:40:08 +0100 committer hut <hut@lavabit.com> 2009-12-31 03:40:08 +0100 added documentation, clean up' href='/akspecs/ranger/commit/test/tc_displayable.py?h=v1.9.2&id=a6791aeef4c62960563882796d993873febe7b9c'>a6791aee ^
1159f9ec ^



a6791aee ^
1159f9ec ^


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