This commit is contained in:
Florian Bruhin 2016-08-09 17:28:14 +02:00
parent 2cbb147e33
commit fb3da578c5
14 changed files with 37 additions and 18 deletions

View File

@ -1185,14 +1185,13 @@ class CommandDispatcher:
current page's url. current page's url.
""" """
if url is None: if url is None:
url = self._current_url().toString(QUrl.RemovePassword url = self._current_url().toString(QUrl.RemovePassword |
| QUrl.FullyEncoded) QUrl.FullyEncoded)
try: try:
objreg.get('bookmark-manager').delete(url) objreg.get('bookmark-manager').delete(url)
except KeyError: except KeyError:
raise cmdexc.CommandError("Bookmark '{}' not found!".format(url)) raise cmdexc.CommandError("Bookmark '{}' not found!".format(url))
@cmdutils.register(instance='command-dispatcher', hide=True, @cmdutils.register(instance='command-dispatcher', hide=True,
scope='window') scope='window')
def follow_selected(self, *, tab=False): def follow_selected(self, *, tab=False):

View File

@ -761,7 +761,7 @@ class HintManager(QObject):
only_visible=True) only_visible=True)
def current_mode(self): def current_mode(self):
"""Returns the currently active hinting mode (or None otherwise).""" """Return the currently active hinting mode (or None otherwise)."""
if self._context is None: if self._context is None:
return None return None

View File

@ -17,7 +17,7 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>. # along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
"""Implementation of :navigate""" """Implementation of :navigate."""
import posixpath import posixpath

View File

@ -36,22 +36,30 @@ from qutebrowser.utils import objreg, utils
class Attribute(websettings.Attribute): class Attribute(websettings.Attribute):
"""A setting set via QWebEngineSettings::setAttribute."""
GLOBAL_SETTINGS = QWebEngineSettings.globalSettings GLOBAL_SETTINGS = QWebEngineSettings.globalSettings
ENUM_BASE = QWebEngineSettings ENUM_BASE = QWebEngineSettings
class Setter(websettings.Setter): class Setter(websettings.Setter):
"""A setting set via QWebEngineSettings getter/setter methods."""
GLOBAL_SETTINGS = QWebEngineSettings.globalSettings GLOBAL_SETTINGS = QWebEngineSettings.globalSettings
class NullStringSetter(websettings.NullStringSetter): class NullStringSetter(websettings.NullStringSetter):
"""A setter for settings requiring a null QString as default."""
GLOBAL_SETTINGS = QWebEngineSettings.globalSettings GLOBAL_SETTINGS = QWebEngineSettings.globalSettings
class StaticSetter(websettings.StaticSetter): class StaticSetter(websettings.StaticSetter):
"""A setting set via static QWebEngineSettings getter/setter methods."""
GLOBAL_SETTINGS = QWebEngineSettings.globalSettings GLOBAL_SETTINGS = QWebEngineSettings.globalSettings

View File

@ -34,22 +34,30 @@ from qutebrowser.utils import standarddir, objreg
class Attribute(websettings.Attribute): class Attribute(websettings.Attribute):
"""A setting set via QWebSettings::setAttribute."""
GLOBAL_SETTINGS = QWebSettings.globalSettings GLOBAL_SETTINGS = QWebSettings.globalSettings
ENUM_BASE = QWebSettings ENUM_BASE = QWebSettings
class Setter(websettings.Setter): class Setter(websettings.Setter):
"""A setting set via QWebSettings getter/setter methods."""
GLOBAL_SETTINGS = QWebSettings.globalSettings GLOBAL_SETTINGS = QWebSettings.globalSettings
class NullStringSetter(websettings.NullStringSetter): class NullStringSetter(websettings.NullStringSetter):
"""A setter for settings requiring a null QString as default."""
GLOBAL_SETTINGS = QWebSettings.globalSettings GLOBAL_SETTINGS = QWebSettings.globalSettings
class StaticSetter(websettings.StaticSetter): class StaticSetter(websettings.StaticSetter):
"""A setting set via static QWebSettings getter/setter methods."""
GLOBAL_SETTINGS = QWebSettings.globalSettings GLOBAL_SETTINGS = QWebSettings.globalSettings

View File

@ -125,11 +125,11 @@ class BaseType:
self.valid_values = None self.valid_values = None
def get_name(self): def get_name(self):
"""Get a name for the type for documentation""" """Get a name for the type for documentation."""
return self.__class__.__name__ return self.__class__.__name__
def get_valid_values(self): def get_valid_values(self):
"""Get the type's valid values for documentation""" """Get the type's valid values for documentation."""
return self.valid_values return self.valid_values
def _basic_validation(self, value): def _basic_validation(self, value):

