Scroll on space press
This commit is contained in:
parent
7d8fdec1fd
commit
3c016de687
1
TODO
1
TODO
@ -29,7 +29,6 @@ Minor features/bugs
|
|||||||
===================
|
===================
|
||||||
|
|
||||||
Hiding scrollbars
|
Hiding scrollbars
|
||||||
Space to scroll
|
|
||||||
copypaste
|
copypaste
|
||||||
All kind of FIXMEs
|
All kind of FIXMEs
|
||||||
:bind
|
:bind
|
||||||
|
@ -10,6 +10,7 @@ colordict = {}
|
|||||||
default_config = {
|
default_config = {
|
||||||
'general': {
|
'general': {
|
||||||
'show_completion': 'true',
|
'show_completion': 'true',
|
||||||
|
'space_scroll': '200',
|
||||||
},
|
},
|
||||||
'keybind': {
|
'keybind': {
|
||||||
'o': 'open',
|
'o': 'open',
|
||||||
|
@ -1,10 +1,12 @@
|
|||||||
import logging
|
import logging
|
||||||
|
|
||||||
|
from PyQt5.QtWidgets import QShortcut
|
||||||
from PyQt5.QtCore import QUrl, pyqtSignal, Qt, QPoint, QEvent
|
from PyQt5.QtCore import QUrl, pyqtSignal, Qt, QPoint, QEvent
|
||||||
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
||||||
from PyQt5.QtWebKitWidgets import QWebView, QWebPage
|
from PyQt5.QtWebKitWidgets import QWebView, QWebPage
|
||||||
|
|
||||||
import qutebrowser.utils as utils
|
import qutebrowser.utils as utils
|
||||||
|
import qutebrowser.utils.config as config
|
||||||
from qutebrowser.widgets.tabbar import TabWidget
|
from qutebrowser.widgets.tabbar import TabWidget
|
||||||
|
|
||||||
class TabbedBrowser(TabWidget):
|
class TabbedBrowser(TabWidget):
|
||||||
@ -24,6 +26,10 @@ class TabbedBrowser(TabWidget):
|
|||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
self.currentChanged.connect(self._currentChanged_handler)
|
self.currentChanged.connect(self._currentChanged_handler)
|
||||||
self.tabopen(QUrl("http://ddg.gg/"))
|
self.tabopen(QUrl("http://ddg.gg/"))
|
||||||
|
space = QShortcut(self)
|
||||||
|
space.setKey(Qt.Key_Space)
|
||||||
|
space.setContext(Qt.WidgetWithChildrenShortcut)
|
||||||
|
space.activated.connect(self.space_scroll)
|
||||||
|
|
||||||
def tabopen(self, url):
|
def tabopen(self, url):
|
||||||
"""Opens a new tab with a given url"""
|
"""Opens a new tab with a given url"""
|
||||||
@ -130,6 +136,13 @@ class TabbedBrowser(TabWidget):
|
|||||||
return
|
return
|
||||||
frame.setScrollBarValue(orientation, int(m * perc / 100))
|
frame.setScrollBarValue(orientation, int(m * perc / 100))
|
||||||
|
|
||||||
|
def space_scroll(self):
|
||||||
|
try:
|
||||||
|
amount = config.config['general']['space_scroll']
|
||||||
|
except KeyError:
|
||||||
|
amount = 200
|
||||||
|
self.cur_scroll(0, amount)
|
||||||
|
|
||||||
def switch_prev(self):
|
def switch_prev(self):
|
||||||
"""Switches to the previous tab"""
|
"""Switches to the previous tab"""
|
||||||
idx = self.currentIndex()
|
idx = self.currentIndex()
|
||||||
|
Loading…
Reference in New Issue
Block a user