1 |
commit: 575e47390093480f4b90e795bb2930fa6d85bb56 |
2 |
Author: Pawel Hajdan, Jr <phajdan.jr <AT> gentoo <DOT> org> |
3 |
AuthorDate: Thu Nov 3 11:00:23 2011 +0000 |
4 |
Commit: Paweł Hajdan <phajdan.jr <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Nov 3 11:00:23 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/arch-tools.git;a=commit;h=575e4739 |
7 |
|
8 |
Fix bugs resulting in ncurses-induced "crashes". |
9 |
|
10 |
--- |
11 |
bugzilla-viewer.py | 46 +++++++++++++++++++++++----------------------- |
12 |
1 files changed, 23 insertions(+), 23 deletions(-) |
13 |
|
14 |
diff --git a/bugzilla-viewer.py b/bugzilla-viewer.py |
15 |
index 48b253e..45584a5 100755 |
16 |
--- a/bugzilla-viewer.py |
17 |
+++ b/bugzilla-viewer.py |
18 |
@@ -160,12 +160,14 @@ class MainWindow: |
19 |
|
20 |
def init_screen(self): |
21 |
(self.height, self.width) = self.screen.getmaxyx() |
22 |
+ self.bugs_pad_width = self.width / 3 - 1 |
23 |
+ self.contents_pad_width = self.width - self.bugs_pad_width - 1 |
24 |
|
25 |
if self.height < 12 or self.width < 80: |
26 |
raise TermTooSmall() |
27 |
|
28 |
self.screen.border() |
29 |
- self.screen.vline(1, self.width / 3, curses.ACS_VLINE, self.height - 2) |
30 |
+ self.screen.vline(1, self.bugs_pad_width + 1, curses.ACS_VLINE, self.height - 2) |
31 |
self.screen.refresh() |
32 |
|
33 |
self.fill_bugs_pad() |
34 |
@@ -208,58 +210,56 @@ class MainWindow: |
35 |
self.bugs_pad.refresh( |
36 |
pos, 0, |
37 |
1, 1, |
38 |
- self.height - 2, self.width / 3 - 1) |
39 |
+ self.height - 2, self.bugs_pad_width) |
40 |
|
41 |
def fill_contents_pad(self): |
42 |
- width = 2 * self.width / 3 |
43 |
- |
44 |
bug = self.bugs[self.bugs_pad_pos] |
45 |
|
46 |
output = [] |
47 |
- output += textwrap.wrap(bug.summary(), width=width-2) |
48 |
- output.append("-" * (width - 2)) |
49 |
+ output += textwrap.wrap(bug.summary(), width=self.contents_pad_width-2) |
50 |
+ output.append("-" * (self.contents_pad_width - 2)) |
51 |
|
52 |
cpvs = bug.cpvs() |
53 |
if cpvs: |
54 |
- output += textwrap.wrap("Found package cpvs:", width=width-2) |
55 |
+ output += textwrap.wrap("Found package cpvs:", width=self.contents_pad_width-2) |
56 |
for cpv in cpvs: |
57 |
- output += textwrap.wrap(cpv, width=width-2) |
58 |
- output += textwrap.wrap("Press 'a' to add them to the stabilization queue.", width=width-2) |
59 |
- output.append("-" * (width - 2)) |
60 |
+ output += textwrap.wrap(cpv, width=self.contents_pad_width-2) |
61 |
+ output += textwrap.wrap("Press 'a' to add them to the stabilization queue.", width=self.contents_pad_width-2) |
62 |
+ output.append("-" * (self.contents_pad_width - 2)) |
63 |
|
64 |
deps = [self.bug_for_id(dep_id) for dep_id in bug.depends_on()] |
65 |
if deps: |
66 |
- output += textwrap.wrap("Depends on:", width=width-2) |
67 |
+ output += textwrap.wrap("Depends on:", width=self.contents_pad_width-2) |
68 |
for dep in deps: |
69 |
desc = "%d %s %s" % (dep.id_number(), dep.status(), dep.summary()) |
70 |
- output += textwrap.wrap(desc, width=width-2) |
71 |
- output.append("-" * (width - 2)) |
72 |
+ output += textwrap.wrap(desc, width=self.contents_pad_width-2) |
73 |
+ output.append("-" * (self.contents_pad_width - 2)) |
74 |
|
75 |
related = self.related_bugs[bug.id_number()] |
76 |
if related: |
77 |
- output += textwrap.wrap("Related bugs:", width=width-2) |
78 |
+ output += textwrap.wrap("Related bugs:", width=self.contents_pad_width-2) |
79 |
for related_bug in related: |
80 |
if str(related_bug['bugid']) == str(bug.id_number()): |
81 |
continue |
82 |
desc = related_bug['bugid'] + " " + related_bug['desc'] |
83 |
- output += textwrap.wrap(desc, width=width-2) |
84 |
- output.append("-" * (width - 2)) |
85 |
+ output += textwrap.wrap(desc, width=self.contents_pad_width-2) |
86 |
+ output.append("-" * (self.contents_pad_width - 2)) |
87 |
|
88 |
if bug.id_number() in repoman_dict and repoman_dict[bug.id_number()]: |
89 |
- output += textwrap.wrap("Repoman output:", width=width-2) |
90 |
+ output += textwrap.wrap("Repoman output:", width=self.contents_pad_width-2) |
91 |
lines = repoman_dict[bug.id_number()].split("\n") |
92 |
for line in lines: |
93 |
- output += textwrap.wrap(line, width=width-2) |
94 |
- output.append("-" * (width - 2)) |
95 |
+ output += textwrap.wrap(line, width=self.contents_pad_width-2) |
96 |
+ output.append("-" * (self.contents_pad_width - 2)) |
97 |
|
98 |
for comment in bug.comments(): |
99 |
for line in comment.split("\n"): |
100 |
- output += textwrap.wrap(line, width=width-2) |
101 |
- output.append("-" * (width - 2)) |
102 |
+ output += textwrap.wrap(line, width=self.contents_pad_width-2) |
103 |
+ output.append("-" * (self.contents_pad_width - 2)) |
104 |
|
105 |
self.contents_pad_length = len(output) |
106 |
|
107 |
- self.contents_pad = curses.newpad(max(self.contents_pad_length, self.height), width) |
108 |
+ self.contents_pad = curses.newpad(max(self.contents_pad_length, self.height), self.contents_pad_width) |
109 |
self.contents_pad.erase() |
110 |
|
111 |
self.contents_pad_pos = 0 |
112 |
@@ -280,7 +280,7 @@ class MainWindow: |
113 |
def refresh_contents_pad(self): |
114 |
self.contents_pad.refresh( |
115 |
self.contents_pad_pos, 0, |
116 |
- 1, self.width / 3 + 1, |
117 |
+ 1, self.bugs_pad_width + 2, |
118 |
self.height - 2, self.width - 2) |
119 |
self.screen.refresh() |