From d901fe69e6603201e0ffe925fc40d21e5cafa8a4 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Fri, 16 May 2014 23:01:40 +0200 Subject: [PATCH] Rename some commands --- TODO | 1 - qutebrowser/browser/curcommand.py | 30 ++--- qutebrowser/browser/hints.py | 22 ++-- qutebrowser/commands/utils.py | 7 +- qutebrowser/config/config.py | 2 +- qutebrowser/config/configdata.py | 152 +++++++++++++------------- qutebrowser/keyinput/modeman.py | 4 +- qutebrowser/utils/debug.py | 2 +- qutebrowser/widgets/_tabbedbrowser.py | 41 ++++--- qutebrowser/widgets/statusbar/bar.py | 4 +- qutebrowser/widgets/webview.py | 8 +- 11 files changed, 138 insertions(+), 135 deletions(-) diff --git a/TODO b/TODO index 36608ff14..493b679ee 100644 --- a/TODO +++ b/TODO @@ -28,7 +28,6 @@ Style - move curcommand stuff to other places (e.g. current widget, etc.) maybe rename curcommand to commands or so? also some curcommand stuff is in tabbedbrowser, etc. -- rename commands - reorder config #2 - rework exception hierarchy for config (common base exception) diff --git a/qutebrowser/browser/curcommand.py b/qutebrowser/browser/curcommand.py index 4b60ff9de..3b8ea7e0f 100644 --- a/qutebrowser/browser/curcommand.py +++ b/qutebrowser/browser/curcommand.py @@ -162,11 +162,11 @@ class CurCommandDispatcher(QObject): if tab is not None: tab.stop() - @cmdutils.register(instance='mainwindow.tabs.cur', name='printpreview') - def printpreview(self, count=None): + @cmdutils.register(instance='mainwindow.tabs.cur') + def print_preview(self, count=None): """Preview printing of the current/[count]th tab. - Command handler for :printpreview. + Command handler for :print-preview. Args: count: The tab index to print, or None. @@ -233,11 +233,11 @@ class CurCommandDispatcher(QObject): if frame is None: raise CommandError("No frame focused!") try: - group = getattr(webelem.Group, groupstr) + group = getattr(webelem.Group, groupstr.replace('-', '_')) except AttributeError: raise CommandError("Unknown hinting group {}!".format(groupstr)) try: - target = getattr(hints.Target, targetstr) + target = getattr(hints.Target, targetstr.replace('-', '_')) except AttributeError: raise CommandError("Unknown hinting target {}!".format(targetstr)) widget.hintmanager.start(frame, widget.url(), group, target) @@ -263,22 +263,22 @@ class CurCommandDispatcher(QObject): self._tabs.currentWidget().hintmanager.filter_hints(filterstr) @cmdutils.register(instance='mainwindow.tabs.cur') - def prevpage(self): + def prev_page(self): """Open a "previous" link.""" self._prevnext(prev=True, newtab=False) @cmdutils.register(instance='mainwindow.tabs.cur') - def nextpage(self): + def next_page(self): """Open a "next" link.""" self._prevnext(prev=False, newtab=False) @cmdutils.register(instance='mainwindow.tabs.cur') - def tabprevpage(self): + def prev_page_tab(self): """Open a "previous" link in a new tab.""" self._prevnext(prev=True, newtab=True) @cmdutils.register(instance='mainwindow.tabs.cur') - def tabnextpage(self): + def next_page_tab(self): """Open a "next" link in a new tab.""" self._prevnext(prev=False, newtab=True) @@ -309,7 +309,7 @@ class CurCommandDispatcher(QObject): cmdutils.check_overflow(dy, 'int') 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) def scroll_percent_x(self, perc=None, count=None): """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) - @cmdutils.register(instance='mainwindow.tabs.cur', name='scroll_perc_y', + @cmdutils.register(instance='mainwindow.tabs.cur', name='scroll-perc-y', hide=True) def scroll_percent_y(self, perc=None, count=None): """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 else "clipboard")) - @cmdutils.register(instance='mainwindow.tabs.cur', name='yanktitle') + @cmdutils.register(instance='mainwindow.tabs.cur') def yank_title(self, sel=False): """Yank the current title to the clipboard or primary selection. - Command handler for :yanktitle. + Command handler for :yank-title. Args: 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 else "clipboard")) - @cmdutils.register(instance='mainwindow.tabs.cur', name='zoomin') + @cmdutils.register(instance='mainwindow.tabs.cur') def zoom_in(self, count=1): """Increase the zoom level for the current tab. @@ -394,7 +394,7 @@ class CurCommandDispatcher(QObject): tab = self._tabs.currentWidget() tab.zoom(count) - @cmdutils.register(instance='mainwindow.tabs.cur', name='zoomout') + @cmdutils.register(instance='mainwindow.tabs.cur') def zoom_out(self, count=1): """Decrease the zoom level for the current tab. diff --git a/qutebrowser/browser/hints.py b/qutebrowser/browser/hints.py index 203795096..e446e7f5f 100644 --- a/qutebrowser/browser/hints.py +++ b/qutebrowser/browser/hints.py @@ -37,8 +37,8 @@ from qutebrowser.utils.usertypes import enum ElemTuple = namedtuple('ElemTuple', 'elem, label') -Target = enum('normal', 'tab', 'bgtab', 'yank', 'yank_primary', 'cmd', - 'cmd_tab', 'cmd_bgtab', 'rapid') +Target = enum('normal', 'tab', 'tab_bg', 'yank', 'yank_primary', 'cmd', + 'cmd_tab', 'cmd_tab_bg', 'rapid') class HintManager(QObject): @@ -55,9 +55,9 @@ class HintManager(QObject): _elems: A mapping from keystrings to (elem, label) namedtuples. _baseurl: The URL of the current page. _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 - 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 _to_follow: The link to follow when enter is pressed. @@ -89,12 +89,12 @@ class HintManager(QObject): HINT_TEXTS = { Target.normal: "Follow hint...", 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_primary: "Yank hint to primary selection...", Target.cmd: "Set hint in commandline...", 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)...", } @@ -257,7 +257,7 @@ class HintManager(QObject): elem: The QWebElement to click. """ if self._target == Target.rapid: - target = Target.bgtab + target = Target.tab_bg else: target = self._target self.set_open_target.emit(Target[target]) @@ -298,8 +298,8 @@ class HintManager(QObject): """ commands = { Target.cmd: 'open', - Target.cmd_tab: 'tabopen', - Target.cmd_bgtab: 'backtabopen', + Target.cmd_tab: 'open-tab', + Target.cmd_tab_bg: 'open-tab-bg', } message.set_cmd_text(':{} {}'.format(commands[self._target], urlutils.urlstring(link))) @@ -479,7 +479,7 @@ class HintManager(QObject): elem_handlers = { Target.normal: self._click, Target.tab: self._click, - Target.bgtab: self._click, + Target.tab_bg: self._click, Target.rapid: self._click, } # Handlers which take a link string @@ -488,7 +488,7 @@ class HintManager(QObject): Target.yank_primary: self._yank, Target.cmd: 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 if self._target in elem_handlers: diff --git a/qutebrowser/commands/utils.py b/qutebrowser/commands/utils.py index f53781852..271187061 100644 --- a/qutebrowser/commands/utils.py +++ b/qutebrowser/commands/utils.py @@ -144,13 +144,18 @@ class register: # pylint: disable=invalid-name """ # pylint: disable=no-member 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): mainname = name names.append(name) else: mainname = name[0] names += name + if mainname in cmd_dict: + raise ValueError("{} is already registered!".format(name)) argspec = inspect.getfullargspec(func) if 'self' in argspec.args and self.instance is None: raise ValueError("{} is a class method, but instance was not " diff --git a/qutebrowser/config/config.py b/qutebrowser/config/config.py index d68e268e5..75035b9dd 100644 --- a/qutebrowser/config/config.py +++ b/qutebrowser/config/config.py @@ -305,7 +305,7 @@ class ConfigManager(QObject): ValueError) as 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']) def set_temp_wrapper(self, sectname, optname, value): """Set a temporary option. diff --git a/qutebrowser/config/configdata.py b/qutebrowser/config/configdata.py index 72f206e9b..40ef7929b 100644 --- a/qutebrowser/config/configdata.py +++ b/qutebrowser/config/configdata.py @@ -93,31 +93,31 @@ SECTION_DESC = { "Since normal keypresses are passed through, only special keys are " "supported in this mode.\n" "Useful hidden commands to map in this section:\n" - " open_editor: Open a texteditor with the focused field.\n" - " leave_mode: Leave the command mode."), + " open-editor: Open a texteditor with the focused field.\n" + " leave-mode: Leave the command mode."), 'keybind.hint': ( "Keybindings for hint mode.\n" "Since normal keypresses are passed through, only special keys are " "supported in this mode.\n" "Useful hidden commands to map in this section:\n" - " follow_hint: Follow the currently selected hint.\n" - " leave_mode: Leave the command mode."), + " follow-hint: Follow the currently selected hint.\n" + " leave-mode: Leave the command mode."), 'keybind.passthrough': ( "Keybindings for passthrough mode.\n" "Since normal keypresses are passed through, only special keys are " "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': ( "Keybindings for command mode.\n" "Since normal keypresses are passed through, only special keys are " "supported in this mode.\n" "Useful hidden commands to map in this section:\n" - " command_history_prev: Switch to previous 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_next: Select next item in completion.\n" - " command_accept: Execute the command currently in the commandline.\n" - " leave_mode: Leave the command mode."), + " command-history-prev: Switch to previous 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-next: Select next item in completion.\n" + " command-accept: Execute the command currently in the commandline.\n" + " leave-mode: Leave the command mode."), 'aliases': ( "Aliases for commands.\n" "By default, no aliases are defined. Example which adds a new command " @@ -195,7 +195,7 @@ DATA = OrderedDict([ ('editor', 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."), ('show-scroll-bar-horizontal', @@ -578,83 +578,83 @@ DATA = OrderedDict([ ('keybind', sect.ValueList( types.KeyBindingName(), types.KeyBinding(), ('o', 'open'), - ('go', 'opencur'), - ('O', 'tabopen'), - ('gO', 'tabopencur'), - ('xo', 'backtabopen'), - ('xO', 'backtabopencur'), - ('ga', 'tabopen about:blank'), - ('d', 'tabclose'), - ('co', 'only'), - ('T', 'focus_tab'), - ('gm', 'tab_move'), - ('gl', 'tab_move -'), - ('gr', 'tab_move +'), - ('J', 'tabnext'), - ('K', 'tabprev'), + ('go', 'open-cur'), + ('O', 'open-tab'), + ('gO', 'open-tab-cur'), + ('xo', 'open-tab-bg'), + ('xO', 'open-tab-bg-cur'), + ('ga', 'open-tab about:blank'), + ('d', 'tab-close'), + ('co', 'tab-only'), + ('T', 'tab-focus'), + ('gm', 'tab-move'), + ('gl', 'tab-move -'), + ('gr', 'tab-move +'), + ('J', 'tab-next'), + ('K', 'tab-prev'), ('r', 'reload'), ('H', 'back'), ('L', 'forward'), ('f', 'hint'), ('F', 'hint all tab'), - (';b', 'hint all bgtab'), + (';b', 'hint all tab-bg'), (';i', 'hint images'), (';I', 'hint images tab'), - ('.i', 'hint images bgtab'), + ('.i', 'hint images tab-bg'), (';e', 'hint editable'), (';o', 'hint links cmd'), - (';O', 'hint links cmd_tab'), - ('.o', 'hint links cmd_bgtab'), + (';O', 'hint links cmd-tab'), + ('.o', 'hint links cmd-tab-bg'), (';y', 'hint links yank'), - (';Y', 'hint links yank_primary'), + (';Y', 'hint links yank-primary'), (';r', 'hint links rapid'), ('h', 'scroll -50 0'), ('j', 'scroll 0 50'), ('k', 'scroll 0 -50'), ('l', 'scroll 50 0'), ('u', 'undo'), - ('gg', 'scroll_perc_y 0'), - ('G', 'scroll_perc_y'), + ('gg', 'scroll-perc-y 0'), + ('G', 'scroll-perc-y'), ('n', 'nextsearch'), - ('i', 'enter_mode insert'), + ('i', 'enter-mode insert'), ('yy', 'yank'), ('yY', 'yank sel'), - ('yt', 'yanktitle'), - ('yT', 'yanktitle sel'), + ('yt', 'yank-title'), + ('yT', 'yank-title sel'), ('pp', 'paste'), ('pP', 'paste sel'), - ('Pp', 'tabpaste'), - ('PP', 'tabpaste sel'), + ('Pp', 'paste-tab'), + ('PP', 'paste-tab sel'), ('sf', 'save'), ('ss', 'set'), - ('sl', 'set_temp'), + ('sl', 'set-temp'), ('sk', 'set keybind'), - ('-', 'zoomout'), - ('+', 'zoomin'), + ('-', 'zoom-out'), + ('+', 'zoom-in'), ('=', 'zoom'), - ('[[', 'prevpage'), - (']]', 'nextpage'), - ('{{', 'tabprevpage'), - ('}}', 'tabnextpage'), - ('', 'tab_focus_last'), - ('', 'enter_mode passthrough'), + ('[[', 'prev-page'), + (']]', 'next-page'), + ('{{', 'prev-page-tab'), + ('}}', 'next-page-tab'), + ('', 'tab-focus-last'), + ('', 'enter-mode passthrough'), ('', 'quit'), ('', 'undo'), - ('', 'tabclose'), - ('', 'tabopen about:blank'), - ('', 'scroll_page 0 1'), - ('', 'scroll_page 0 -1'), - ('', 'scroll_page 0 0.5'), - ('', 'scroll_page 0 -0.5'), - ('', 'focus_tab 1'), - ('', 'focus_tab 2'), - ('', 'focus_tab 3'), - ('', 'focus_tab 4'), - ('', 'focus_tab 5'), - ('', 'focus_tab 6'), - ('', 'focus_tab 7'), - ('', 'focus_tab 8'), - ('', 'focus_tab 9'), + ('', 'tab-close'), + ('', 'open-tab about:blank'), + ('', 'scroll-page 0 1'), + ('', 'scroll-page 0 -1'), + ('', 'scroll-page 0 0.5'), + ('', 'scroll-page 0 -0.5'), + ('', 'tab-focus 1'), + ('', 'tab-focus 2'), + ('', 'tab-focus 3'), + ('', 'tab-focus 4'), + ('', 'tab-focus 5'), + ('', 'tab-focus 6'), + ('', 'tab-focus 7'), + ('', 'tab-focus 8'), + ('', 'tab-focus 9'), ('', 'back'), ('', '${h}'), ('', '${j}'), @@ -671,32 +671,32 @@ DATA = OrderedDict([ ('keybind.insert', sect.ValueList( types.KeyBindingName(), types.KeyBinding(), - ('', 'leave_mode'), - ('', 'leave_mode'), - ('', 'open_editor'), + ('', 'leave-mode'), + ('', 'leave-mode'), + ('', 'open-editor'), )), ('keybind.hint', sect.ValueList( types.KeyBindingName(), types.KeyBinding(), - ('', 'follow_hint'), - ('', 'leave_mode'), - ('', 'leave_mode'), + ('', 'follow-hint'), + ('', 'leave-mode'), + ('', 'leave-mode'), )), ('keybind.passthrough', sect.ValueList( types.KeyBindingName(), types.KeyBinding(), - ('', 'leave_mode'), + ('', 'leave-mode'), )), ('keybind.command', sect.ValueList( types.KeyBindingName(), types.KeyBinding(), - ('', 'leave_mode'), - ('', 'leave_mode'), - ('', 'command_history_prev'), - ('', 'command_history_next'), - ('', 'completion_item_prev'), - ('', 'completion_item_next'), - ('', 'command_accept'), + ('', 'leave-mode'), + ('', 'leave-mode'), + ('', 'command-history-prev'), + ('', 'command-history-next'), + ('', 'completion-item-prev'), + ('', 'completion-item-next'), + ('', 'command-accept'), )), ('aliases', sect.ValueList( diff --git a/qutebrowser/keyinput/modeman.py b/qutebrowser/keyinput/modeman.py index 3aed56f7b..d6dbdfe68 100644 --- a/qutebrowser/keyinput/modeman.py +++ b/qutebrowser/keyinput/modeman.py @@ -173,7 +173,7 @@ class ModeManager(QObject): if passthrough: 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): """Enter a new mode. @@ -214,7 +214,7 @@ class ModeManager(QObject): self._mode_stack)) self.left.emit(mode) - @cmdutils.register(instance='modeman', name='leave_mode', + @cmdutils.register(instance='modeman', name='leave-mode', not_modes=['normal'], hide=True) def leave_current_mode(self): """Leave the mode we're currently in.""" diff --git a/qutebrowser/utils/debug.py b/qutebrowser/utils/debug.py index c43a4fd62..9b794c1d4 100644 --- a/qutebrowser/utils/debug.py +++ b/qutebrowser/utils/debug.py @@ -50,7 +50,7 @@ def log_events(klass): return klass -@cmdutils.register(name='settrace', hide=True) +@cmdutils.register(name='set-trace', hide=True) def set_trace(): """Set a tracepoint in the Python debugger that works with Qt. diff --git a/qutebrowser/widgets/_tabbedbrowser.py b/qutebrowser/widgets/_tabbedbrowser.py index adb2ddfbf..06a332737 100644 --- a/qutebrowser/widgets/_tabbedbrowser.py +++ b/qutebrowser/widgets/_tabbedbrowser.py @@ -224,7 +224,7 @@ class TabbedBrowser(TabWidget): def tabopen(self, url=None, background=None): """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. Args: @@ -287,11 +287,11 @@ class TabbedBrowser(TabWidget): for tab in self.widgets: 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): """Close the current/[count]th tab. - Command handler for :close. + Command handler for :tab-close. Args: count: The tab index to close, or None @@ -306,41 +306,40 @@ class TabbedBrowser(TabWidget): self._close_tab(tab) @cmdutils.register(instance='mainwindow.tabs') - def only(self): + def tab_only(self): """Close all tabs except for the current one.""" for tab in self.widgets: if tab is self.currentWidget(): continue self._close_tab(tab) - @cmdutils.register(instance='mainwindow.tabs', split=False, name='tabopen') - def tabopen_cmd(self, url): + @cmdutils.register(instance='mainwindow.tabs', split=False) + def open_tab(self, url): """Open a new tab with a given url.""" self.tabopen(url, background=False) - @cmdutils.register(instance='mainwindow.tabs', split=False, - name='backtabopen') - def backtabopen_cmd(self, url): + @cmdutils.register(instance='mainwindow.tabs', split=False) + def open_tab_bg(self, url): """Open a new tab in background.""" self.tabopen(url, background=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.""" 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) - def opencur(self): + def open_cur(self): """Set the statusbar to :open and the current URL.""" url = urlutils.urlstring(self.currentWidget().url()) message.set_cmd_text(':open ' + url) @cmdutils.register(instance='mainwindow.tabs', hide=True) - def backtabopencur(self): - """Set the statusbar to :backtabopen and the current URL.""" + def open_tab_bg_cur(self): + """Set the statusbar to :tabopen-bg and the current 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') def undo_close(self): @@ -353,11 +352,11 @@ class TabbedBrowser(TabWidget): else: 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): """Switch to the previous tab, or skip [count] tabs. - Command handler for :tabprev. + Command handler for :tab-prev. Args: count: How many tabs to switch back. @@ -370,11 +369,11 @@ class TabbedBrowser(TabWidget): else: 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): """Switch to the next tab, or skip [count] tabs. - Command handler for :tabnext. + Command handler for :tab-next. Args: count: How many tabs to switch forward. @@ -409,7 +408,7 @@ class TabbedBrowser(TabWidget): self.cur.openurl(url) @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. Command handler for :paste. @@ -420,7 +419,7 @@ class TabbedBrowser(TabWidget): self.paste(sel, True) @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]. Args: diff --git a/qutebrowser/widgets/statusbar/bar.py b/qutebrowser/widgets/statusbar/bar.py index f19da8eeb..ff3bf1e2e 100644 --- a/qutebrowser/widgets/statusbar/bar.py +++ b/qutebrowser/widgets/statusbar/bar.py @@ -181,7 +181,7 @@ class StatusBar(QWidget): self._text_pop_timer.start() 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. Args: @@ -219,7 +219,7 @@ class StatusBar(QWidget): self._text_pop_timer.start() @pyqtSlot(str, bool) - def disp_error(self, text, immediate): + def disp_error(self, text, immediate=False): """Display an error in the statusbar. Args: diff --git a/qutebrowser/widgets/webview.py b/qutebrowser/widgets/webview.py index 3a8a1c6e0..65865d2bd 100644 --- a/qutebrowser/widgets/webview.py +++ b/qutebrowser/widgets/webview.py @@ -37,7 +37,7 @@ from qutebrowser.utils.usertypes import NeighborList, enum from qutebrowser.commands.exceptions import CommandError -Target = enum('normal', 'tab', 'bgtab') +Target = enum('normal', 'tab', 'tab_bg') LoadStatus = enum('none', 'success', 'error', 'warn', 'loading') @@ -63,7 +63,7 @@ class WebView(QWebView): _zoom: A NeighborList with the zoom levels. _old_scroll_perc: The old scroll position. _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. _shutdown_callback: The callback to call after shutting down. _destroyed: Dict of all items to be destroyed on shtudown. @@ -267,7 +267,7 @@ class WebView(QWebView): elif (e.button() == Qt.MidButton or e.modifiers() & Qt.ControlModifier): if config.get('general', 'background-tabs'): - self._open_target = Target.bgtab + self._open_target = Target.tab_bg else: self._open_target = Target.tab logging.debug("Middle click, setting target: {}".format( @@ -381,7 +381,7 @@ class WebView(QWebView): """ if self._open_target == Target.tab: self.tabbedbrowser.tabopen(url, False) - elif self._open_target == Target.bgtab: + elif self._open_target == Target.tab_bg: self.tabbedbrowser.tabopen(url, True) else: self.openurl(url)