Revert "Use global HintManager"
This reverts commit a76d68f564
.
WTF. I thought I reset --hard-ed that one?
This commit is contained in:
parent
bbdbf95097
commit
e5000c315d
@ -63,7 +63,6 @@ from qutebrowser.commands.managers import CommandManager, SearchManager
|
|||||||
from qutebrowser.config.iniparsers import ReadWriteConfigParser
|
from qutebrowser.config.iniparsers import ReadWriteConfigParser
|
||||||
from qutebrowser.config.lineparser import LineConfigParser
|
from qutebrowser.config.lineparser import LineConfigParser
|
||||||
from qutebrowser.browser.cookies import CookieJar
|
from qutebrowser.browser.cookies import CookieJar
|
||||||
from qutebrowser.browser.hints import HintManager
|
|
||||||
from qutebrowser.utils.message import MessageBridge
|
from qutebrowser.utils.message import MessageBridge
|
||||||
from qutebrowser.utils.misc import dotted_getattr
|
from qutebrowser.utils.misc import dotted_getattr
|
||||||
from qutebrowser.utils.debug import set_trace # pylint: disable=unused-import
|
from qutebrowser.utils.debug import set_trace # pylint: disable=unused-import
|
||||||
@ -89,7 +88,6 @@ class QuteBrowser(QApplication):
|
|||||||
modeman: The global ModeManager instance.
|
modeman: The global ModeManager instance.
|
||||||
networkmanager: The global NetworkManager instance.
|
networkmanager: The global NetworkManager instance.
|
||||||
cookiejar: The global CookieJar instance.
|
cookiejar: The global CookieJar instance.
|
||||||
hintmanager: The global HintManager instance.
|
|
||||||
_keyparsers: A mapping from modes to keyparsers.
|
_keyparsers: A mapping from modes to keyparsers.
|
||||||
_dirs: AppDirs instance for config/cache directories.
|
_dirs: AppDirs instance for config/cache directories.
|
||||||
_args: ArgumentParser instance.
|
_args: ArgumentParser instance.
|
||||||
@ -129,7 +127,6 @@ class QuteBrowser(QApplication):
|
|||||||
self.networkmanager = NetworkManager(self.cookiejar)
|
self.networkmanager = NetworkManager(self.cookiejar)
|
||||||
self.commandmanager = CommandManager()
|
self.commandmanager = CommandManager()
|
||||||
self.searchmanager = SearchManager()
|
self.searchmanager = SearchManager()
|
||||||
self.hintmanager = HintManager()
|
|
||||||
self._init_cmds()
|
self._init_cmds()
|
||||||
self.mainwindow = MainWindow()
|
self.mainwindow = MainWindow()
|
||||||
|
|
||||||
@ -318,13 +315,10 @@ class QuteBrowser(QApplication):
|
|||||||
kp['normal'].keystring_updated.connect(status.keystring.setText)
|
kp['normal'].keystring_updated.connect(status.keystring.setText)
|
||||||
|
|
||||||
# hints
|
# hints
|
||||||
kp['hint'].fire_hint.connect(self.hintmanager.fire)
|
kp['hint'].fire_hint.connect(tabs.cur.fire_hint)
|
||||||
kp['hint'].filter_hints.connect(self.hintmanager.filter_hints)
|
kp['hint'].filter_hints.connect(tabs.cur.filter_hints)
|
||||||
kp['hint'].keystring_updated.connect(
|
kp['hint'].keystring_updated.connect(tabs.cur.handle_hint_key)
|
||||||
self.hintmanager.handle_partial_key)
|
tabs.hint_strings_updated.connect(kp['hint'].on_hint_strings_updated)
|
||||||
self.hintmanager.hint_strings_updated.connect(
|
|
||||||
kp['hint'].on_hint_strings_updated)
|
|
||||||
self.hintmanager.openurl.connect(tabs.cur.openurl_slot)
|
|
||||||
|
|
||||||
# messages
|
# messages
|
||||||
self.messagebridge.error.connect(status.disp_error)
|
self.messagebridge.error.connect(status.disp_error)
|
||||||
|
@ -241,8 +241,27 @@ class CurCommandDispatcher(QObject):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
message.error("Unknown hinting target {}!".format(targetstr))
|
message.error("Unknown hinting target {}!".format(targetstr))
|
||||||
return
|
return
|
||||||
QApplication.instance().hintmanager.start(frame, widget.url(), group,
|
widget.hintmanager.start(frame, widget.url(), group, target)
|
||||||
target)
|
|
||||||
|
@cmdutils.register(instance='mainwindow.tabs.cur', hide=True)
|
||||||
|
def follow_hint(self):
|
||||||
|
"""Follow the currently selected hint."""
|
||||||
|
self._tabs.currentWidget().hintmanager.follow_hint()
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def handle_hint_key(self, keystr):
|
||||||
|
"""Handle a new hint keypress."""
|
||||||
|
self._tabs.currentWidget().hintmanager.handle_partial_key(keystr)
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def fire_hint(self, keystr):
|
||||||
|
"""Fire a completed hint."""
|
||||||
|
self._tabs.currentWidget().hintmanager.fire(keystr)
|
||||||
|
|
||||||
|
@pyqtSlot(str)
|
||||||
|
def filter_hints(self, filterstr):
|
||||||
|
"""Filter displayed hints."""
|
||||||
|
self._tabs.currentWidget().hintmanager.filter_hints(filterstr)
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur')
|
@cmdutils.register(instance='mainwindow.tabs.cur')
|
||||||
def prevpage(self):
|
def prevpage(self):
|
||||||
|
@ -30,7 +30,6 @@ import qutebrowser.keyinput.modeman as modeman
|
|||||||
import qutebrowser.utils.message as message
|
import qutebrowser.utils.message as message
|
||||||
import qutebrowser.utils.url as urlutils
|
import qutebrowser.utils.url as urlutils
|
||||||
import qutebrowser.utils.webelem as webelem
|
import qutebrowser.utils.webelem as webelem
|
||||||
import qutebrowser.commands.utils as cmdutils
|
|
||||||
from qutebrowser.utils.usertypes import enum
|
from qutebrowser.utils.usertypes import enum
|
||||||
|
|
||||||
|
|
||||||
@ -381,7 +380,6 @@ class HintManager(QObject):
|
|||||||
self.hint_strings_updated.emit(strings)
|
self.hint_strings_updated.emit(strings)
|
||||||
modeman.enter('hint')
|
modeman.enter('hint')
|
||||||
|
|
||||||
@pyqtSlot(str)
|
|
||||||
def handle_partial_key(self, keystr):
|
def handle_partial_key(self, keystr):
|
||||||
"""Handle a new partial keypress."""
|
"""Handle a new partial keypress."""
|
||||||
delete = []
|
delete = []
|
||||||
@ -397,7 +395,6 @@ class HintManager(QObject):
|
|||||||
for key in delete:
|
for key in delete:
|
||||||
del self._elems[key]
|
del self._elems[key]
|
||||||
|
|
||||||
@pyqtSlot(str)
|
|
||||||
def filter_hints(self, filterstr):
|
def filter_hints(self, filterstr):
|
||||||
"""Filter displayed hints according to a text."""
|
"""Filter displayed hints according to a text."""
|
||||||
delete = []
|
delete = []
|
||||||
@ -414,7 +411,6 @@ class HintManager(QObject):
|
|||||||
# unpacking gets us the first (and only) key in the dict.
|
# unpacking gets us the first (and only) key in the dict.
|
||||||
self.fire(*self._elems)
|
self.fire(*self._elems)
|
||||||
|
|
||||||
@pyqtSlot(str)
|
|
||||||
def fire(self, keystr, force=False):
|
def fire(self, keystr, force=False):
|
||||||
"""Fire a completed hint.
|
"""Fire a completed hint.
|
||||||
|
|
||||||
@ -455,7 +451,6 @@ class HintManager(QObject):
|
|||||||
if self._target != Target.rapid:
|
if self._target != Target.rapid:
|
||||||
modeman.leave('hint')
|
modeman.leave('hint')
|
||||||
|
|
||||||
@cmdutils.register(instance='hintmanager', hide=True)
|
|
||||||
def follow_hint(self):
|
def follow_hint(self):
|
||||||
"""Follow the currently selected hint."""
|
"""Follow the currently selected hint."""
|
||||||
if not self._to_follow:
|
if not self._to_follow:
|
||||||
|
@ -66,6 +66,8 @@ class TabbedBrowser(TabWidget):
|
|||||||
cur_scroll_perc_changed: Scroll percentage of current tab changed.
|
cur_scroll_perc_changed: Scroll percentage of current tab changed.
|
||||||
arg 1: x-position in %.
|
arg 1: x-position in %.
|
||||||
arg 2: y-position in %.
|
arg 2: y-position in %.
|
||||||
|
hint_strings_updated: Hint strings were updated.
|
||||||
|
arg: A list of hint strings.
|
||||||
shutdown_complete: The shuttdown is completed.
|
shutdown_complete: The shuttdown is completed.
|
||||||
quit: The last tab was closed, quit application.
|
quit: The last tab was closed, quit application.
|
||||||
resized: Emitted when the browser window has resized, so the completion
|
resized: Emitted when the browser window has resized, so the completion
|
||||||
@ -80,6 +82,7 @@ class TabbedBrowser(TabWidget):
|
|||||||
cur_url_changed = pyqtSignal('QUrl')
|
cur_url_changed = pyqtSignal('QUrl')
|
||||||
cur_link_hovered = pyqtSignal(str, str, str)
|
cur_link_hovered = pyqtSignal(str, str, str)
|
||||||
cur_scroll_perc_changed = pyqtSignal(int, int)
|
cur_scroll_perc_changed = pyqtSignal(int, int)
|
||||||
|
hint_strings_updated = pyqtSignal(list)
|
||||||
shutdown_complete = pyqtSignal()
|
shutdown_complete = pyqtSignal()
|
||||||
quit = pyqtSignal()
|
quit = pyqtSignal()
|
||||||
resized = pyqtSignal('QRect')
|
resized = pyqtSignal('QRect')
|
||||||
@ -128,6 +131,9 @@ class TabbedBrowser(TabWidget):
|
|||||||
tab.scroll_pos_changed.connect(
|
tab.scroll_pos_changed.connect(
|
||||||
self._filter.create(self.cur_scroll_perc_changed))
|
self._filter.create(self.cur_scroll_perc_changed))
|
||||||
tab.urlChanged.connect(self._filter.create(self.cur_url_changed))
|
tab.urlChanged.connect(self._filter.create(self.cur_url_changed))
|
||||||
|
# hintmanager
|
||||||
|
tab.hintmanager.hint_strings_updated.connect(self.hint_strings_updated)
|
||||||
|
tab.hintmanager.openurl.connect(self.cur.openurl_slot)
|
||||||
# misc
|
# misc
|
||||||
tab.titleChanged.connect(self.on_title_changed)
|
tab.titleChanged.connect(self.on_title_changed)
|
||||||
tab.open_tab.connect(self.tabopen)
|
tab.open_tab.connect(self.tabopen)
|
||||||
|
Loading…
Reference in New Issue
Block a user