Ejemplo n.º 1
0
def findinfiles(qtbot, request):
    """Set up find in files widget."""
    if getattr(request, 'param', False):
        param = request.param
    else:
        param = None

    plugin_mock = MagicMock()
    plugin_mock.CONF_SECTION = 'find_in_files'
    if param:
        prev_values = {}
        for param_name in param:
            value = param[param_name]
            prev_values[param_name] = CONF.get('find_in_files', param_name)
            CONF.set('find_in_files', param_name, value)

        widget = FindInFilesWidget('find_in_files', plugin=plugin_mock)
        widget._setup()
        widget.setup()

        def teardown():
            for param_name in prev_values:
                value = prev_values[param_name]
                CONF.set('find_in_files', param_name, value)

        request.addfinalizer(teardown)
    else:
        widget = FindInFilesWidget('find_in_files', plugin=plugin_mock)
        widget._setup()
        widget.setup()

    widget.resize(640, 480)
    qtbot.addWidget(widget)
    widget.show()
    return widget
Ejemplo n.º 2
0
def findinfiles(qtbot, request):
    """Set up find in files widget."""
    if getattr(request, 'param', False):
        param = request.param
    else:
        param = None

    if param:
        options = FindInFilesWidget.DEFAULT_OPTIONS.copy()
        options.update(param)
        widget = FindInFilesWidget('find_in_files', options=options)
        widget._setup(options=options)
        widget.setup(options=options)
    else:
        widget = FindInFilesWidget('find_in_files')
        widget._setup()
        widget.setup()

    widget.resize(640, 480)
    qtbot.addWidget(widget)
    widget.show()
    return widget