Add commands reload/stop/back/forward/print

This commit is contained in:
Florian Bruhin 2014-01-17 21:50:43 +01:00
parent 1b08b88b2b
commit ff855d6ded
3 changed files with 54 additions and 0 deletions

View File

@ -49,6 +49,11 @@ def main():
cmds['tabclose'].signal.connect(mw.tabs.close_act)
cmds['tabprev'].signal.connect(mw.tabs.switch_prev)
cmds['tabnext'].signal.connect(mw.tabs.switch_next)
cmds['reload'].signal.connect(mw.tabs.reload_act)
cmds['stop'].signal.connect(mw.tabs.stop_act)
cmds['back'].signal.connect(mw.tabs.back_act)
cmds['forward'].signal.connect(mw.tabs.forward_act)
cmds['print'].signal.connect(mw.tabs.print_act)
kp.from_cmd_dict(cmds)
mw.show()

View File

@ -29,3 +29,26 @@ class TabPrev(Command):
class Quit(Command):
nargs = 0
signal = pyqtSignal()
class Reload(Command):
nargs = 0
key = 'r'
signal = pyqtSignal()
class Stop(Command):
nargs = 0
signal = pyqtSignal()
class Back(Command):
nargs = 0
key = 'Shift+H'
signal = pyqtSignal()
class Forward(Command):
nargs = 0
key = 'Shift+L'
signal = pyqtSignal()
class Print(Command):
nargs = 0
signal = pyqtSignal()

View File

@ -1,4 +1,5 @@
from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtSignal
from PyQt5.QtPrintSupport import QPrintPreviewDialog
from PyQt5.QtWebKitWidgets import QWebView
from qutebrowser.widgets.tabbar import TabWidget
import logging
@ -37,6 +38,31 @@ class TabbedBrowser(TabWidget):
# FIXME
pass
@pyqtSlot()
def reload_act(self):
self.currentWidget().reload()
@pyqtSlot()
def stop_act(self):
self.currentWidget().stop()
@pyqtSlot()
def print_act(self):
# FIXME that does not what I expect
preview = QPrintPreviewDialog()
preview.paintRequested.connect(self.currentWidget().print)
preview.exec_()
@pyqtSlot()
def back_act(self):
# FIXME display warning if beginning of history
self.currentWidget().back()
@pyqtSlot()
def forward_act(self):
# FIXME display warning if end of history
self.currentWidget().forward()
@pyqtSlot()
def switch_prev(self):
idx = self.currentIndex()