Add commands reload/stop/back/forward/print
This commit is contained in:
parent
1b08b88b2b
commit
ff855d6ded
@ -49,6 +49,11 @@ def main():
|
|||||||
cmds['tabclose'].signal.connect(mw.tabs.close_act)
|
cmds['tabclose'].signal.connect(mw.tabs.close_act)
|
||||||
cmds['tabprev'].signal.connect(mw.tabs.switch_prev)
|
cmds['tabprev'].signal.connect(mw.tabs.switch_prev)
|
||||||
cmds['tabnext'].signal.connect(mw.tabs.switch_next)
|
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)
|
kp.from_cmd_dict(cmds)
|
||||||
|
|
||||||
mw.show()
|
mw.show()
|
||||||
|
@ -29,3 +29,26 @@ class TabPrev(Command):
|
|||||||
class Quit(Command):
|
class Quit(Command):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
signal = pyqtSignal()
|
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()
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtSignal
|
from PyQt5.QtCore import QObject, pyqtSlot, QUrl, pyqtSignal
|
||||||
|
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
||||||
from PyQt5.QtWebKitWidgets import QWebView
|
from PyQt5.QtWebKitWidgets import QWebView
|
||||||
from qutebrowser.widgets.tabbar import TabWidget
|
from qutebrowser.widgets.tabbar import TabWidget
|
||||||
import logging
|
import logging
|
||||||
@ -37,6 +38,31 @@ class TabbedBrowser(TabWidget):
|
|||||||
# FIXME
|
# FIXME
|
||||||
pass
|
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()
|
@pyqtSlot()
|
||||||
def switch_prev(self):
|
def switch_prev(self):
|
||||||
idx = self.currentIndex()
|
idx = self.currentIndex()
|
||||||
|
Loading…
Reference in New Issue
Block a user