Rename some commands
This commit is contained in:
parent
19da80e58e
commit
d901fe69e6
1
TODO
1
TODO
@ -28,7 +28,6 @@ Style
|
|||||||
- move curcommand stuff to other places (e.g. current widget, etc.)
|
- move curcommand stuff to other places (e.g. current widget, etc.)
|
||||||
maybe rename curcommand to commands or so?
|
maybe rename curcommand to commands or so?
|
||||||
also some curcommand stuff is in tabbedbrowser, etc.
|
also some curcommand stuff is in tabbedbrowser, etc.
|
||||||
- rename commands
|
|
||||||
- reorder config #2
|
- reorder config #2
|
||||||
- rework exception hierarchy for config (common base exception)
|
- rework exception hierarchy for config (common base exception)
|
||||||
|
|
||||||
|
@ -162,11 +162,11 @@ class CurCommandDispatcher(QObject):
|
|||||||
if tab is not None:
|
if tab is not None:
|
||||||
tab.stop()
|
tab.stop()
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='printpreview')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def printpreview(self, count=None):
|
def print_preview(self, count=None):
|
||||||
"""Preview printing of the current/[count]th tab.
|
"""Preview printing of the current/[count]th tab.
|
||||||
|
|
||||||
Command handler for :printpreview.
|
Command handler for :print-preview.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: The tab index to print, or None.
|
count: The tab index to print, or None.
|
||||||
@ -233,11 +233,11 @@ class CurCommandDispatcher(QObject):
|
|||||||
if frame is None:
|
if frame is None:
|
||||||
raise CommandError("No frame focused!")
|
raise CommandError("No frame focused!")
|
||||||
try:
|
try:
|
||||||
group = getattr(webelem.Group, groupstr)
|
group = getattr(webelem.Group, groupstr.replace('-', '_'))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise CommandError("Unknown hinting group {}!".format(groupstr))
|
raise CommandError("Unknown hinting group {}!".format(groupstr))
|
||||||
try:
|
try:
|
||||||
target = getattr(hints.Target, targetstr)
|
target = getattr(hints.Target, targetstr.replace('-', '_'))
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
raise CommandError("Unknown hinting target {}!".format(targetstr))
|
raise CommandError("Unknown hinting target {}!".format(targetstr))
|
||||||
widget.hintmanager.start(frame, widget.url(), group, target)
|
widget.hintmanager.start(frame, widget.url(), group, target)
|
||||||
@ -263,22 +263,22 @@ class CurCommandDispatcher(QObject):
|
|||||||
self._tabs.currentWidget().hintmanager.filter_hints(filterstr)
|
self._tabs.currentWidget().hintmanager.filter_hints(filterstr)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def prevpage(self):
|
def prev_page(self):
|
||||||
"""Open a "previous" link."""
|
"""Open a "previous" link."""
|
||||||
self._prevnext(prev=True, newtab=False)
|
self._prevnext(prev=True, newtab=False)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def nextpage(self):
|
def next_page(self):
|
||||||
"""Open a "next" link."""
|
"""Open a "next" link."""
|
||||||
self._prevnext(prev=False, newtab=False)
|
self._prevnext(prev=False, newtab=False)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def tabprevpage(self):
|
def prev_page_tab(self):
|
||||||
"""Open a "previous" link in a new tab."""
|
"""Open a "previous" link in a new tab."""
|
||||||
self._prevnext(prev=True, newtab=True)
|
self._prevnext(prev=True, newtab=True)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def tabnextpage(self):
|
def next_page_tab(self):
|
||||||
"""Open a "next" link in a new tab."""
|
"""Open a "next" link in a new tab."""
|
||||||
self._prevnext(prev=False, newtab=True)
|
self._prevnext(prev=False, newtab=True)
|
||||||
|
|
||||||
@ -309,7 +309,7 @@ class CurCommandDispatcher(QObject):
|
|||||||
cmdutils.check_overflow(dy, 'int')
|
cmdutils.check_overflow(dy, 'int')
|
||||||
self._tabs.currentWidget().page_.currentFrame().scroll(dx, dy)
|
self._tabs.currentWidget().page_.currentFrame().scroll(dx, dy)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='scroll_perc_x',
|
@cmdutils.register(instance='mainwindow.tabs.cur', name='scroll-perc-x',
|
||||||
hide=True)
|
hide=True)
|
||||||
def scroll_percent_x(self, perc=None, count=None):
|
def scroll_percent_x(self, perc=None, count=None):
|
||||||
"""Scroll the current tab to a specific percent of the page (horiz).
|
"""Scroll the current tab to a specific percent of the page (horiz).
|
||||||
@ -322,7 +322,7 @@ class CurCommandDispatcher(QObject):
|
|||||||
"""
|
"""
|
||||||
self._scroll_percent(perc, count, Qt.Horizontal)
|
self._scroll_percent(perc, count, Qt.Horizontal)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='scroll_perc_y',
|
@cmdutils.register(instance='mainwindow.tabs.cur', name='scroll-perc-y',
|
||||||
hide=True)
|
hide=True)
|
||||||
def scroll_percent_y(self, perc=None, count=None):
|
def scroll_percent_y(self, perc=None, count=None):
|
||||||
"""Scroll the current tab to a specific percent of the page (vert).
|
"""Scroll the current tab to a specific percent of the page (vert).
|
||||||
@ -368,11 +368,11 @@ class CurCommandDispatcher(QObject):
|
|||||||
message.info("URL yanked to {}".format("primary selection" if sel
|
message.info("URL yanked to {}".format("primary selection" if sel
|
||||||
else "clipboard"))
|
else "clipboard"))
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='yanktitle')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def yank_title(self, sel=False):
|
def yank_title(self, sel=False):
|
||||||
"""Yank the current title to the clipboard or primary selection.
|
"""Yank the current title to the clipboard or primary selection.
|
||||||
|
|
||||||
Command handler for :yanktitle.
|
Command handler for :yank-title.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
sel: True to use primary selection, False to use clipboard
|
sel: True to use primary selection, False to use clipboard
|
||||||
@ -384,7 +384,7 @@ class CurCommandDispatcher(QObject):
|
|||||||
message.info("Title yanked to {}".format("primary selection" if sel
|
message.info("Title yanked to {}".format("primary selection" if sel
|
||||||
else "clipboard"))
|
else "clipboard"))
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoomin')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def zoom_in(self, count=1):
|
def zoom_in(self, count=1):
|
||||||
"""Increase the zoom level for the current tab.
|
"""Increase the zoom level for the current tab.
|
||||||
|
|
||||||
@ -394,7 +394,7 @@ class CurCommandDispatcher(QObject):
|
|||||||
tab = self._tabs.currentWidget()
|
tab = self._tabs.currentWidget()
|
||||||
tab.zoom(count)
|
tab.zoom(count)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoomout')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def zoom_out(self, count=1):
|
def zoom_out(self, count=1):
|
||||||
"""Decrease the zoom level for the current tab.
|
"""Decrease the zoom level for the current tab.
|
||||||
|
|
||||||
|
@ -37,8 +37,8 @@ from qutebrowser.utils.usertypes import enum
|
|||||||
ElemTuple = namedtuple('ElemTuple', 'elem, label')
|
ElemTuple = namedtuple('ElemTuple', 'elem, label')
|
||||||
|
|
||||||
|
|
||||||
Target = enum('normal', 'tab', 'bgtab', 'yank', 'yank_primary', 'cmd',
|
Target = enum('normal', 'tab', 'tab_bg', 'yank', 'yank_primary', 'cmd',
|
||||||
'cmd_tab', 'cmd_bgtab', 'rapid')
|
'cmd_tab', 'cmd_tab_bg', 'rapid')
|
||||||
|
|
||||||
|
|
||||||
class HintManager(QObject):
|
class HintManager(QObject):
|
||||||
@ -55,9 +55,9 @@ class HintManager(QObject):
|
|||||||
_elems: A mapping from keystrings to (elem, label) namedtuples.
|
_elems: A mapping from keystrings to (elem, label) namedtuples.
|
||||||
_baseurl: The URL of the current page.
|
_baseurl: The URL of the current page.
|
||||||
_target: What to do with the opened links.
|
_target: What to do with the opened links.
|
||||||
normal/tab/bgtab: Get passed to BrowserTab.
|
normal/tab/tab_bg: Get passed to BrowserTab.
|
||||||
yank/yank_primary: Yank to clipboard/primary selection
|
yank/yank_primary: Yank to clipboard/primary selection
|
||||||
cmd/cmd_tab/cmd_bgtab: Enter link to commandline
|
cmd/cmd_tab/cmd_tab_bg: Enter link to commandline
|
||||||
rapid: Rapid mode with background tabs
|
rapid: Rapid mode with background tabs
|
||||||
_to_follow: The link to follow when enter is pressed.
|
_to_follow: The link to follow when enter is pressed.
|
||||||
|
|
||||||
@ -89,12 +89,12 @@ class HintManager(QObject):
|
|||||||
HINT_TEXTS = {
|
HINT_TEXTS = {
|
||||||
Target.normal: "Follow hint...",
|
Target.normal: "Follow hint...",
|
||||||
Target.tab: "Follow hint in new tab...",
|
Target.tab: "Follow hint in new tab...",
|
||||||
Target.bgtab: "Follow hint in background tab...",
|
Target.tab_bg: "Follow hint in background tab...",
|
||||||
Target.yank: "Yank hint to clipboard...",
|
Target.yank: "Yank hint to clipboard...",
|
||||||
Target.yank_primary: "Yank hint to primary selection...",
|
Target.yank_primary: "Yank hint to primary selection...",
|
||||||
Target.cmd: "Set hint in commandline...",
|
Target.cmd: "Set hint in commandline...",
|
||||||
Target.cmd_tab: "Set hint in commandline as new tab...",
|
Target.cmd_tab: "Set hint in commandline as new tab...",
|
||||||
Target.cmd_bgtab: "Set hint in commandline as background tab...",
|
Target.cmd_tab_bg: "Set hint in commandline as background tab...",
|
||||||
Target.rapid: "Follow hint (rapid mode)...",
|
Target.rapid: "Follow hint (rapid mode)...",
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -257,7 +257,7 @@ class HintManager(QObject):
|
|||||||
elem: The QWebElement to click.
|
elem: The QWebElement to click.
|
||||||
"""
|
"""
|
||||||
if self._target == Target.rapid:
|
if self._target == Target.rapid:
|
||||||
target = Target.bgtab
|
target = Target.tab_bg
|
||||||
else:
|
else:
|
||||||
target = self._target
|
target = self._target
|
||||||
self.set_open_target.emit(Target[target])
|
self.set_open_target.emit(Target[target])
|
||||||
@ -298,8 +298,8 @@ class HintManager(QObject):
|
|||||||
"""
|
"""
|
||||||
commands = {
|
commands = {
|
||||||
Target.cmd: 'open',
|
Target.cmd: 'open',
|
||||||
Target.cmd_tab: 'tabopen',
|
Target.cmd_tab: 'open-tab',
|
||||||
Target.cmd_bgtab: 'backtabopen',
|
Target.cmd_tab_bg: 'open-tab-bg',
|
||||||
}
|
}
|
||||||
message.set_cmd_text(':{} {}'.format(commands[self._target],
|
message.set_cmd_text(':{} {}'.format(commands[self._target],
|
||||||
urlutils.urlstring(link)))
|
urlutils.urlstring(link)))
|
||||||
@ -479,7 +479,7 @@ class HintManager(QObject):
|
|||||||
elem_handlers = {
|
elem_handlers = {
|
||||||
Target.normal: self._click,
|
Target.normal: self._click,
|
||||||
Target.tab: self._click,
|
Target.tab: self._click,
|
||||||
Target.bgtab: self._click,
|
Target.tab_bg: self._click,
|
||||||
Target.rapid: self._click,
|
Target.rapid: self._click,
|
||||||
}
|
}
|
||||||
# Handlers which take a link string
|
# Handlers which take a link string
|
||||||
@ -488,7 +488,7 @@ class HintManager(QObject):
|
|||||||
Target.yank_primary: self._yank,
|
Target.yank_primary: self._yank,
|
||||||
Target.cmd: self._preset_cmd_text,
|
Target.cmd: self._preset_cmd_text,
|
||||||
Target.cmd_tab: self._preset_cmd_text,
|
Target.cmd_tab: self._preset_cmd_text,
|
||||||
Target.cmd_bgtab: self._preset_cmd_text,
|
Target.cmd_tab_bg: self._preset_cmd_text,
|
||||||
}
|
}
|
||||||
elem = self._elems[keystr].elem
|
elem = self._elems[keystr].elem
|
||||||
if self._target in elem_handlers:
|
if self._target in elem_handlers:
|
||||||
|
@ -144,13 +144,18 @@ class register: # pylint: disable=invalid-name
|
|||||||
"""
|
"""
|
||||||
# pylint: disable=no-member
|
# pylint: disable=no-member
|
||||||
names = []
|
names = []
|
||||||
name = func.__name__.lower() if self.name is None else self.name
|
if self.name is None:
|
||||||
|
name = func.__name__.lower().replace('_', '-')
|
||||||
|
else:
|
||||||
|
name = self.name
|
||||||
if isinstance(name, str):
|
if isinstance(name, str):
|
||||||
mainname = name
|
mainname = name
|
||||||
names.append(name)
|
names.append(name)
|
||||||
else:
|
else:
|
||||||
mainname = name[0]
|
mainname = name[0]
|
||||||
names += name
|
names += name
|
||||||
|
if mainname in cmd_dict:
|
||||||
|
raise ValueError("{} is already registered!".format(name))
|
||||||
argspec = inspect.getfullargspec(func)
|
argspec = inspect.getfullargspec(func)
|
||||||
if 'self' in argspec.args and self.instance is None:
|
if 'self' in argspec.args and self.instance is None:
|
||||||
raise ValueError("{} is a class method, but instance was not "
|
raise ValueError("{} is a class method, but instance was not "
|
||||||
|
@ -305,7 +305,7 @@ class ConfigManager(QObject):
|
|||||||
ValueError) as e:
|
ValueError) as e:
|
||||||
message.error("set: {} - {}".format(e.__class__.__name__, e))
|
message.error("set: {} - {}".format(e.__class__.__name__, e))
|
||||||
|
|
||||||
@cmdutils.register(name='set_temp', instance='config',
|
@cmdutils.register(name='set-temp', instance='config',
|
||||||
completion=['section', 'option', 'value'])
|
completion=['section', 'option', 'value'])
|
||||||
def set_temp_wrapper(self, sectname, optname, value):
|
def set_temp_wrapper(self, sectname, optname, value):
|
||||||
"""Set a temporary option.
|
"""Set a temporary option.
|
||||||
|
@ -93,31 +93,31 @@ SECTION_DESC = {
|
|||||||
"Since normal keypresses are passed through, only special keys are "
|
"Since normal keypresses are passed through, only special keys are "
|
||||||
"supported in this mode.\n"
|
"supported in this mode.\n"
|
||||||
"Useful hidden commands to map in this section:\n"
|
"Useful hidden commands to map in this section:\n"
|
||||||
" open_editor: Open a texteditor with the focused field.\n"
|
" open-editor: Open a texteditor with the focused field.\n"
|
||||||
" leave_mode: Leave the command mode."),
|
" leave-mode: Leave the command mode."),
|
||||||
'keybind.hint': (
|
'keybind.hint': (
|
||||||
"Keybindings for hint mode.\n"
|
"Keybindings for hint mode.\n"
|
||||||
"Since normal keypresses are passed through, only special keys are "
|
"Since normal keypresses are passed through, only special keys are "
|
||||||
"supported in this mode.\n"
|
"supported in this mode.\n"
|
||||||
"Useful hidden commands to map in this section:\n"
|
"Useful hidden commands to map in this section:\n"
|
||||||
" follow_hint: Follow the currently selected hint.\n"
|
" follow-hint: Follow the currently selected hint.\n"
|
||||||
" leave_mode: Leave the command mode."),
|
" leave-mode: Leave the command mode."),
|
||||||
'keybind.passthrough': (
|
'keybind.passthrough': (
|
||||||
"Keybindings for passthrough mode.\n"
|
"Keybindings for passthrough mode.\n"
|
||||||
"Since normal keypresses are passed through, only special keys are "
|
"Since normal keypresses are passed through, only special keys are "
|
||||||
"supported in this mode.\n"
|
"supported in this mode.\n"
|
||||||
"An useful command to map here is the hidden command leave_mode."),
|
"An useful command to map here is the hidden command leave-mode."),
|
||||||
'keybind.command': (
|
'keybind.command': (
|
||||||
"Keybindings for command mode.\n"
|
"Keybindings for command mode.\n"
|
||||||
"Since normal keypresses are passed through, only special keys are "
|
"Since normal keypresses are passed through, only special keys are "
|
||||||
"supported in this mode.\n"
|
"supported in this mode.\n"
|
||||||
"Useful hidden commands to map in this section:\n"
|
"Useful hidden commands to map in this section:\n"
|
||||||
" command_history_prev: Switch to previous command in history.\n"
|
" command-history-prev: Switch to previous command in history.\n"
|
||||||
" command_history_next: Switch to next command in history.\n"
|
" command-history-next: Switch to next command in history.\n"
|
||||||
" completion_item_prev: Select previous item in completion.\n"
|
" completion-item-prev: Select previous item in completion.\n"
|
||||||
" completion_item_next: Select next item in completion.\n"
|
" completion-item-next: Select next item in completion.\n"
|
||||||
" command_accept: Execute the command currently in the commandline.\n"
|
" command-accept: Execute the command currently in the commandline.\n"
|
||||||
" leave_mode: Leave the command mode."),
|
" leave-mode: Leave the command mode."),
|
||||||
'aliases': (
|
'aliases': (
|
||||||
"Aliases for commands.\n"
|
"Aliases for commands.\n"
|
||||||
"By default, no aliases are defined. Example which adds a new command "
|
"By default, no aliases are defined. Example which adds a new command "
|
||||||
@ -195,7 +195,7 @@ DATA = OrderedDict([
|
|||||||
|
|
||||||
('editor',
|
('editor',
|
||||||
SettingValue(types.ShellCommand(placeholder=True), 'gvim -f "{}"'),
|
SettingValue(types.ShellCommand(placeholder=True), 'gvim -f "{}"'),
|
||||||
"The editor (and arguments) to use for the open_editor binding. "
|
"The editor (and arguments) to use for the open-editor binding. "
|
||||||
"Use {} for the filename. Gets split via shutils."),
|
"Use {} for the filename. Gets split via shutils."),
|
||||||
|
|
||||||
('show-scroll-bar-horizontal',
|
('show-scroll-bar-horizontal',
|
||||||
@ -578,83 +578,83 @@ DATA = OrderedDict([
|
|||||||
('keybind', sect.ValueList(
|
('keybind', sect.ValueList(
|
||||||
types.KeyBindingName(), types.KeyBinding(),
|
types.KeyBindingName(), types.KeyBinding(),
|
||||||
('o', 'open'),
|
('o', 'open'),
|
||||||
('go', 'opencur'),
|
('go', 'open-cur'),
|
||||||
('O', 'tabopen'),
|
('O', 'open-tab'),
|
||||||
('gO', 'tabopencur'),
|
('gO', 'open-tab-cur'),
|
||||||
('xo', 'backtabopen'),
|
('xo', 'open-tab-bg'),
|
||||||
('xO', 'backtabopencur'),
|
('xO', 'open-tab-bg-cur'),
|
||||||
('ga', 'tabopen about:blank'),
|
('ga', 'open-tab about:blank'),
|
||||||
('d', 'tabclose'),
|
('d', 'tab-close'),
|
||||||
('co', 'only'),
|
('co', 'tab-only'),
|
||||||
('T', 'focus_tab'),
|
('T', 'tab-focus'),
|
||||||
('gm', 'tab_move'),
|
('gm', 'tab-move'),
|
||||||
('gl', 'tab_move -'),
|
('gl', 'tab-move -'),
|
||||||
('gr', 'tab_move +'),
|
('gr', 'tab-move +'),
|
||||||
('J', 'tabnext'),
|
('J', 'tab-next'),
|
||||||
('K', 'tabprev'),
|
('K', 'tab-prev'),
|
||||||
('r', 'reload'),
|
('r', 'reload'),
|
||||||
('H', 'back'),
|
('H', 'back'),
|
||||||
('L', 'forward'),
|
('L', 'forward'),
|
||||||
('f', 'hint'),
|
('f', 'hint'),
|
||||||
('F', 'hint all tab'),
|
('F', 'hint all tab'),
|
||||||
(';b', 'hint all bgtab'),
|
(';b', 'hint all tab-bg'),
|
||||||
(';i', 'hint images'),
|
(';i', 'hint images'),
|
||||||
(';I', 'hint images tab'),
|
(';I', 'hint images tab'),
|
||||||
('.i', 'hint images bgtab'),
|
('.i', 'hint images tab-bg'),
|
||||||
(';e', 'hint editable'),
|
(';e', 'hint editable'),
|
||||||
(';o', 'hint links cmd'),
|
(';o', 'hint links cmd'),
|
||||||
(';O', 'hint links cmd_tab'),
|
(';O', 'hint links cmd-tab'),
|
||||||
('.o', 'hint links cmd_bgtab'),
|
('.o', 'hint links cmd-tab-bg'),
|
||||||
(';y', 'hint links yank'),
|
(';y', 'hint links yank'),
|
||||||
(';Y', 'hint links yank_primary'),
|
(';Y', 'hint links yank-primary'),
|
||||||
(';r', 'hint links rapid'),
|
(';r', 'hint links rapid'),
|
||||||
('h', 'scroll -50 0'),
|
('h', 'scroll -50 0'),
|
||||||
('j', 'scroll 0 50'),
|
('j', 'scroll 0 50'),
|
||||||
('k', 'scroll 0 -50'),
|
('k', 'scroll 0 -50'),
|
||||||
('l', 'scroll 50 0'),
|
('l', 'scroll 50 0'),
|
||||||
('u', 'undo'),
|
('u', 'undo'),
|
||||||
('gg', 'scroll_perc_y 0'),
|
('gg', 'scroll-perc-y 0'),
|
||||||
('G', 'scroll_perc_y'),
|
('G', 'scroll-perc-y'),
|
||||||
('n', 'nextsearch'),
|
('n', 'nextsearch'),
|
||||||
('i', 'enter_mode insert'),
|
('i', 'enter-mode insert'),
|
||||||
('yy', 'yank'),
|
('yy', 'yank'),
|
||||||
('yY', 'yank sel'),
|
('yY', 'yank sel'),
|
||||||
('yt', 'yanktitle'),
|
('yt', 'yank-title'),
|
||||||
('yT', 'yanktitle sel'),
|
('yT', 'yank-title sel'),
|
||||||
('pp', 'paste'),
|
('pp', 'paste'),
|
||||||
('pP', 'paste sel'),
|
('pP', 'paste sel'),
|
||||||
('Pp', 'tabpaste'),
|
('Pp', 'paste-tab'),
|
||||||
('PP', 'tabpaste sel'),
|
('PP', 'paste-tab sel'),
|
||||||
('sf', 'save'),
|
('sf', 'save'),
|
||||||
('ss', 'set'),
|
('ss', 'set'),
|
||||||
('sl', 'set_temp'),
|
('sl', 'set-temp'),
|
||||||
('sk', 'set keybind'),
|
('sk', 'set keybind'),
|
||||||
('-', 'zoomout'),
|
('-', 'zoom-out'),
|
||||||
('+', 'zoomin'),
|
('+', 'zoom-in'),
|
||||||
('=', 'zoom'),
|
('=', 'zoom'),
|
||||||
('[[', 'prevpage'),
|
('[[', 'prev-page'),
|
||||||
(']]', 'nextpage'),
|
(']]', 'next-page'),
|
||||||
('{{', 'tabprevpage'),
|
('{{', 'prev-page-tab'),
|
||||||
('}}', 'tabnextpage'),
|
('}}', 'next-page-tab'),
|
||||||
('<Ctrl-Tab>', 'tab_focus_last'),
|
('<Ctrl-Tab>', 'tab-focus-last'),
|
||||||
('<Ctrl-V>', 'enter_mode passthrough'),
|
('<Ctrl-V>', 'enter-mode passthrough'),
|
||||||
('<Ctrl-Q>', 'quit'),
|
('<Ctrl-Q>', 'quit'),
|
||||||
('<Ctrl-Shift-T>', 'undo'),
|
('<Ctrl-Shift-T>', 'undo'),
|
||||||
('<Ctrl-W>', 'tabclose'),
|
('<Ctrl-W>', 'tab-close'),
|
||||||
('<Ctrl-T>', 'tabopen about:blank'),
|
('<Ctrl-T>', 'open-tab about:blank'),
|
||||||
('<Ctrl-F>', 'scroll_page 0 1'),
|
('<Ctrl-F>', 'scroll-page 0 1'),
|
||||||
('<Ctrl-B>', 'scroll_page 0 -1'),
|
('<Ctrl-B>', 'scroll-page 0 -1'),
|
||||||
('<Ctrl-D>', 'scroll_page 0 0.5'),
|
('<Ctrl-D>', 'scroll-page 0 0.5'),
|
||||||
('<Ctrl-U>', 'scroll_page 0 -0.5'),
|
('<Ctrl-U>', 'scroll-page 0 -0.5'),
|
||||||
('<Alt-1>', 'focus_tab 1'),
|
('<Alt-1>', 'tab-focus 1'),
|
||||||
('<Alt-2>', 'focus_tab 2'),
|
('<Alt-2>', 'tab-focus 2'),
|
||||||
('<Alt-3>', 'focus_tab 3'),
|
('<Alt-3>', 'tab-focus 3'),
|
||||||
('<Alt-4>', 'focus_tab 4'),
|
('<Alt-4>', 'tab-focus 4'),
|
||||||
('<Alt-5>', 'focus_tab 5'),
|
('<Alt-5>', 'tab-focus 5'),
|
||||||
('<Alt-6>', 'focus_tab 6'),
|
('<Alt-6>', 'tab-focus 6'),
|
||||||
('<Alt-7>', 'focus_tab 7'),
|
('<Alt-7>', 'tab-focus 7'),
|
||||||
('<Alt-8>', 'focus_tab 8'),
|
('<Alt-8>', 'tab-focus 8'),
|
||||||
('<Alt-9>', 'focus_tab 9'),
|
('<Alt-9>', 'tab-focus 9'),
|
||||||
('<Backspace>', 'back'),
|
('<Backspace>', 'back'),
|
||||||
('<Left>', '${h}'),
|
('<Left>', '${h}'),
|
||||||
('<Down>', '${j}'),
|
('<Down>', '${j}'),
|
||||||
@ -671,32 +671,32 @@ DATA = OrderedDict([
|
|||||||
|
|
||||||
('keybind.insert', sect.ValueList(
|
('keybind.insert', sect.ValueList(
|
||||||
types.KeyBindingName(), types.KeyBinding(),
|
types.KeyBindingName(), types.KeyBinding(),
|
||||||
('<Escape>', 'leave_mode'),
|
('<Escape>', 'leave-mode'),
|
||||||
('<Ctrl-N>', 'leave_mode'),
|
('<Ctrl-N>', 'leave-mode'),
|
||||||
('<Ctrl-E>', 'open_editor'),
|
('<Ctrl-E>', 'open-editor'),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('keybind.hint', sect.ValueList(
|
('keybind.hint', sect.ValueList(
|
||||||
types.KeyBindingName(), types.KeyBinding(),
|
types.KeyBindingName(), types.KeyBinding(),
|
||||||
('<Return>', 'follow_hint'),
|
('<Return>', 'follow-hint'),
|
||||||
('<Escape>', 'leave_mode'),
|
('<Escape>', 'leave-mode'),
|
||||||
('<Ctrl-N>', 'leave_mode'),
|
('<Ctrl-N>', 'leave-mode'),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('keybind.passthrough', sect.ValueList(
|
('keybind.passthrough', sect.ValueList(
|
||||||
types.KeyBindingName(), types.KeyBinding(),
|
types.KeyBindingName(), types.KeyBinding(),
|
||||||
('<Escape>', 'leave_mode'),
|
('<Escape>', 'leave-mode'),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('keybind.command', sect.ValueList(
|
('keybind.command', sect.ValueList(
|
||||||
types.KeyBindingName(), types.KeyBinding(),
|
types.KeyBindingName(), types.KeyBinding(),
|
||||||
('<Escape>', 'leave_mode'),
|
('<Escape>', 'leave-mode'),
|
||||||
('<Ctrl-N>', 'leave_mode'),
|
('<Ctrl-N>', 'leave-mode'),
|
||||||
('<Up>', 'command_history_prev'),
|
('<Up>', 'command-history-prev'),
|
||||||
('<Down>', 'command_history_next'),
|
('<Down>', 'command-history-next'),
|
||||||
('<Shift-Tab>', 'completion_item_prev'),
|
('<Shift-Tab>', 'completion-item-prev'),
|
||||||
('<Tab>', 'completion_item_next'),
|
('<Tab>', 'completion-item-next'),
|
||||||
('<Return>', 'command_accept'),
|
('<Return>', 'command-accept'),
|
||||||
)),
|
)),
|
||||||
|
|
||||||
('aliases', sect.ValueList(
|
('aliases', sect.ValueList(
|
||||||
|
@ -173,7 +173,7 @@ class ModeManager(QObject):
|
|||||||
if passthrough:
|
if passthrough:
|
||||||
self.passthrough.append(mode)
|
self.passthrough.append(mode)
|
||||||
|
|
||||||
@cmdutils.register(instance='modeman', name='enter_mode', hide=True)
|
@cmdutils.register(instance='modeman', name='enter-mode', hide=True)
|
||||||
def enter(self, mode, reason=None):
|
def enter(self, mode, reason=None):
|
||||||
"""Enter a new mode.
|
"""Enter a new mode.
|
||||||
|
|
||||||
@ -214,7 +214,7 @@ class ModeManager(QObject):
|
|||||||
self._mode_stack))
|
self._mode_stack))
|
||||||
self.left.emit(mode)
|
self.left.emit(mode)
|
||||||
|
|
||||||
@cmdutils.register(instance='modeman', name='leave_mode',
|
@cmdutils.register(instance='modeman', name='leave-mode',
|
||||||
not_modes=['normal'], hide=True)
|
not_modes=['normal'], hide=True)
|
||||||
def leave_current_mode(self):
|
def leave_current_mode(self):
|
||||||
"""Leave the mode we're currently in."""
|
"""Leave the mode we're currently in."""
|
||||||
|
@ -50,7 +50,7 @@ def log_events(klass):
|
|||||||
return klass
|
return klass
|
||||||
|
|
||||||
|
|
||||||
@cmdutils.register(name='settrace', hide=True)
|
@cmdutils.register(name='set-trace', hide=True)
|
||||||
def set_trace():
|
def set_trace():
|
||||||
"""Set a tracepoint in the Python debugger that works with Qt.
|
"""Set a tracepoint in the Python debugger that works with Qt.
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
def tabopen(self, url=None, background=None):
|
def tabopen(self, url=None, background=None):
|
||||||
"""Open a new tab with a given URL.
|
"""Open a new tab with a given URL.
|
||||||
|
|
||||||
Inner logic for tabopen and backtabopen.
|
Inner logic for open-tab and open-tab-bg.
|
||||||
Also connect all the signals we need to _filter_signals.
|
Also connect all the signals we need to _filter_signals.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -287,11 +287,11 @@ class TabbedBrowser(TabWidget):
|
|||||||
for tab in self.widgets:
|
for tab in self.widgets:
|
||||||
tab.shutdown(callback=partial(self._cb_tab_shutdown, tab))
|
tab.shutdown(callback=partial(self._cb_tab_shutdown, tab))
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs')
|
@cmdutils.register(instance='mainwindow.tabs', name='tab-close')
|
||||||
def tabclose(self, count=None):
|
def tabclose(self, count=None):
|
||||||
"""Close the current/[count]th tab.
|
"""Close the current/[count]th tab.
|
||||||
|
|
||||||
Command handler for :close.
|
Command handler for :tab-close.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: The tab index to close, or None
|
count: The tab index to close, or None
|
||||||
@ -306,41 +306,40 @@ class TabbedBrowser(TabWidget):
|
|||||||
self._close_tab(tab)
|
self._close_tab(tab)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs')
|
@cmdutils.register(instance='mainwindow.tabs')
|
||||||
def only(self):
|
def tab_only(self):
|
||||||
"""Close all tabs except for the current one."""
|
"""Close all tabs except for the current one."""
|
||||||
for tab in self.widgets:
|
for tab in self.widgets:
|
||||||
if tab is self.currentWidget():
|
if tab is self.currentWidget():
|
||||||
continue
|
continue
|
||||||
self._close_tab(tab)
|
self._close_tab(tab)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', split=False, name='tabopen')
|
@cmdutils.register(instance='mainwindow.tabs', split=False)
|
||||||
def tabopen_cmd(self, url):
|
def open_tab(self, url):
|
||||||
"""Open a new tab with a given url."""
|
"""Open a new tab with a given url."""
|
||||||
self.tabopen(url, background=False)
|
self.tabopen(url, background=False)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', split=False,
|
@cmdutils.register(instance='mainwindow.tabs', split=False)
|
||||||
name='backtabopen')
|
def open_tab_bg(self, url):
|
||||||
def backtabopen_cmd(self, url):
|
|
||||||
"""Open a new tab in background."""
|
"""Open a new tab in background."""
|
||||||
self.tabopen(url, background=True)
|
self.tabopen(url, background=True)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
||||||
def tabopencur(self):
|
def open_tab_cur(self):
|
||||||
"""Set the statusbar to :tabopen and the current URL."""
|
"""Set the statusbar to :tabopen and the current URL."""
|
||||||
url = urlutils.urlstring(self.currentWidget().url())
|
url = urlutils.urlstring(self.currentWidget().url())
|
||||||
message.set_cmd_text(':tabopen ' + url)
|
message.set_cmd_text(':open-tab ' + url)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
||||||
def opencur(self):
|
def open_cur(self):
|
||||||
"""Set the statusbar to :open and the current URL."""
|
"""Set the statusbar to :open and the current URL."""
|
||||||
url = urlutils.urlstring(self.currentWidget().url())
|
url = urlutils.urlstring(self.currentWidget().url())
|
||||||
message.set_cmd_text(':open ' + url)
|
message.set_cmd_text(':open ' + url)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
@cmdutils.register(instance='mainwindow.tabs', hide=True)
|
||||||
def backtabopencur(self):
|
def open_tab_bg_cur(self):
|
||||||
"""Set the statusbar to :backtabopen and the current URL."""
|
"""Set the statusbar to :tabopen-bg and the current URL."""
|
||||||
url = urlutils.urlstring(self.currentWidget().url())
|
url = urlutils.urlstring(self.currentWidget().url())
|
||||||
message.set_cmd_text(':backtabopen ' + url)
|
message.set_cmd_text(':open-tab-bg ' + url)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', name='undo')
|
@cmdutils.register(instance='mainwindow.tabs', name='undo')
|
||||||
def undo_close(self):
|
def undo_close(self):
|
||||||
@ -353,11 +352,11 @@ class TabbedBrowser(TabWidget):
|
|||||||
else:
|
else:
|
||||||
raise CommandError("Nothing to undo!")
|
raise CommandError("Nothing to undo!")
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', name='tabprev')
|
@cmdutils.register(instance='mainwindow.tabs', name='tab-prev')
|
||||||
def switch_prev(self, count=1):
|
def switch_prev(self, count=1):
|
||||||
"""Switch to the previous tab, or skip [count] tabs.
|
"""Switch to the previous tab, or skip [count] tabs.
|
||||||
|
|
||||||
Command handler for :tabprev.
|
Command handler for :tab-prev.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many tabs to switch back.
|
count: How many tabs to switch back.
|
||||||
@ -370,11 +369,11 @@ class TabbedBrowser(TabWidget):
|
|||||||
else:
|
else:
|
||||||
raise CommandError("First tab")
|
raise CommandError("First tab")
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs', name='tabnext')
|
@cmdutils.register(instance='mainwindow.tabs', name='tab-next')
|
||||||
def switch_next(self, count=1):
|
def switch_next(self, count=1):
|
||||||
"""Switch to the next tab, or skip [count] tabs.
|
"""Switch to the next tab, or skip [count] tabs.
|
||||||
|
|
||||||
Command handler for :tabnext.
|
Command handler for :tab-next.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
count: How many tabs to switch forward.
|
count: How many tabs to switch forward.
|
||||||
@ -409,7 +408,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
self.cur.openurl(url)
|
self.cur.openurl(url)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs')
|
@cmdutils.register(instance='mainwindow.tabs')
|
||||||
def tabpaste(self, sel=False):
|
def paste_tab(self, sel=False):
|
||||||
"""Open a page from the clipboard in a new tab.
|
"""Open a page from the clipboard in a new tab.
|
||||||
|
|
||||||
Command handler for :paste.
|
Command handler for :paste.
|
||||||
@ -420,7 +419,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
self.paste(sel, True)
|
self.paste(sel, True)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs')
|
@cmdutils.register(instance='mainwindow.tabs')
|
||||||
def focus_tab(self, index=None, count=None):
|
def tab_focus(self, index=None, count=None):
|
||||||
"""Select the tab given as argument/[count].
|
"""Select the tab given as argument/[count].
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -181,7 +181,7 @@ class StatusBar(QWidget):
|
|||||||
self._text_pop_timer.start()
|
self._text_pop_timer.start()
|
||||||
self._stack.setCurrentWidget(self.txt)
|
self._stack.setCurrentWidget(self.txt)
|
||||||
|
|
||||||
def _disp_text(self, text, error, immediate):
|
def _disp_text(self, text, error, immediate=False):
|
||||||
"""Inner logic for disp_error and disp_temp_text.
|
"""Inner logic for disp_error and disp_temp_text.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -219,7 +219,7 @@ class StatusBar(QWidget):
|
|||||||
self._text_pop_timer.start()
|
self._text_pop_timer.start()
|
||||||
|
|
||||||
@pyqtSlot(str, bool)
|
@pyqtSlot(str, bool)
|
||||||
def disp_error(self, text, immediate):
|
def disp_error(self, text, immediate=False):
|
||||||
"""Display an error in the statusbar.
|
"""Display an error in the statusbar.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
|
@ -37,7 +37,7 @@ from qutebrowser.utils.usertypes import NeighborList, enum
|
|||||||
from qutebrowser.commands.exceptions import CommandError
|
from qutebrowser.commands.exceptions import CommandError
|
||||||
|
|
||||||
|
|
||||||
Target = enum('normal', 'tab', 'bgtab')
|
Target = enum('normal', 'tab', 'tab_bg')
|
||||||
LoadStatus = enum('none', 'success', 'error', 'warn', 'loading')
|
LoadStatus = enum('none', 'success', 'error', 'warn', 'loading')
|
||||||
|
|
||||||
|
|
||||||
@ -63,7 +63,7 @@ class WebView(QWebView):
|
|||||||
_zoom: A NeighborList with the zoom levels.
|
_zoom: A NeighborList with the zoom levels.
|
||||||
_old_scroll_perc: The old scroll position.
|
_old_scroll_perc: The old scroll position.
|
||||||
_shutdown_callback: Callback to be called after shutdown.
|
_shutdown_callback: Callback to be called after shutdown.
|
||||||
_open_target: Where to open the next tab ("normal", "tab", "bgtab")
|
_open_target: Where to open the next tab ("normal", "tab", "tab_bg")
|
||||||
_force_open_target: Override for _open_target.
|
_force_open_target: Override for _open_target.
|
||||||
_shutdown_callback: The callback to call after shutting down.
|
_shutdown_callback: The callback to call after shutting down.
|
||||||
_destroyed: Dict of all items to be destroyed on shtudown.
|
_destroyed: Dict of all items to be destroyed on shtudown.
|
||||||
@ -267,7 +267,7 @@ class WebView(QWebView):
|
|||||||
elif (e.button() == Qt.MidButton or
|
elif (e.button() == Qt.MidButton or
|
||||||
e.modifiers() & Qt.ControlModifier):
|
e.modifiers() & Qt.ControlModifier):
|
||||||
if config.get('general', 'background-tabs'):
|
if config.get('general', 'background-tabs'):
|
||||||
self._open_target = Target.bgtab
|
self._open_target = Target.tab_bg
|
||||||
else:
|
else:
|
||||||
self._open_target = Target.tab
|
self._open_target = Target.tab
|
||||||
logging.debug("Middle click, setting target: {}".format(
|
logging.debug("Middle click, setting target: {}".format(
|
||||||
@ -381,7 +381,7 @@ class WebView(QWebView):
|
|||||||
"""
|
"""
|
||||||
if self._open_target == Target.tab:
|
if self._open_target == Target.tab:
|
||||||
self.tabbedbrowser.tabopen(url, False)
|
self.tabbedbrowser.tabopen(url, False)
|
||||||
elif self._open_target == Target.bgtab:
|
elif self._open_target == Target.tab_bg:
|
||||||
self.tabbedbrowser.tabopen(url, True)
|
self.tabbedbrowser.tabopen(url, True)
|
||||||
else:
|
else:
|
||||||
self.openurl(url)
|
self.openurl(url)
|
||||||
|
Loading…
Reference in New Issue
Block a user