[tor-commits] [nyx/master] Only provide curses.halfdelay() an int

atagar at torproject.org atagar at torproject.org
Tue Mar 22 17:10:28 UTC 2016


commit 06df1cf2c1a38f8ac4c7b0a638fc9bf715e46fb7
Author: Damian Johnson <atagar at torproject.org>
Date:   Tue Mar 22 10:03:34 2016 -0700

    Only provide curses.halfdelay() an int
    
    We added a min() call to ensure we weren't out of a valid range but this caused
    us to provide a float. This makes curses sad...
    
      Traceback (most recent call last):
        File "./run_nyx", line 8, in <module>
          nyx.main()
        File "/home/atagar/Desktop/nyx/nyx/__init__.py", line 56, 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 86, in main
          nyx.curses.start(nyx.controller.start_nyx, transparent_background = True, cursor = False)
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 169, in start
          curses.wrapper(_wrapper)
        File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
          return func(stdscr, *args, **kwds)
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 167, in _wrapper
          function()
        File "/home/atagar/Desktop/nyx/nyx/controller.py", line 370, in start_nyx
          confirmation_key = show_message(msg, BOLD, max_wait = 30)
        File "/home/atagar/Desktop/nyx/nyx/controller.py", line 63, in show_message
          return header_panel.show_message(message, *attr, **kwargs)
        File "/home/atagar/Desktop/nyx/nyx/panel/header.py", line 75, in show_message
          user_input = nyx.curses.key_input(kwargs['max_wait'])
        File "/home/atagar/Desktop/nyx/nyx/curses.py", line 214, in key_input
          curses.halfdelay(min(input_timeout, 25.5) * 10)
      TypeError: integer argument expected, got float
---
 nyx/curses.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/nyx/curses.py b/nyx/curses.py
index 4d9571b..3e88994 100644
--- a/nyx/curses.py
+++ b/nyx/curses.py
@@ -211,7 +211,7 @@ def key_input(input_timeout = None):
     # Timeout can't be longer than 25.5 seconds...
     # https://docs.python.org/2/library/curses.html?#curses.halfdelay
 
-    curses.halfdelay(min(input_timeout, 25.5) * 10)
+    curses.halfdelay(min(input_timeout * 10, 255))
   else:
     curses.cbreak()  # wait indefinitely for key presses (no timeout)
 





More information about the tor-commits mailing list