Trivial fixes for marks based on code review.

- Fix a docstring copy-paste
- Add own name/copyright date to new file
- Simplify a bdd expression (no need for regex)
- Scroll to a pixel position in a single operation
This commit is contained in:
Ryan Roden-Corrent 2016-04-14 07:49:41 -04:00
parent 540f4af225
commit e684cfa03f
3 changed files with 7 additions and 8 deletions

View File

@ -29,7 +29,7 @@ import xml.etree.ElementTree
from PyQt5.QtWebKit import QWebSettings from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtWidgets import QApplication, QTabBar from PyQt5.QtWidgets import QApplication, QTabBar
from PyQt5.QtCore import Qt, QUrl, QEvent from PyQt5.QtCore import Qt, QUrl, QEvent, QPoint
from PyQt5.QtGui import QKeyEvent from PyQt5.QtGui import QKeyEvent
from PyQt5.QtPrintSupport import QPrintDialog, QPrintPreviewDialog from PyQt5.QtPrintSupport import QPrintDialog, QPrintPreviewDialog
from PyQt5.QtWebKitWidgets import QWebPage from PyQt5.QtWebKitWidgets import QWebPage
@ -1892,7 +1892,6 @@ class CommandDispatcher:
Args: Args:
key: mark identifier; capital indicates a global mark key: mark identifier; capital indicates a global mark
""" """
# consider urls that differ only in fragment to be identical
self._tabbed_browser.set_mark(key) self._tabbed_browser.set_mark(key)
@cmdutils.register(instance='command-dispatcher', scope='window') @cmdutils.register(instance='command-dispatcher', scope='window')
@ -1925,5 +1924,5 @@ class CommandDispatcher:
def _scroll_px_absolute(self, y): def _scroll_px_absolute(self, y):
"""Scroll to the position y pixels from the top of the page.""" """Scroll to the position y pixels from the top of the page."""
self.scroll('top') frame = self._current_widget().page().currentFrame()
self.scroll_px(0, y) frame.setScrollPosition(QPoint(0, y))

View File

@ -43,7 +43,7 @@ class TabDeletedError(Exception):
class MarkNotSetError(Exception): class MarkNotSetError(Exception):
"""Exception raised when _tab_index is called for a deleted tab.""" """Exception raised when accessing a tab that is not set."""
class TabbedBrowser(tabwidget.TabWidget): class TabbedBrowser(tabwidget.TabWidget):

View File

@ -1,6 +1,6 @@
# vim: ft=python fileencoding=utf-8 sts=4 sw=4 et: # vim: ft=python fileencoding=utf-8 sts=4 sw=4 et:
# Copyright 2014-2016 Florian Bruhin (The Compiler) <mail@qutebrowser.org> # Copyright 2016 Ryan Roden-Corrent (rcorre) <ryan@rcorre.net>
# #
# This file is part of qutebrowser. # This file is part of qutebrowser.
# #
@ -27,7 +27,7 @@ def _get_scroll_y(quteproc):
return pos['y'] return pos['y']
@bdd.then(bdd.parsers.re(r"the page should be scrolled to " @bdd.then(bdd.parsers.parse("the page should be scrolled to "
r"(?P<y>\d+)")) "{y}"))
def check_y(quteproc, y): def check_y(quteproc, y):
assert int(y) == _get_scroll_y(quteproc) assert int(y) == _get_scroll_y(quteproc)