From a4e8d1eb462f54883c9ae46e2ee2eb6dfd71c88d Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Thu, 10 Dec 2009 01:26:26 +0000 Subject: [PATCH] Fix using the console in Windows, but only in command-line mode --- deluge/ui/console/colors.py | 5 ++++- deluge/ui/console/main.py | 5 ++++- deluge/ui/console/screen.py | 6 +++++- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/deluge/ui/console/colors.py b/deluge/ui/console/colors.py index ab01915a1..3b9455446 100644 --- a/deluge/ui/console/colors.py +++ b/deluge/ui/console/colors.py @@ -33,7 +33,10 @@ # # -import curses +try: + import curses +except ImportError: + pass colors = [ 'COLOR_BLACK', diff --git a/deluge/ui/console/main.py b/deluge/ui/console/main.py index 11d74fee4..68fb3bba1 100644 --- a/deluge/ui/console/main.py +++ b/deluge/ui/console/main.py @@ -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() diff --git a/deluge/ui/console/screen.py b/deluge/ui/console/screen.py index 998a91f74..aa13cdeba 100644 --- a/deluge/ui/console/screen.py +++ b/deluge/ui/console/screen.py @@ -34,7 +34,11 @@ # import sys -import curses +try: + import curses +except ImportError: + pass + import colors try: import signal