about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-12-15 11:15:01 +0100
committerhut <hut@lavabit.com>2009-12-15 11:15:01 +0100
commit705c14a48645f6e7e4b318a5a3f4f7a6c7b96c80 (patch)
treea1ed4ff7ed6e596857cc737a84e19e57772e211d
parentcfdbb9d634555f7c036861266e308b512f0baeac (diff)
downloadranger-705c14a48645f6e7e4b318a5a3f4f7a6c7b96c80.tar.gz
different way of squeezing the last column
-rw-r--r--ranger/gui/widgets/filelistcontainer.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/ranger/gui/widgets/filelistcontainer.py b/ranger/gui/widgets/filelistcontainer.py
index fa4ec989..cc45f2c9 100644
--- a/ranger/gui/widgets/filelistcontainer.py
+++ b/ranger/gui/widgets/filelistcontainer.py
@@ -8,6 +8,7 @@ class FileListContainer(Widget, DisplayableContainer):
 	ratios = None
 	preview = True
 	preview_available = True
+	stretch_ratios = None
 
 	def __init__(self, win, ratios, preview = True):
 		DisplayableContainer.__init__(self, win)
@@ -18,6 +19,11 @@ class FileListContainer(Widget, DisplayableContainer):
 		# normalize ratios:
 		ratio_sum = float(reduce(lambda x,y: x + y, ratios))
 		self.ratios = tuple(map(lambda x: x / ratio_sum, ratios))
+
+		if self.ratios >= 2:
+			self.stretch_ratios = self.ratios[:-2] + \
+					((self.ratios[-2] + self.ratios[-1] * 0.9), \
+					(self.ratios[-1] * 0.1))
 		
 		offset = 1 - len(ratios)
 		if preview: offset += 1
@@ -39,21 +45,25 @@ class FileListContainer(Widget, DisplayableContainer):
 		DisplayableContainer.resize(self, y, x, hei, wid)
 		left = self.x
 
-		cut_off_last = self.preview and not self.preview_available
+		cut_off_last = self.preview and not self.preview_available \
+				and self.stretch_ratios
 
 		if cut_off_last:
-			generator = zip(self.ratios[:-1], range(len(self.ratios)-1))
+			generator = zip(self.stretch_ratios, range(len(self.ratios)))
 		else:
 			generator = zip(self.ratios, range(len(self.ratios)))
 
 		for ratio, i in generator:
 			wid = int(ratio * self.wid)
-			if cut_off_last and i == len(self.ratios) - 2:
-				wid += int(self.ratios[-1] * self.wid)
+
+			if i == len(self.ratios) - 1:
+				wid = int(self.wid - left + 1)
+
 			try:
 				self.container[i].resize(self.y, left, hei, max(1, wid-1))
 			except KeyError:
 				pass
+
 			left += wid
 	
 	def poke(self):
x?h=hlt&id=ea7f869856a614d14de31c680c8dd290de1cc113'>^
a49bc413 ^
ee9a9237 ^


6ff9ce26 ^
8188bbbc ^
7a583220 ^
bf02a19d ^

56102844 ^
8a73e0d1 ^
56102844 ^

931b17da ^
56102844 ^


33352536 ^
8188bbbc ^
1639687b ^
bf02a19d ^
33352536 ^
6070c23e ^
bf02a19d ^

ee9a9237 ^
6030d7e2 ^
33352536 ^
ee9a9237 ^
71ee78f2 ^
ee9a9237 ^
33352536 ^
2a2a5b1e ^

6070c23e ^
bf02a19d ^
6030d7e2 ^
604c8315 ^
282681c7 ^

03d50cc8 ^
c0bde5f8 ^
604c8315 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
c0bde5f8 ^





























33352536 ^

282681c7 ^
7dac9ade ^
6ff9ce26 ^
71eb22a5 ^
7a583220 ^
33352536 ^


518429b1 ^
33352536 ^
33352536 ^
6030d7e2 ^
71eb22a5 ^
33352536 ^
3c1bc4fc ^
71eb22a5 ^
ee9a9237 ^
33352536 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^
33352536 ^
6030d7e2 ^
04be5eb2 ^
7a583220 ^
33352536 ^


6030d7e2 ^
6ff9ce26 ^
03d50cc8 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^

ee9a9237 ^
6030d7e2 ^

33352536 ^
ee9a9237 ^
6030d7e2 ^
ee9a9237 ^
33352536 ^
6030d7e2 ^

d48cfd0f ^
ee9a9237 ^
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