Skip to content

Commit 0acde54

Browse files
committed
- calculation fixes for display cols
Change-Id: Ie9dc492c8544ec91d637653a473f15dceda18f8e
1 parent 1270028 commit 0acde54

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

sqlalchemy_collectd/connmon/display.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,20 @@ def _calc_x_positions(self, display):
9898
x = 0
9999
widths = []
100100
midline = False
101-
for idx, col in enumerate(self.columns):
102-
cname = col[0]
103-
width = col[2]
104-
just = col[3]
101+
for idx, (cname, _, col_width, just) in enumerate(self.columns):
105102
charwidth = max(
106-
_text_width(cname), int(display._winsize[1] * width)
103+
_text_width(cname), int(display._winsize[1] * col_width)
107104
)
108105
if just == "L":
109106
widths.append((x, charwidth))
110107
x += charwidth
111108
else:
112109
width = sum(
113-
max(_text_width(cname), int(display._winsize[1] * width))
114-
for col in self.columns[idx:]
110+
max(
111+
_text_width(r_cname),
112+
int(display._winsize[1] * r_col_width),
113+
)
114+
for (r_cname, _, r_col_width, _) in self.columns[idx:]
115115
)
116116
x = display._winsize[1] - width
117117
if not midline:
@@ -193,9 +193,9 @@ def render(self, display, now):
193193

194194
class ProgStatsLayout(StatLayout):
195195
columns = [
196-
("hostname\n(#R&[dis]#G&connected#d&)", "%s", 0.12, "L"),
196+
("hostname\n(#R&[dis]#G&connected#d&)", "%s", 0.18, "L"),
197197
("progname", "%s", 0.15, "L"),
198-
("last msg\nsecs / int", "%s/%3d", 0.15, "R"),
198+
("last msg\nsecs / int", "%s/%3d", 0.10, "R"),
199199
("processes\ncurr / max", "%4d/%4d", 0.15, "R"),
200200
("connections\ncurr / max / int", "%4d/%4d/%4d", 0.15, "R"),
201201
("checkouts\ncurr / max / int", "%4d/%4d/%4d", 0.15, "R"),

0 commit comments

Comments
 (0)