示例#1
0
def init():
    """Initialize the global QWebSettings."""
    webenginequtescheme.init()
    spell.init()

    # For some reason we need to keep a reference, otherwise the scheme handler
    # won't work...
    # https://www.riverbankcomputing.com/pipermail/pyqt/2016-September/038075.html
    global _qute_scheme_handler
    app = QApplication.instance()
    log.init.debug("Initializing qute://* handler...")
    _qute_scheme_handler = webenginequtescheme.QuteSchemeHandler(parent=app)

    global _req_interceptor
    log.init.debug("Initializing request interceptor...")
    from qutebrowser.browser.webengine import interceptor
    _req_interceptor = interceptor.RequestInterceptor(parent=app)

    global _download_manager
    log.init.debug("Initializing QtWebEngine downloads...")
    _download_manager = webenginedownloads.DownloadManager(parent=app)
    objreg.register('webengine-download-manager', _download_manager)
    from qutebrowser.misc import quitter
    quitter.instance.shutting_down.connect(_download_manager.shutdown)

    global _global_settings
    _global_settings = WebEngineSettings(_SettingsWrapper())

    _init_default_profile()
    init_private_profile()
    config.instance.changed.connect(_update_settings)

    _init_site_specific_quirks()
    _init_devtools_settings()
示例#2
0
    def test_moving_oserror(self, mocker, caplog,
                            old_dict_dir, dict_dir, patch_new_qt):
        mocker.patch('shutil.copytree', side_effect=OSError)

        with caplog.at_level(logging.ERROR):
            spell.init()

        assert caplog.messages[0] == 'Failed to copy old dictionaries'
示例#3
0
    def test_moving_oserror(self, mocker, caplog, old_dict_dir, dict_dir,
                            patch_new_qt):
        mocker.patch('shutil.copytree', side_effect=OSError)

        with caplog.at_level(logging.ERROR):
            spell.init()

        assert caplog.messages[0] == 'Failed to copy old dictionaries'
示例#4
0
def init(args):
    """Initialize the global QWebSettings."""
    if (args.enable_webengine_inspector and
            not hasattr(QWebEnginePage, 'setInspectedPage')):  # only Qt < 5.11
        os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = str(utils.random_port())

    spell.init()

    _init_profiles()
    config.instance.changed.connect(_update_settings)

    global global_settings
    global_settings = WebEngineSettings(_SettingsWrapper())
    global_settings.init_settings()
示例#5
0
def init(args):
    """Initialize the global QWebSettings."""
    if (args.enable_webengine_inspector and
            not hasattr(QWebEnginePage, 'setInspectedPage')):  # only Qt < 5.11
        os.environ['QTWEBENGINE_REMOTE_DEBUGGING'] = str(utils.random_port())

    spell.init()

    _init_profiles()
    config.instance.changed.connect(_update_settings)

    global global_settings
    global_settings = WebEngineSettings(_SettingsWrapper())
    global_settings.init_settings()
示例#6
0
def init():
    """Initialize the global QWebSettings."""
    webenginequtescheme.init()
    spell.init()

    _init_default_profile()
    init_private_profile()
    config.instance.changed.connect(_update_settings)

    global global_settings
    global_settings = WebEngineSettings(_SettingsWrapper())
    global_settings.init_settings()

    _init_site_specific_quirks()
    _init_devtools_settings()
示例#7
0
 def test_init(self, dict_dir):
     spell.init()
     assert os.environ[self.ENV] == str(dict_dir)
示例#8
0
 def test_moving_existing_destdir(self, old_dict_dir, dict_dir,
                                  patch_new_qt):
     dict_dir.ensure(dir=True)
     spell.init()
     assert not (dict_dir / 'somedict').exists()
示例#9
0
 def test_moving(self, old_dict_dir, dict_dir, patch_new_qt):
     spell.init()
     assert (dict_dir / 'somedict').exists()
示例#10
0
 def test_new_qt(self, dict_dir, patch_new_qt):
     spell.init()
     assert os.environ[self.ENV] == str(dict_dir)
示例#11
0
 def test_old_qt(self, monkeypatch):
     monkeypatch.setattr(spell.qtutils, 'version_check',
                         lambda _ver, compiled: False)
     spell.init()
     assert self.ENV not in os.environ
示例#12
0
 def test_moving_existing_destdir(self, old_dict_dir, dict_dir,
                                  patch_new_qt):
     dict_dir.ensure(dir=True)
     spell.init()
     assert not (dict_dir / 'somedict').exists()
示例#13
0
 def test_moving(self, old_dict_dir, dict_dir, patch_new_qt):
     spell.init()
     assert (dict_dir / 'somedict').exists()
示例#14
0
 def test_new_qt(self, dict_dir, patch_new_qt):
     spell.init()
     assert os.environ[self.ENV] == str(dict_dir)
示例#15
0
 def test_old_qt(self, monkeypatch):
     monkeypatch.setattr(spell.qtutils, 'version_check',
                         lambda _ver, compiled: False)
     spell.init()
     assert self.ENV not in os.environ