Changeset f8f9438


Ignore:
Timestamp:
01/18/2010 02:36:03 AM (16 years ago)
Author:
Andrew Resch <andrewresch@gmail.com>
Branches:
2.0.x, develop, extjs4-port, master
Children:
4420f2f
Parents:
e211b6f
Message:

Fix #1128 Show an error dialog when unable to start a 'deluged' process

Location:
deluge/ui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • deluge/ui/client.py

    re211b6f rf8f9438  
    536536        Starts a daemon process.
    537537
    538         :param port: int, the port for the daemon to listen on
    539         :param config: str, the path to the current config folder
     538        :param port: the port for the daemon to listen on
     539        :type port: int
     540        :param config: the path to the current config folder
     541        :type config: str
    540542        :returns: True if started, False if not
    541 
     543        :rtype: bool
     544
     545        :raises OSError: received from subprocess.call()
     546       
    542547        """
    543548        try:
     
    548553            else:
    549554                subprocess.call(["deluged", "--port=%s" % port, "--config=%s" % config])
     555        except OSError, e:
     556            log.exception(e)
     557            raise e
    550558        except Exception, e:
    551559            log.error("Unable to start daemon!")
  • deluge/ui/gtkui/connectionmanager.py

    re211b6f rf8f9438  
    5050from deluge.configmanager import ConfigManager
    5151from deluge.log import LOG as log
     52import dialogs
    5253
    5354DEFAULT_HOST = "127.0.0.1"
     
    397398            True)
    398399
     400    def start_daemon(self, port, config):
     401        """
     402        Attempts to start a daemon process and will show an ErrorDialog if unable
     403        to.
     404        """
     405        try:
     406            return client.start_daemon(port, config)
     407        except OSError, e:
     408            if e.errno == 2:
     409                dialogs.ErrorDialog(
     410                    _("Unable to start daemon!"),
     411                    _("Deluge cannot find the 'deluged' executable, it is likely \
     412that you forgot to install the deluged package or it's not in your PATH.")).run()
     413            else:
     414                raise e
     415        except Exception, e:
     416            import traceback
     417            import sys
     418            tb = sys.exc_info()
     419            dialogs.ErrorDialog(
     420                _("Unable to start daemon!"),
     421                _("Please examine the details for more information."),
     422                details=traceback.format_exc(tb[2])).run()
     423
    399424    # Signal handlers
    400425    def __on_connected(self, connector, host_id):
     
    424449            host in ("127.0.0.1", "localhost"):
    425450            # We need to start this localhost
    426             client.start_daemon(port, deluge.configmanager.get_config_dir())
     451            self.start_daemon(port, deluge.configmanager.get_config_dir())
    427452
    428453            def on_connect_fail(result, try_counter):
     
    505530            self.add_host(DEFAULT_HOST, DEFAULT_PORT)
    506531            # ..and start the daemon.
    507             client.start_daemon(DEFAULT_PORT, deluge.configmanager.get_config_dir())
     532            self.start_daemon(DEFAULT_PORT, deluge.configmanager.get_config_dir())
    508533            return
    509534
     
    539564
    540565        elif status == _("Offline"):
    541             client.start_daemon(port, deluge.configmanager.get_config_dir())
     566            self.start_daemon(port, deluge.configmanager.get_config_dir())
    542567            reactor.callLater(2.0, self.__update_list)
    543568
Note: See TracChangeset for help on using the changeset viewer.