Add tabclose command
This commit is contained in:
parent
ad52436875
commit
928bdbe160
@ -17,6 +17,7 @@ def main():
|
|||||||
cmds.cmd_dict['open'].signal.connect(mw.tabs.openurl)
|
cmds.cmd_dict['open'].signal.connect(mw.tabs.openurl)
|
||||||
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)
|
||||||
kp.from_cmd_dict(cmds.cmd_dict, mw)
|
kp.from_cmd_dict(cmds.cmd_dict, mw)
|
||||||
mw.show()
|
mw.show()
|
||||||
|
|
||||||
|
@ -22,6 +22,12 @@ class TabbedBrowser(TabWidget):
|
|||||||
tab = self.tabs[self.currentIndex()]
|
tab = self.tabs[self.currentIndex()]
|
||||||
tab.openurl(url)
|
tab.openurl(url)
|
||||||
|
|
||||||
|
@pyqtSlot()
|
||||||
|
def close_act(self):
|
||||||
|
idx = self.currentIndex()
|
||||||
|
self.tabs.pop(idx)
|
||||||
|
self.removeTab(idx)
|
||||||
|
|
||||||
class BrowserTab(QWebView):
|
class BrowserTab(QWebView):
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
|
@ -75,6 +75,12 @@ class TabOpenCmd(Command):
|
|||||||
def run(self, argv):
|
def run(self, argv):
|
||||||
self.signal.emit(argv[0])
|
self.signal.emit(argv[0])
|
||||||
|
|
||||||
|
class TabCloseCmd(Command):
|
||||||
|
nargs = 0
|
||||||
|
name = 'tabclose'
|
||||||
|
key = 'd'
|
||||||
|
signal = pyqtSignal()
|
||||||
|
|
||||||
class QuitCmd(Command):
|
class QuitCmd(Command):
|
||||||
nargs = 0
|
nargs = 0
|
||||||
name = 'quit'
|
name = 'quit'
|
||||||
|
Loading…
Reference in New Issue
Block a user