summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2009-01-08 20:27:24 +0000
committerAndrew Resch <andrewresch@gmail.com>2009-01-08 20:27:24 +0000
commitb258a9c3407e1a49649f98b02e9f988dabbfed8f (patch)
treefe3a59bb7bc616d19a04a2e3bbe906f8f45f7d46
parentd8447aea72ee0606ca575e3c482e6468451ebdee (diff)
downloaddeluge-b258a9c3407e1a49649f98b02e9f988dabbfed8f.tar.gz
deluge-b258a9c3407e1a49649f98b02e9f988dabbfed8f.tar.bz2
deluge-b258a9c3407e1a49649f98b02e9f988dabbfed8f.zip
Added '-s', '--set-default-ui' option to deluge
-rw-r--r--ChangeLog5
-rw-r--r--deluge/main.py13
-rw-r--r--deluge/ui/ui.py32
3 files changed, 33 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index b47f201d9..b925f0abd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,13 +6,16 @@ Deluge 1.1.0_RC4 (In Development)
GtkUI:
* Fix translation setting in remove torrent dialog
* Fix notification bug on startup for already finished torrents
-
+
Ajaxui:
* Fix loading on iPods.
* Fix sorting on the name column.
* Add "Not Implemented" alerts to some functions.
* Improve the options tab on the Add Torrent dialog
+ Misc:
+ * Added '-s', '--set-default-ui' option to deluge
+
Deluge 1.1.0_RC3 (05 January 2009)
Core:
* Fix applying proxy settings
diff --git a/deluge/main.py b/deluge/main.py
index 5e065e60b..b087ffef4 100644
--- a/deluge/main.py
+++ b/deluge/main.py
@@ -34,6 +34,7 @@ import sys
from optparse import OptionParser
import deluge.common
+import deluge.configmanager
def start_ui():
"""Entry point for ui script"""
@@ -58,10 +59,22 @@ def start_ui():
help="Set the log level: none, info, warning, error, critical, debug", action="store", type="str")
parser.add_option("-q", "--quiet", dest="quiet",
help="Sets the log level to 'none', this is the same as `-L none`", action="store_true", default=False)
+ parser.add_option("-s", "--set-default-ui", dest="default_ui",
+ help="Sets the default UI to be run when no UI is specified", action="store", type="str")
# Get the options and args from the OptionParser
(options, args) = parser.parse_args()
+ if options.default_ui:
+ if options.config:
+ deluge.configmanager.set_config_dir(options.config)
+
+ config = deluge.configmanager.ConfigManager("ui.conf")
+ config["default_ui"] = options.default_ui
+ config.save()
+ print "The default UI has been changed to", options.default_ui
+ sys.exit(0)
+
if options.quiet:
options.loglevel = "none"
diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py
index 5f4ac949a..a937f1c1e 100644
--- a/deluge/ui/ui.py
+++ b/deluge/ui/ui.py
@@ -48,19 +48,19 @@ class UI:
config.save()
del config
- if selected_ui == "gtk":
- log.info("Starting GtkUI..")
- from deluge.ui.gtkui.gtkui import GtkUI
- ui = GtkUI(args)
- elif selected_ui == "web":
- log.info("Starting WebUI..")
- from deluge.ui.webui.webui import WebUI
- ui = WebUI(args)
- elif selected_ui == "null":
- log.info("Starting NullUI..")
- from deluge.ui.null.deluge_shell import NullUI
- ui = NullUI(args)
- elif selected_ui == "console":
- log.info("Starting ConsoleUI..")
- from deluge.ui.console.main import ConsoleUI
- ui = ConsoleUI(ui_args).run()
+ try:
+ if selected_ui == "gtk":
+ log.info("Starting GtkUI..")
+ from deluge.ui.gtkui.gtkui import GtkUI
+ ui = GtkUI(args)
+ elif selected_ui == "web":
+ log.info("Starting WebUI..")
+ from deluge.ui.webui.webui import WebUI
+ ui = WebUI(args)
+ elif selected_ui == "console":
+ log.info("Starting ConsoleUI..")
+ from deluge.ui.console.main import ConsoleUI
+ ui = ConsoleUI(ui_args).run()
+ except ImportError:
+ log.error("Unable to find the requested UI. Please select a different UI with the '-u' option or alternatively use the '-s' option to select a different default UI.")
+ sys.exit(0)