View File

@ -60,11 +60,11 @@ def _missing_str(name, *, windows=None, pip=None, webengine=False):
blocks.append('<br />'.join(lines)) blocks.append('<br />'.join(lines))
if webengine: if webengine:
lines = [ lines = [
'Note QtWebEngine is not available for some distributions ' ('Note QtWebEngine is not available for some distributions '
'(like Debian/Ubuntu), so you need to start without ' '(like Debian/Ubuntu), so you need to start without '
'--backend webengine there.', '--backend webengine there.'),
'QtWebEngine is currently unsupported with the OS X .app, see ' ('QtWebEngine is currently unsupported with the OS X .app, see '
'https://github.com/The-Compiler/qutebrowser/issues/1692', 'https://github.com/The-Compiler/qutebrowser/issues/1692'),
] ]
else: else:
lines = ['<b>If you installed a qutebrowser package for your ' lines = ['<b>If you installed a qutebrowser package for your '

View File

@ -77,6 +77,7 @@ def download_open(quteproc):
cmd = '{} -c pass'.format(shlex.quote(sys.executable)) cmd = '{} -c pass'.format(shlex.quote(sys.executable))
quteproc.send_cmd(':download-open {}'.format(cmd)) quteproc.send_cmd(':download-open {}'.format(cmd))
@bdd.when("I directly open the download") @bdd.when("I directly open the download")
def download_open_with_prompt(quteproc): def download_open_with_prompt(quteproc):
cmd = '{} -c pass'.format(shlex.quote(sys.executable)) cmd = '{} -c pass'.format(shlex.quote(sys.executable))

View File

@ -26,6 +26,7 @@ import signal
import pytest import pytest
@pytest.mark.parametrize('cmd', [':quit', ':later 500 quit']) @pytest.mark.parametrize('cmd', [':quit', ':later 500 quit'])
def test_smoke(cmd, capfd): def test_smoke(cmd, capfd):
if hasattr(sys, 'frozen'): if hasattr(sys, 'frozen'):

View File

@ -221,6 +221,7 @@ class TestSelectorsAndFilters:
elems = [e for e in elems if filterfunc(e)] elems = [e for e in elems if filterfunc(e)]
assert bool(elems) == matching assert bool(elems) == matching
class TestWebKitElement: class TestWebKitElement:
"""Generic tests for WebKitElement. """Generic tests for WebKitElement.

View File

@ -96,30 +96,30 @@ def cmdutils_patch(monkeypatch, stubs):
@cmdutils.argument('option', completion=usertypes.Completion.option) @cmdutils.argument('option', completion=usertypes.Completion.option)
@cmdutils.argument('value', completion=usertypes.Completion.value) @cmdutils.argument('value', completion=usertypes.Completion.value)
def set_command(section_=None, option=None, value=None): def set_command(section_=None, option=None, value=None):
"""docstring!""" """docstring."""
pass pass
@cmdutils.argument('topic', completion=usertypes.Completion.helptopic) @cmdutils.argument('topic', completion=usertypes.Completion.helptopic)
def show_help(tab=False, bg=False, window=False, topic=None): def show_help(tab=False, bg=False, window=False, topic=None):
"""docstring!""" """docstring."""
pass pass
@cmdutils.argument('url', completion=usertypes.Completion.url) @cmdutils.argument('url', completion=usertypes.Completion.url)
@cmdutils.argument('count', count=True) @cmdutils.argument('count', count=True)
def openurl(url=None, implicit=False, bg=False, tab=False, window=False, def openurl(url=None, implicit=False, bg=False, tab=False, window=False,
count=None): count=None):
"""docstring!""" """docstring."""
pass pass
@cmdutils.argument('win_id', win_id=True) @cmdutils.argument('win_id', win_id=True)
@cmdutils.argument('command', completion=usertypes.Completion.command) @cmdutils.argument('command', completion=usertypes.Completion.command)
def bind(key, win_id, command=None, *, mode='normal', force=False): def bind(key, win_id, command=None, *, mode='normal', force=False):
"""docstring!""" """docstring."""
# pylint: disable=unused-variable # pylint: disable=unused-variable
pass pass
def tab_detach(): def tab_detach():
"""docstring!""" """docstring."""
pass pass
cmds = { cmds = {

View File

@ -59,6 +59,7 @@ def _extract_model_data(model):
data.append(row) data.append(row)
return data return data
@pytest.mark.parametrize('pattern, data, expected', [ @pytest.mark.parametrize('pattern, data, expected', [
('foo', 'barfoobar', True), ('foo', 'barfoobar', True),
('foo', 'barFOObar', True), ('foo', 'barFOObar', True),