Make the ncurses unicode check earlier
and improve the message.
This commit is contained in:
parent
a2678b02d9
commit
1c5589bbd3
2 changed files with 27 additions and 14 deletions
|
@ -494,19 +494,6 @@ class Core(object):
|
|||
Init curses, create the first tab, etc
|
||||
"""
|
||||
self.stdscr = curses.initscr()
|
||||
if not hasattr(self.stdscr, 'get_wch'):
|
||||
curses.echo()
|
||||
curses.endwin()
|
||||
print('ERROR: The current python executable is linked with a '
|
||||
'ncurses version with no unicode capabilities.\nThis'
|
||||
' means python was built on a system where readline'
|
||||
' is linked against libncurses and not libncursesw.\n'
|
||||
'Please file a bug for your distribution or recompile'
|
||||
' libreadline with -ltermcapw instead of -ltermcap, '
|
||||
'and then recompile python.\nPoezio is currently unable'
|
||||
' to read your input or draw its interface properly, so'
|
||||
' it will now exit.')
|
||||
self.exit()
|
||||
self.init_curses(self.stdscr)
|
||||
self.call_for_resize()
|
||||
default_tab = tabs.RosterInfoTab()
|
||||
|
|
|
@ -19,6 +19,29 @@ sys.path.append(os.path.dirname(os.path.abspath(__file__)))
|
|||
|
||||
import singleton
|
||||
|
||||
def test_curses():
|
||||
"""
|
||||
Check if the system ncurses linked with python has unicode capabilities.
|
||||
"""
|
||||
import curses
|
||||
if hasattr(curses, 'unget_wch'):
|
||||
return True
|
||||
print("""\
|
||||
ERROR: The current python executable is linked with a ncurses version that \
|
||||
has no unicode capabilities.
|
||||
|
||||
This could mean that:
|
||||
- python was built on a system where readline is linked against \
|
||||
libncurses and not libncursesw
|
||||
- python was built without ncursesw headers available
|
||||
|
||||
Please file a bug for your distribution or fix that on your system and then \
|
||||
recompile python.
|
||||
Poezio is currently unable to read your input or draw its interface properly,\
|
||||
so it will now exit.""")
|
||||
return False
|
||||
|
||||
|
||||
def main():
|
||||
"""
|
||||
Enter point
|
||||
|
@ -75,4 +98,7 @@ def main():
|
|||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
if test_curses():
|
||||
main()
|
||||
else:
|
||||
sys.exit(1)
|
||||
|
|
Loading…
Reference in a new issue