Exemplo n.º 1
0
    def setUp(self):  # NOQA
        defer.setDebugging(True)
        tests_common.set_tmp_config_dir()
        client.start_classic_mode()

        self.log = Logger()
        self.gtkui = GtkUI("YaRSS2")
        self.gtkui.create_ui()
Exemplo n.º 2
0
    def _on_reactor_start(self):
        log.debug("_on_reactor_start")
        self.mainwindow.first_show()

        if self.config["classic_mode"]:

            def on_dialog_response(response):
                if response != gtk.RESPONSE_YES:
                    # The user does not want to turn Classic Mode off, so just quit
                    reactor.stop()
                    return
                # Turning off classic_mode
                self.config["classic_mode"] = False
                self.__start_non_classic()

            try:
                client.start_classic_mode()
            except deluge.error.DaemonRunningError:
                d = dialogs.YesNoDialog(
                    _("Turn off Classic Mode?"),
                    _("It appears that a Deluge daemon process (deluged) is already running.\n\n\
You will either need to stop the daemon or turn off Classic Mode to continue.")
                ).run()

                self.started_in_classic = False
                d.addCallback(on_dialog_response)
            except Exception, e:
                import traceback
                tb = sys.exc_info()
                ed = dialogs.ErrorDialog(
                    _("Error Starting Core"),
                    _("There was an error starting the core component which is required to run Deluge in Classic Mode.\n\n\
Please see the details below for more information."),
                    details=traceback.format_exc(tb[2])).run()

                def on_ed_response(response):
                    d = dialogs.YesNoDialog(
                        _("Turn off Classic Mode?"),
                        _("Since there was an error starting in Classic Mode would you like to continue by turning it off?"
                          )).run()
                    self.started_in_classic = False
                    d.addCallback(on_dialog_response)

                ed.addCallback(on_ed_response)
            else:
                component.start()
                return
Exemplo n.º 3
0
    def _on_reactor_start(self):
        log.debug("_on_reactor_start")
        self.mainwindow.first_show()

        if self.config["classic_mode"]:

            def on_dialog_response(response):
                if response != gtk.RESPONSE_YES:
                    # The user does not want to turn Classic Mode off, so just quit
                    self.mainwindow.quit()
                    return
                # Turning off classic_mode
                self.config["classic_mode"] = False
                self.__start_non_classic()

            try:
                client.start_classic_mode()
            except deluge.error.DaemonRunningError:
                d = dialogs.YesNoDialog(
                    _("Turn off Classic Mode?"),
                    _("It appears that a Deluge daemon process (deluged) is already running.\n\n\
You will either need to stop the daemon or turn off Classic Mode to continue.")).run()

                self.started_in_classic = False
                d.addCallback(on_dialog_response)
            except Exception, e:
                import traceback
                tb = sys.exc_info()
                ed = dialogs.ErrorDialog(
                    _("Error Starting Core"),
                    _("There was an error starting the core component which is required to run Deluge in Classic Mode.\n\n\
Please see the details below for more information."), details=traceback.format_exc(tb[2])).run()
                def on_ed_response(response):
                    d = dialogs.YesNoDialog(
                        _("Turn off Classic Mode?"),
                        _("Since there was an error starting in Classic Mode would you like to continue by turning it off?")).run()
                    self.started_in_classic = False
                    d.addCallback(on_dialog_response)
                ed.addCallback(on_ed_response)
            else:
                component.start()
                return
Exemplo n.º 4
0
    def _on_reactor_start(self):
        log.debug("_on_reactor_start")
        self.mainwindow.first_show()

        if self.config["classic_mode"]:

            def on_dialog_response(response):
                if response != Gtk.ResponseType.YES:
                    # The user does not want to turn Classic Mode off, so just quit
                    self.mainwindow.quit()
                    return
                # Turning off classic_mode
                self.config["classic_mode"] = False
                self.__start_non_classic()

            try:
                try:
                    client.start_classic_mode()
                except deluge.error.DaemonRunningError:
                    d = dialogs.YesNoDialog(
                        _("Turn off Classic Mode?"),
                        _("It appears that a Deluge daemon process (deluged) is already running.\n\n\
You will either need to stop the daemon or turn off Classic Mode to continue.")
                    ).run()
                    self.started_in_classic = False
                    d.addCallback(on_dialog_response)
                except ImportError, e:
                    if "No module named libtorrent" in e.message:
                        d = dialogs.YesNoDialog(
                            _("Enable Thin Client Mode?"),
                            _("Thin client mode is only available because libtorrent is not installed.\n\n\
To use Deluge standalone (Classic mode) please install libtorrent.")).run()
                        self.started_in_classic = False
                        d.addCallback(on_dialog_response)
                    else:
                        raise
                else:
                    component.start()
                    return
Exemplo n.º 5
0
    def _start_classic(self):
        try:
            client.start_classic_mode()
        except Exception, e:
            from deluge.error import DaemonRunningError

            mb = QtGui.QMessageBox(standardButtons=QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
            mb.setDefaultButton(QtGui.QMessageBox.No)
            if isinstance(e, DaemonRunningError):
                mb.setWindowTitle(_("Turn off Classic Mode?"))
                mb.setText(_("It appears that a Deluge daemon process (deluged) is already running.\n\nYou will either need to stop the daemon or turn off Classic Mode to continue."))
                mb.setIcon(QtGui.QMessageBox.Question)
            else:
                mb.setWindowTitle(_("Error Starting Core"))
                mb.setText(_("There was an error starting the core component which is required to run Deluge in Classic Mode.\n\nPlease see the details below for more information."))
                mb.setInformativeText(_("Since there was an error starting in Classic Mode would you like to continue by turning it off?"))
                mb.setIcon(QtGui.QMessageBox.Warning)
                import traceback
                mb.setDetailedText(traceback.format_exc())
            if mb.exec_() == QtGui.QMessageBox.Yes:
                self._start_thin()
            else:
                reactor.stop()
Exemplo n.º 6
0
    def _on_reactor_start(self):
        log.debug("_on_reactor_start")
        self.mainwindow.first_show()

        if self.config["classic_mode"]:

            def on_dialog_response(response):
                if response != gtk.RESPONSE_YES:
                    # The user does not want to turn Classic Mode off, so just quit
                    self.mainwindow.quit()
                    return
                # Turning off classic_mode
                self.config["classic_mode"] = False
                self.__start_non_classic()
            try:
                try:
                    client.start_classic_mode()
                except deluge.error.DaemonRunningError:
                    d = dialogs.YesNoDialog(
                        _("Turn off Classic Mode?"),
                        _("It appears that a Deluge daemon process (deluged) is already running.\n\n\
You will either need to stop the daemon or turn off Classic Mode to continue.")).run()
                    self.started_in_classic = False
                    d.addCallback(on_dialog_response)
                except ImportError, e:
                    if "No module named libtorrent" in e.message:
                        d = dialogs.YesNoDialog(
                        _("Enable Thin Client Mode?"),
                        _("Thin client mode is only available because libtorrent is not installed.\n\n\
To use Deluge standalone (Classic mode) please install libtorrent.")).run()
                        self.started_in_classic = False
                        d.addCallback(on_dialog_response)
                    else:
                        raise
                else:
                    component.start()
                    return