mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-06 16:38:43 +00:00
Fix #1128 Show an error dialog when unable to start a 'deluged' process
This commit is contained in:
parent
a62fdac0a6
commit
4af387f774
3 changed files with 42 additions and 5 deletions
|
@ -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) ===
|
=== Deluge 1.2.0 - "Bursting like an infected kidney" (10 January 2010) ===
|
||||||
==== Core ====
|
==== Core ====
|
||||||
* Fix file renaming
|
* Fix file renaming
|
||||||
|
|
|
@ -535,9 +535,14 @@ class Client(object):
|
||||||
"""
|
"""
|
||||||
Starts a daemon process.
|
Starts a daemon process.
|
||||||
|
|
||||||
:param port: int, the port for the daemon to listen on
|
:param port: the port for the daemon to listen on
|
||||||
:param config: str, the path to the current config folder
|
:type port: int
|
||||||
|
:param config: the path to the current config folder
|
||||||
|
:type config: str
|
||||||
:returns: True if started, False if not
|
:returns: True if started, False if not
|
||||||
|
:rtype: bool
|
||||||
|
|
||||||
|
:raises OSError: received from subprocess.call()
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
|
@ -547,6 +552,9 @@ class Client(object):
|
||||||
subprocess.call(["nohup", "deluged", "--port=%s" % port, "--config=%s" % config])
|
subprocess.call(["nohup", "deluged", "--port=%s" % port, "--config=%s" % config])
|
||||||
else:
|
else:
|
||||||
subprocess.call(["deluged", "--port=%s" % port, "--config=%s" % config])
|
subprocess.call(["deluged", "--port=%s" % port, "--config=%s" % config])
|
||||||
|
except OSError, e:
|
||||||
|
log.exception(e)
|
||||||
|
raise e
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.error("Unable to start daemon!")
|
log.error("Unable to start daemon!")
|
||||||
log.exception(e)
|
log.exception(e)
|
||||||
|
|
|
@ -49,6 +49,7 @@ import deluge.ui.client
|
||||||
import deluge.ui.common
|
import deluge.ui.common
|
||||||
from deluge.configmanager import ConfigManager
|
from deluge.configmanager import ConfigManager
|
||||||
from deluge.log import LOG as log
|
from deluge.log import LOG as log
|
||||||
|
import dialogs
|
||||||
|
|
||||||
DEFAULT_HOST = "127.0.0.1"
|
DEFAULT_HOST = "127.0.0.1"
|
||||||
DEFAULT_PORT = 58846
|
DEFAULT_PORT = 58846
|
||||||
|
@ -396,6 +397,30 @@ class ConnectionManager(component.Component):
|
||||||
self.glade.get_widget("label_startdaemon").set_use_underline(
|
self.glade.get_widget("label_startdaemon").set_use_underline(
|
||||||
True)
|
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
|
# Signal handlers
|
||||||
def __on_connected(self, connector, host_id):
|
def __on_connected(self, connector, host_id):
|
||||||
if self.gtkui_config["autoconnect"]:
|
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\
|
if status == _("Offline") and self.glade.get_widget("chk_autostart").get_active() and\
|
||||||
host in ("127.0.0.1", "localhost"):
|
host in ("127.0.0.1", "localhost"):
|
||||||
# We need to start this 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):
|
def on_connect_fail(result, try_counter):
|
||||||
log.error("Connection to host failed..")
|
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
|
# There is nothing in the list, so lets create a localhost entry
|
||||||
self.add_host(DEFAULT_HOST, DEFAULT_PORT)
|
self.add_host(DEFAULT_HOST, DEFAULT_PORT)
|
||||||
# ..and start the daemon.
|
# ..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
|
return
|
||||||
|
|
||||||
paths = self.hostlist.get_selection().get_selected_rows()[1]
|
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)
|
c.connect(host, port, user, password).addCallback(on_connect, c)
|
||||||
|
|
||||||
elif status == _("Offline"):
|
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)
|
reactor.callLater(2.0, self.__update_list)
|
||||||
|
|
||||||
def on_button_refresh_clicked(self, widget):
|
def on_button_refresh_clicked(self, widget):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue