Add opencur and tabopencur
This commit is contained in:
parent
bb7df14c08
commit
e2589a35b3
@ -71,6 +71,8 @@ class QuteBrowser(QApplication):
|
|||||||
self.aboutToQuit.connect(config.config.save)
|
self.aboutToQuit.connect(config.config.save)
|
||||||
self.mainwindow.tabs.keypress.connect(self.keyparser.handle)
|
self.mainwindow.tabs.keypress.connect(self.keyparser.handle)
|
||||||
self.keyparser.set_cmd_text.connect(self.mainwindow.status.cmd.set_cmd)
|
self.keyparser.set_cmd_text.connect(self.mainwindow.status.cmd.set_cmd)
|
||||||
|
self.mainwindow.tabs.set_cmd_text.connect(
|
||||||
|
self.mainwindow.status.cmd.set_cmd)
|
||||||
self.mainwindow.status.cmd.got_cmd.connect(self.commandparser.run)
|
self.mainwindow.status.cmd.got_cmd.connect(self.commandparser.run)
|
||||||
self.mainwindow.status.cmd.got_search.connect(self.searchparser.search)
|
self.mainwindow.status.cmd.got_search.connect(self.searchparser.search)
|
||||||
self.mainwindow.status.cmd.got_search_rev.connect(
|
self.mainwindow.status.cmd.got_search_rev.connect(
|
||||||
@ -226,7 +228,9 @@ class QuteBrowser(QApplication):
|
|||||||
|
|
||||||
handlers = {
|
handlers = {
|
||||||
'open': self.mainwindow.tabs.openurl,
|
'open': self.mainwindow.tabs.openurl,
|
||||||
|
'opencur': self.mainwindow.tabs.opencur,
|
||||||
'tabopen': self.mainwindow.tabs.tabopen,
|
'tabopen': self.mainwindow.tabs.tabopen,
|
||||||
|
'tabopencur': self.mainwindow.tabs.tabopencur,
|
||||||
'quit': self.quit,
|
'quit': self.quit,
|
||||||
'tabclose': self.mainwindow.tabs.cur_close,
|
'tabclose': self.mainwindow.tabs.cur_close,
|
||||||
'tabprev': self.mainwindow.tabs.switch_prev,
|
'tabprev': self.mainwindow.tabs.switch_prev,
|
||||||
|
@ -31,6 +31,12 @@ class Open(Command):
|
|||||||
count = True
|
count = True
|
||||||
|
|
||||||
|
|
||||||
|
class OpenCur(Command):
|
||||||
|
"""Fill the statusbar with :open and the current url."""
|
||||||
|
nargs = 0
|
||||||
|
hide = True
|
||||||
|
|
||||||
|
|
||||||
class TabOpen(Command):
|
class TabOpen(Command):
|
||||||
"""Open a page in a new tab.
|
"""Open a page in a new tab.
|
||||||
|
|
||||||
@ -41,6 +47,12 @@ class TabOpen(Command):
|
|||||||
split_args = False
|
split_args = False
|
||||||
|
|
||||||
|
|
||||||
|
class TabOpenCur(Command):
|
||||||
|
"""Fill the statusbar with :tabopen and the current url."""
|
||||||
|
nargs = 0
|
||||||
|
hide = True
|
||||||
|
|
||||||
|
|
||||||
class TabClose(Command):
|
class TabClose(Command):
|
||||||
"""Close the current tab, or tab [count]."""
|
"""Close the current tab, or tab [count]."""
|
||||||
nargs = 0
|
nargs = 0
|
||||||
|
@ -25,7 +25,9 @@ default_config = """
|
|||||||
|
|
||||||
[keybind]
|
[keybind]
|
||||||
o = open
|
o = open
|
||||||
|
go = opencur
|
||||||
O = tabopen
|
O = tabopen
|
||||||
|
gO = tabopencur
|
||||||
d = tabclose
|
d = tabclose
|
||||||
J = tabnext
|
J = tabnext
|
||||||
K = tabprev
|
K = tabprev
|
||||||
|
@ -40,6 +40,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
cur_statusbar_message = pyqtSignal(str) # Status bar message
|
cur_statusbar_message = pyqtSignal(str) # Status bar message
|
||||||
# Current tab changed scroll position
|
# Current tab changed scroll position
|
||||||
cur_scroll_perc_changed = pyqtSignal(int, int)
|
cur_scroll_perc_changed = pyqtSignal(int, int)
|
||||||
|
set_cmd_text = pyqtSignal(str) # Set commandline to a given text
|
||||||
keypress = pyqtSignal('QKeyEvent')
|
keypress = pyqtSignal('QKeyEvent')
|
||||||
_url_stack = [] # Stack of URLs of closed tabs
|
_url_stack = [] # Stack of URLs of closed tabs
|
||||||
|
|
||||||
@ -76,6 +77,11 @@ class TabbedBrowser(TabWidget):
|
|||||||
# FIXME sometimes this doesn't load
|
# FIXME sometimes this doesn't load
|
||||||
tab.open_tab.connect(self.tabopen)
|
tab.open_tab.connect(self.tabopen)
|
||||||
|
|
||||||
|
def tabopencur(self):
|
||||||
|
"""Set the statusbar to :tabopen and the current URL."""
|
||||||
|
url = self.currentWidget().url().toString()
|
||||||
|
self.set_cmd_text.emit(':tabopen ' + url)
|
||||||
|
|
||||||
def openurl(self, url, count=None):
|
def openurl(self, url, count=None):
|
||||||
"""Open an url in the current/[count]th tab.
|
"""Open an url in the current/[count]th tab.
|
||||||
|
|
||||||
@ -86,6 +92,11 @@ class TabbedBrowser(TabWidget):
|
|||||||
if tab is not None:
|
if tab is not None:
|
||||||
tab.openurl(url)
|
tab.openurl(url)
|
||||||
|
|
||||||
|
def opencur(self):
|
||||||
|
"""Set the statusbar to :open and the current URL."""
|
||||||
|
url = self.currentWidget().url().toString()
|
||||||
|
self.set_cmd_text.emit(':open ' + url)
|
||||||
|
|
||||||
def undo_close(self):
|
def undo_close(self):
|
||||||
"""Undo closing a tab.
|
"""Undo closing a tab.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user