Ignore curs_set(0) error

~sui has mentioned that botany always crashes for him with the stack trace:  
    Traceback (most recent call last):   File "/home/curiouser/botany/botany.py", line 543, in <module>     botany_menu == CursedMenu(my_plant,my_data)   File "/home/curiouser/botany/menu_screen.py", line 19, in __init__     curses.curs_set(0) _curses.error: curs_set() returned ERR

According to the docs, an error will be returned when the terminal does not support the visibility requested.
Appearently hiding the cursor is not supported in ~sui's terminal (cmder).

To keep botany as accesible as possible I suggest to ignore this error
pull/5/head
jmdejong 2017-05-28 21:44:08 +02:00 committed by GitHub
parent 934c632b13
commit f385b5601b
1 changed files with 7 additions and 1 deletions

View File

@ -16,7 +16,13 @@ class CursedMenu(object):
curses.noecho()
curses.raw()
curses.start_color()
try:
curses.curs_set(0)
except curses.error:
# Not all terminals support this functionality.
# When the error is ignored the screen will look a little uglier, but that's not terrible
# So in order to keep botany as accesible as possible to everyone, it should be safe to ignore the error.
pass
self.screen.keypad(1)
self.plant = this_plant
self.user_data = this_data