Add tab{prev,next} command
This commit is contained in:
parent
c392993c79
commit
9a20d60c13
@ -18,6 +18,8 @@ def main():
|
|||||||
cmds.cmd_dict['tabopen'].signal.connect(mw.tabs.tabopen)
|
cmds.cmd_dict['tabopen'].signal.connect(mw.tabs.tabopen)
|
||||||
cmds.cmd_dict['quit'].signal.connect(QApplication.closeAllWindows) # FIXME
|
cmds.cmd_dict['quit'].signal.connect(QApplication.closeAllWindows) # FIXME
|
||||||
cmds.cmd_dict['tabclose'].signal.connect(mw.tabs.close_act)
|
cmds.cmd_dict['tabclose'].signal.connect(mw.tabs.close_act)
|
||||||
|
cmds.cmd_dict['tabprev'].signal.connect(mw.tabs.switch_prev)
|
||||||
|
cmds.cmd_dict['tabnext'].signal.connect(mw.tabs.switch_next)
|
||||||
kp.from_cmd_dict(cmds.cmd_dict, mw)
|
kp.from_cmd_dict(cmds.cmd_dict, mw)
|
||||||
mw.show()
|
mw.show()
|
||||||
|
|
||||||
|
@ -32,6 +32,25 @@ class TabbedBrowser(TabWidget):
|
|||||||
# FIXME
|
# FIXME
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def switch_prev(self):
|
||||||
|
idx = self.currentIndex()
|
||||||
|
if idx > 0:
|
||||||
|
self.setCurrentIndex(idx - 1)
|
||||||
|
else:
|
||||||
|
# FIXME
|
||||||
|
pass
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def switch_next(self):
|
||||||
|
idx = self.currentIndex()
|
||||||
|
if idx < self.count() - 1:
|
||||||
|
self.setCurrentIndex(idx + 1)
|
||||||
|
else:
|
||||||
|
# FIXME
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class BrowserTab(QWebView):
|
class BrowserTab(QWebView):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -81,6 +81,18 @@ class TabCloseCmd(Command):
|
|||||||
key = 'd'
|
key = 'd'
|
||||||
signal = pyqtSignal()
|
signal = pyqtSignal()
|
||||||
|
|
||||||
|
class TabNextCmd(Command):
|
||||||
|
nargs = 0
|
||||||
|
name = 'tabnext'
|
||||||
|
key = 'Shift+j'
|
||||||
|
signal = pyqtSignal()
|
||||||
|
|
||||||
|
class TabPrevCmd(Command):
|
||||||
|
nargs = 0
|
||||||
|
name = 'tabprev'
|
||||||
|
key = 'Shift+k'
|
||||||
|
signal = pyqtSignal()
|
||||||
|
|
||||||
class QuitCmd(Command):
|
class QuitCmd(Command):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
name = 'quit'
|
name = 'quit'
|
||||||
|
Loading…
Reference in New Issue
Block a user