Fix using the console in Windows, but only in command-line mode

This commit is contained in:
Andrew Resch 2009-12-10 01:26:26 +00:00
parent b9d2094a15
commit a4e8d1eb46
3 changed files with 13 additions and 3 deletions

View File

@ -33,7 +33,10 @@
#
#
try:
import curses
except ImportError:
pass
colors = [
'COLOR_BLACK',

View File

@ -185,11 +185,14 @@ class ConsoleUI(component.Component):
d.addCallback(on_connect)
self.coreconfig = CoreConfig()
if self.interactive:
if self.interactive and not deluge.common.windows_check():
# We use the curses.wrapper function to prevent the console from getting
# messed up if an uncaught exception is experienced.
import curses.wrapper
curses.wrapper(self.run)
elif self.interactive and deluge.common.windows_check():
print "You cannot run the deluge-console in interactive mode in Windows.\
Please use commands from the command line, eg: deluge-console config;help;exit"
else:
reactor.run()

View File

@ -34,7 +34,11 @@
#
import sys
try:
import curses
except ImportError:
pass
import colors
try:
import signal