commit 6510514f5c3b15d663d71570c06e032eba28dea0 Author: Sambuddha Basu sambuddhabasu1@gmail.com Date: Fri May 6 21:51:46 2016 +0400
Event selection dialog loads events dynamically --- nyx/panel/log.py | 4 ++++ nyx/popups.py | 13 +++++++++++++ 2 files changed, 17 insertions(+)
diff --git a/nyx/panel/log.py b/nyx/panel/log.py index 278c633..f6c8d11 100644 --- a/nyx/panel/log.py +++ b/nyx/panel/log.py @@ -142,6 +142,9 @@ class LogPanel(nyx.panel.DaemonPanel): self._event_types = nyx.log.listen_for_events(self._register_tor_event, event_types) self.redraw(True)
+ def new_show_event_selection_prompt(self): + event_types = nyx.popups.new_select_event_types() + def show_snapshot_prompt(self): """ Lets user enter a path to take a snapshot, canceling if left blank. @@ -233,6 +236,7 @@ class LogPanel(nyx.panel.DaemonPanel): nyx.panel.KeyHandler('arrows', 'scroll up and down', _scroll, key_func = lambda key: key.is_scroll()), nyx.panel.KeyHandler('a', 'save snapshot of the log', self.show_snapshot_prompt), nyx.panel.KeyHandler('e', 'change logged events', self.show_event_selection_prompt), + nyx.panel.KeyHandler('w', 'new change logged events', self.new_show_event_selection_prompt), nyx.panel.KeyHandler('f', 'log regex filter', _pick_filter, 'enabled' if self._filter.selection() else 'disabled'), nyx.panel.KeyHandler('u', 'duplicate log entries', _toggle_deduplication, 'visible' if self._show_duplicates else 'hidden'), nyx.panel.KeyHandler('c', 'clear event log', _clear_log), diff --git a/nyx/popups.py b/nyx/popups.py index 01a5215..f0d4050 100644 --- a/nyx/popups.py +++ b/nyx/popups.py @@ -417,6 +417,19 @@ def select_event_types(): return None
+def new_select_event_types(): + def _render(subwindow): + subwindow.box() + subwindow.addstr(0, 0, 'Event Types:', HIGHLIGHT) + + events = nyx.tor_controller().get_info('events/names', None) + for i, line in enumerate(events.split()): + subwindow.addstr(1, i + 1, line) + + with nyx.curses.CURSES_LOCK: + nyx.curses.draw(_render, top = _top(), width = 80, height = 16) + return None + def confirm_save_torrc(torrc): """ Provides a confirmation dialog for saving tor's current configuration.
tor-commits@lists.torproject.org