diff options
author | 2011-11-03 12:00:23 +0100 | |
---|---|---|
committer | 2011-11-03 12:00:23 +0100 | |
commit | 575e47390093480f4b90e795bb2930fa6d85bb56 (patch) | |
tree | 8459063eada9dfaa3bfa11aeaa4ac889257b44d0 | |
parent | Improvements for the bugzilla viewer: (diff) | |
download | arch-tools-575e47390093480f4b90e795bb2930fa6d85bb56.tar.gz arch-tools-575e47390093480f4b90e795bb2930fa6d85bb56.tar.bz2 arch-tools-575e47390093480f4b90e795bb2930fa6d85bb56.zip |
Fix bugs resulting in ncurses-induced "crashes".
-rwxr-xr-x | bugzilla-viewer.py | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/bugzilla-viewer.py b/bugzilla-viewer.py index 48b253e..45584a5 100755 --- a/bugzilla-viewer.py +++ b/bugzilla-viewer.py @@ -160,12 +160,14 @@ class MainWindow: def init_screen(self): (self.height, self.width) = self.screen.getmaxyx() + self.bugs_pad_width = self.width / 3 - 1 + self.contents_pad_width = self.width - self.bugs_pad_width - 1 if self.height < 12 or self.width < 80: raise TermTooSmall() self.screen.border() - self.screen.vline(1, self.width / 3, curses.ACS_VLINE, self.height - 2) + self.screen.vline(1, self.bugs_pad_width + 1, curses.ACS_VLINE, self.height - 2) self.screen.refresh() self.fill_bugs_pad() @@ -208,58 +210,56 @@ class MainWindow: self.bugs_pad.refresh( pos, 0, 1, 1, - self.height - 2, self.width / 3 - 1) + self.height - 2, self.bugs_pad_width) def fill_contents_pad(self): - width = 2 * self.width / 3 - bug = self.bugs[self.bugs_pad_pos] output = [] - output += textwrap.wrap(bug.summary(), width=width-2) - output.append("-" * (width - 2)) + output += textwrap.wrap(bug.summary(), width=self.contents_pad_width-2) + output.append("-" * (self.contents_pad_width - 2)) cpvs = bug.cpvs() if cpvs: - output += textwrap.wrap("Found package cpvs:", width=width-2) + output += textwrap.wrap("Found package cpvs:", width=self.contents_pad_width-2) for cpv in cpvs: - output += textwrap.wrap(cpv, width=width-2) - output += textwrap.wrap("Press 'a' to add them to the stabilization queue.", width=width-2) - output.append("-" * (width - 2)) + output += textwrap.wrap(cpv, width=self.contents_pad_width-2) + output += textwrap.wrap("Press 'a' to add them to the stabilization queue.", width=self.contents_pad_width-2) + output.append("-" * (self.contents_pad_width - 2)) deps = [self.bug_for_id(dep_id) for dep_id in bug.depends_on()] if deps: - output += textwrap.wrap("Depends on:", width=width-2) + output += textwrap.wrap("Depends on:", width=self.contents_pad_width-2) for dep in deps: desc = "%d %s %s" % (dep.id_number(), dep.status(), dep.summary()) - output += textwrap.wrap(desc, width=width-2) - output.append("-" * (width - 2)) + output += textwrap.wrap(desc, width=self.contents_pad_width-2) + output.append("-" * (self.contents_pad_width - 2)) related = self.related_bugs[bug.id_number()] if related: - output += textwrap.wrap("Related bugs:", width=width-2) + output += textwrap.wrap("Related bugs:", width=self.contents_pad_width-2) for related_bug in related: if str(related_bug['bugid']) == str(bug.id_number()): continue desc = related_bug['bugid'] + " " + related_bug['desc'] - output += textwrap.wrap(desc, width=width-2) - output.append("-" * (width - 2)) + output += textwrap.wrap(desc, width=self.contents_pad_width-2) + output.append("-" * (self.contents_pad_width - 2)) if bug.id_number() in repoman_dict and repoman_dict[bug.id_number()]: - output += textwrap.wrap("Repoman output:", width=width-2) + output += textwrap.wrap("Repoman output:", width=self.contents_pad_width-2) lines = repoman_dict[bug.id_number()].split("\n") for line in lines: - output += textwrap.wrap(line, width=width-2) - output.append("-" * (width - 2)) + output += textwrap.wrap(line, width=self.contents_pad_width-2) + output.append("-" * (self.contents_pad_width - 2)) for comment in bug.comments(): for line in comment.split("\n"): - output += textwrap.wrap(line, width=width-2) - output.append("-" * (width - 2)) + output += textwrap.wrap(line, width=self.contents_pad_width-2) + output.append("-" * (self.contents_pad_width - 2)) self.contents_pad_length = len(output) - self.contents_pad = curses.newpad(max(self.contents_pad_length, self.height), width) + self.contents_pad = curses.newpad(max(self.contents_pad_length, self.height), self.contents_pad_width) self.contents_pad.erase() self.contents_pad_pos = 0 @@ -280,7 +280,7 @@ class MainWindow: def refresh_contents_pad(self): self.contents_pad.refresh( self.contents_pad_pos, 0, - 1, self.width / 3 + 1, + 1, self.bugs_pad_width + 2, self.height - 2, self.width - 2) self.screen.refresh() |