[tor-commits] [nyx/master] Popup for writing torrc caused stacktrace

atagar at torproject.org atagar at torproject.org
Mon Jan 4 17:43:05 UTC 2016


commit 395c7aaf9ae8431bfda5f2846380f4d560aa1131
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Dec 8 09:19:01 2015 -0800

    Popup for writing torrc caused stacktrace
    
    The popup wasn't updated to use the new method of nyx.popup...
    
      Traceback (most recent call last):
        File "./run_nyx", line 8, in <module>
          nyx.main()
        File "/home/atagar/Desktop/nyx/nyx/__init__.py", line 31, in main
          nyx.starter.main()
        File "/home/atagar/Desktop/nyx/stem/util/conf.py", line 289, in wrapped
          return func(*args, config = config, **kwargs)
        File "/home/atagar/Desktop/nyx/nyx/starter.py", line 89, in main
          curses.wrapper(nyx.controller.start_nyx)
        File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
          return func(stdscr, *args, **kwds)
        File "/home/atagar/Desktop/nyx/nyx/controller.py", line 624, in start_nyx
          is_keystroke_consumed = panel_impl.handle_key(key)
        File "/home/atagar/Desktop/nyx/nyx/config_panel.py", line 303, in handle_key
          self.show_write_dialog()
        File "/home/atagar/Desktop/nyx/nyx/config_panel.py", line 318, in show_write_dialog
          popup, width, height = nyx.popups.init(len(config_lines) + 2)
      AttributeError: 'module' object has no attribute 'init'
---
 nyx/config_panel.py |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/nyx/config_panel.py b/nyx/config_panel.py
index 1a3a836..cc23e4e 100644
--- a/nyx/config_panel.py
+++ b/nyx/config_panel.py
@@ -315,12 +315,11 @@ class ConfigPanel(panel.Panel):
     # display a popup for saving the current configuration
 
     config_lines = tor_config.get_custom_options(True)
-    popup, width, height = nyx.popups.init(len(config_lines) + 2)
 
-    if not popup:
-      return
+    with nyx.popups.popup_window(len(config_lines) + 2) as (popup, width, height):
+      if not popup:
+        return
 
-    try:
       # displayed options (truncating the labels if there's limited room)
 
       if width >= 30:
@@ -434,8 +433,6 @@ class ConfigPanel(panel.Panel):
             msg = 'Unable to save configuration (%s)' % exc.strerror
 
           nyx.popups.show_msg(msg, 2)
-    finally:
-      nyx.popups.finalize()
 
   def get_help(self):
     return [





More information about the tor-commits mailing list