summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Resch <andrewresch@gmail.com>2010-01-18 02:36:03 +0000
committerAndrew Resch <andrewresch@gmail.com>2010-01-18 02:36:03 +0000
commit4af387f774aac1146e09d39f9f77de228c50327f (patch)
tree4787fb4785df4168c278d1404dc2e4bdc29f915e
parenta62fdac0a6880ff2c8a2a1b22bb510934367ffea (diff)
downloaddeluge-4af387f774aac1146e09d39f9f77de228c50327f.tar.gz
deluge-4af387f774aac1146e09d39f9f77de228c50327f.tar.bz2
deluge-4af387f774aac1146e09d39f9f77de228c50327f.zip
Fix #1128 Show an error dialog when unable to start a 'deluged' process
-rw-r--r--ChangeLog4
-rw-r--r--deluge/ui/client.py12
-rw-r--r--deluge/ui/gtkui/connectionmanager.py31
3 files changed, 42 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index ea4e363ec..05ea58be4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+=== Deluge 1.2.1 ===
+==== GtkUI ====
+ * Fix #1128 Show an error dialog when unable to start a 'deluged' process
+
=== Deluge 1.2.0 - "Bursting like an infected kidney" (10 January 2010) ===
==== Core ====
* Fix file renaming
diff --git a/deluge/ui/client.py b/deluge/ui/client.py
index 7a3cde372..f76e44156 100644
--- a/deluge/ui/client.py
+++ b/deluge/ui/client.py
@@ -535,10 +535,15 @@ class Client(object):
"""
Starts a daemon process.
- :param port: int, the port for the daemon to listen on
- :param config: str, the path to the current config folder
+ :param port: the port for the daemon to listen on
+ :type port: int
+ :param config: the path to the current config folder
+ :type config: str
:returns: True if started, False if not
+ :rtype: bool
+ :raises OSError: received from subprocess.call()
+
"""
try:
if deluge.common.windows_check():
@@ -547,6 +552,9 @@ class Client(object):
subprocess.call(["nohup", "deluged", "--port=%s" % port, "--config=%s" % config])
else:
subprocess.call(["deluged", "--port=%s" % port, "--config=%s" % config])
+ except OSError, e:
+ log.exception(e)
+ raise e
except Exception, e:
log.error("Unable to start daemon!")
log.exception(e)
diff --git a/deluge/ui/gtkui/connectionmanager.py b/deluge/ui/gtkui/connectionmanager.py
index fa963fdac..554c57019 100644
--- a/deluge/ui/gtkui/connectionmanager.py
+++ b/deluge/ui/gtkui/connectionmanager.py
@@ -49,6 +49,7 @@ import deluge.ui.client
import deluge.ui.common
from deluge.configmanager import ConfigManager
from deluge.log import LOG as log
+import dialogs
DEFAULT_HOST = "127.0.0.1"
DEFAULT_PORT = 58846
@@ -396,6 +397,30 @@ class ConnectionManager(component.Component):
self.glade.get_widget("label_startdaemon").set_use_underline(
True)
+ def start_daemon(self, port, config):
+ """
+ Attempts to start a daemon process and will show an ErrorDialog if unable
+ to.
+ """
+ try:
+ return client.start_daemon(port, config)
+ except OSError, e:
+ if e.errno == 2:
+ dialogs.ErrorDialog(
+ _("Unable to start daemon!"),
+ _("Deluge cannot find the 'deluged' executable, it is likely \
+that you forgot to install the deluged package or it's not in your PATH.")).run()
+ else:
+ raise e
+ except Exception, e:
+ import traceback
+ import sys
+ tb = sys.exc_info()
+ dialogs.ErrorDialog(
+ _("Unable to start daemon!"),
+ _("Please examine the details for more information."),
+ details=traceback.format_exc(tb[2])).run()
+
# Signal handlers
def __on_connected(self, connector, host_id):
if self.gtkui_config["autoconnect"]:
@@ -423,7 +448,7 @@ class ConnectionManager(component.Component):
if status == _("Offline") and self.glade.get_widget("chk_autostart").get_active() and\
host in ("127.0.0.1", "localhost"):
# We need to start this localhost
- client.start_daemon(port, deluge.configmanager.get_config_dir())
+ self.start_daemon(port, deluge.configmanager.get_config_dir())
def on_connect_fail(result, try_counter):
log.error("Connection to host failed..")
@@ -504,7 +529,7 @@ class ConnectionManager(component.Component):
# There is nothing in the list, so lets create a localhost entry
self.add_host(DEFAULT_HOST, DEFAULT_PORT)
# ..and start the daemon.
- client.start_daemon(DEFAULT_PORT, deluge.configmanager.get_config_dir())
+ self.start_daemon(DEFAULT_PORT, deluge.configmanager.get_config_dir())
return
paths = self.hostlist.get_selection().get_selected_rows()[1]
@@ -538,7 +563,7 @@ class ConnectionManager(component.Component):
c.connect(host, port, user, password).addCallback(on_connect, c)
elif status == _("Offline"):
- client.start_daemon(port, deluge.configmanager.get_config_dir())
+ self.start_daemon(port, deluge.configmanager.get_config_dir())
reactor.callLater(2.0, self.__update_list)
def on_button_refresh_clicked(self, widget):