示例#1
0
    def setUp(self):  # NOQA
        defer.setDebugging(True)
        tests_common.set_tmp_config_dir()
        client.start_standalone()

        self.log = logging.getLogger(plugin_tests_logger_name)
        self.gtkui = GtkUI("YaRSS2")
        self.gtkui.create_ui()
示例#2
0
    def _on_reactor_start(self):
        log.debug('_on_reactor_start')
        self.mainwindow.first_show()

        if not self.config['standalone']:
            return self._start_thinclient()

        err_msg = ''
        try:
            client.start_standalone()
        except DaemonRunningError:
            err_msg = _(
                'A Deluge daemon (deluged) is already running.\n'
                'To use Standalone mode, stop local daemon and restart Deluge.'
            )
        except LibtorrentImportError as ex:
            if 'libtorrent library not found' in str(ex):
                err_msg = _(
                    'Only Thin Client mode is available because libtorrent is not installed.\n'
                    'To use Standalone mode, please install libtorrent package.'
                )
            else:
                log.exception(ex)
                err_msg = _(
                    'Only Thin Client mode is available due to libtorrent import error: %s\n'
                    'To use Standalone mode, please see logs for error details.'
                    % (str(ex)))

        except ImportError as ex:
            log.exception(ex)
            err_msg = _(
                'Only Thin Client mode is available due to unknown Import Error.\n'
                'To use Standalone mode, please see logs for error details.')
        except Exception as ex:
            log.exception(ex)
            err_msg = _(
                'Only Thin Client mode is available due to unknown Import Error.\n'
                'To use Standalone mode, please see logs for error details.')
        else:
            component.start()
            return

        def on_dialog_response(response):
            """User response to switching mode dialog."""
            if response == ResponseType.YES:
                # Turning off standalone
                self.config['standalone'] = False
                self._start_thinclient()
            else:
                # User want keep Standalone Mode so just quit.
                self.mainwindow.quit()

        # An error occurred so ask user to switch from Standalone to Thin Client mode.
        err_msg += '\n\n' + _('Continue in Thin Client mode?')
        d = YesNoDialog(_('Change User Interface Mode'), err_msg).run()
        d.addCallback(on_dialog_response)
示例#3
0
    def setUp(self):  # NOQA
        # Must override callLater to avoid unclean twisted reactor
        clock = task.Clock()
        deluge.config.callLater = clock.callLater

        tests_common.set_tmp_config_dir()
        client.start_standalone()

        success = yield client.core.enable_plugin("Label")
        self.assertTrue(success, msg="Failed to enable Label plugin")

        self.log = logging.getLogger(plugin_tests_logger_name)
        self.gtkui = GtkUI("YaRSS2")
        self.gtkui.create_ui()
示例#4
0
    def _on_reactor_start(self):
        log.debug('_on_reactor_start')
        self.mainwindow.first_show()

        if not self.config['standalone']:
            return self._start_thinclient()

        err_msg = ''
        try:
            client.start_standalone()
        except DaemonRunningError:
            err_msg = _('A Deluge daemon (deluged) is already running.\n'
                        'To use Standalone mode, stop local daemon and restart Deluge.')
        except ImportError as ex:
            if 'No module named libtorrent' in ex.message:
                err_msg = _('Only Thin Client mode is available because libtorrent is not installed.\n'
                            'To use Standalone mode, please install libtorrent package.')
            else:
                log.exception(ex)
                err_msg = _('Only Thin Client mode is available due to unknown Import Error.\n'
                            'To use Standalone mode, please see logs for error details.')
        except Exception as ex:
            log.exception(ex)
            err_msg = _('Only Thin Client mode is available due to unknown Import Error.\n'
                        'To use Standalone mode, please see logs for error details.')
        else:
            component.start()
            return

        def on_dialog_response(response):
            """User response to switching mode dialog."""
            if response == RESPONSE_YES:
                # Turning off standalone
                self.config['standalone'] = False
                self._start_thinclient()
            else:
                # User want keep Standalone Mode so just quit.
                self.mainwindow.quit()

        # An error occurred so ask user to switch from Standalone to Thin Client mode.
        err_msg += '\n\n' + _('Continue in Thin Client mode?')
        d = YesNoDialog(_('Change User Interface Mode'), err_msg).run()
        d.addCallback(on_dialog_response)
示例#5
0
 def set_up(self):
     defer.setDebugging(True)
     tests_common.set_tmp_config_dir()
     client.start_standalone()
     client.core.enable_plugin('Stats')
     return component.start()