
commit 9f77a2d3d2085198a85fd4957d8df1337a2a8715 Author: Damian Johnson <atagar@torproject.org> Date: Mon Jan 18 08:57:39 2016 -0800 Drop unused torrc panel config option More config options nobody's probably ever used (or wanted). --- nyx/torrc_panel.py | 20 ++++---------------- nyx/util/tor_config.py | 8 ++------ nyxrc.sample | 3 --- 3 files changed, 6 insertions(+), 25 deletions(-) diff --git a/nyx/torrc_panel.py b/nyx/torrc_panel.py index f312553..4248ae0 100644 --- a/nyx/torrc_panel.py +++ b/nyx/torrc_panel.py @@ -6,23 +6,12 @@ import math import curses import threading -import nyx.popups - from nyx.util import expand_path, panel, tor_config, tor_controller, ui_tools from stem.control import State -from stem.util import conf, log, str_tools - - -def conf_handler(key, value): - if key == 'features.config.file.max_lines_per_entry': - return max(1, value) - +from stem.util import log, str_tools -CONFIG = conf.config_dict('nyx', { - 'features.config.file.showScrollbars': True, - 'features.config.file.max_lines_per_entry': 8, -}, conf_handler) +MAX_WRAP_PER_LINE = 8 class TorrcPanel(panel.Panel): @@ -173,7 +162,7 @@ class TorrcPanel(panel.Panel): scroll_offset = 0 - if CONFIG['features.config.file.showScrollbars'] and self._last_content_height > height - 1: + if self._last_content_height > height - 1: scroll_offset = 3 self.add_scroll_bar(self.scroll, self.scroll + height - 1, self._last_content_height, 1) @@ -264,7 +253,6 @@ class TorrcPanel(panel.Panel): # draws the rest of the components with line wrap cursor_location, line_offset = line_number_offset + scroll_offset, 0 - max_lines_per_entry = CONFIG['features.config.file.max_lines_per_entry'] display_queue = [line_comp[entry] for entry in ('option', 'argument', 'correction', 'comment')] while display_queue: @@ -275,7 +263,7 @@ class TorrcPanel(panel.Panel): if len(msg) >= max_msg_size: # message is too long - break it up - if line_offset == max_lines_per_entry - 1: + if line_offset == MAX_WRAP_PER_LINE - 1: msg = str_tools.crop(msg, max_msg_size) else: include_break = True diff --git a/nyx/util/tor_config.py b/nyx/util/tor_config.py index 7bc462b..22abff7 100644 --- a/nyx/util/tor_config.py +++ b/nyx/util/tor_config.py @@ -2,13 +2,9 @@ Helper functions for working with tor's configuration file. """ -import threading +from nyx.util import tor_controller -import stem.version - -from nyx.util import tor_controller, ui_tools - -from stem.util import conf, enum, log, str_tools, system +from stem.util import conf, enum, str_tools, system CONFIG = conf.config_dict('nyx', { 'features.torrc.validate': True, diff --git a/nyxrc.sample b/nyxrc.sample index 03dd833..64eb7a3 100644 --- a/nyxrc.sample +++ b/nyxrc.sample @@ -104,15 +104,12 @@ features.log.maxRefreshRate 300 # state.showVirtualOptions # virtual options are placeholders for other option groups, never having # values or being setable themselves -# file.showScrollbars -# displays scrollbars when the torrc content is longer than the display # file.maxLinesPerEntry # max number of lines to display for a single entry in the torrc features.config.order MAN_PAGE_ENTRY, NAME, IS_SET features.config.state.showPrivateOptions false features.config.state.showVirtualOptions false -features.config.file.showScrollbars true features.config.file.maxLinesPerEntry 8 # Descriptions for tor's configuration options can be loaded from its man page