commit 9757d781c0c2dfb6498e24626451385f5ecd7039 Author: Damian Johnson atagar@torproject.org Date: Sun Jun 19 15:19:53 2011 -0700
fix: dropping tor version if started disconnected
When we start without a tor instance it looks a little weird to display "Tor Unknown (Unknown)"
in the header panel. Opting to leave this blank instead. --- src/cli/headerPanel.py | 13 +++++++------ 1 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/src/cli/headerPanel.py b/src/cli/headerPanel.py index 733abad..846c1db 100644 --- a/src/cli/headerPanel.py +++ b/src/cli/headerPanel.py @@ -173,12 +173,13 @@ class HeaderPanel(panel.Panel, threading.Thread):
contentSpace = leftWidth - 43 if 7 + len(self.vals["tor/version"]) + len(self.vals["tor/versionStatus"]) <= contentSpace: - versionColor = VERSION_STATUS_COLORS[self.vals["tor/versionStatus"]] if \ - self.vals["tor/versionStatus"] in VERSION_STATUS_COLORS else "white" - labelPrefix = "Tor %s (" % self.vals["tor/version"] - self.addstr(0, 43, labelPrefix) - self.addstr(0, 43 + len(labelPrefix), self.vals["tor/versionStatus"], uiTools.getColor(versionColor)) - self.addstr(0, 43 + len(labelPrefix) + len(self.vals["tor/versionStatus"]), ")") + if self.vals["tor/version"] != "Unknown": + versionColor = VERSION_STATUS_COLORS[self.vals["tor/versionStatus"]] if \ + self.vals["tor/versionStatus"] in VERSION_STATUS_COLORS else "white" + labelPrefix = "Tor %s (" % self.vals["tor/version"] + self.addstr(0, 43, labelPrefix) + self.addstr(0, 43 + len(labelPrefix), self.vals["tor/versionStatus"], uiTools.getColor(versionColor)) + self.addstr(0, 43 + len(labelPrefix) + len(self.vals["tor/versionStatus"]), ")") elif 11 <= contentSpace: self.addstr(0, 43, uiTools.cropStr("Tor %s" % self.vals["tor/version"], contentSpace, 4))