Get rid of temp_message signal
This commit is contained in:
parent
e1b7305e40
commit
78060fc879
1
TODO
1
TODO
@ -11,7 +11,6 @@ Style
|
|||||||
=====
|
=====
|
||||||
|
|
||||||
Refactor completion widget mess (initializing / changing completions)
|
Refactor completion widget mess (initializing / changing completions)
|
||||||
Check if we can get rid of temp_message
|
|
||||||
|
|
||||||
Major features
|
Major features
|
||||||
==============
|
==============
|
||||||
|
@ -18,11 +18,12 @@
|
|||||||
"""The main tabbed browser widget."""
|
"""The main tabbed browser widget."""
|
||||||
|
|
||||||
from PyQt5.QtWidgets import QApplication
|
from PyQt5.QtWidgets import QApplication
|
||||||
from PyQt5.QtCore import pyqtSignal, pyqtSlot, Qt, QObject
|
from PyQt5.QtCore import pyqtSlot, Qt, QObject
|
||||||
from PyQt5.QtGui import QClipboard
|
from PyQt5.QtGui import QClipboard
|
||||||
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
from PyQt5.QtPrintSupport import QPrintPreviewDialog
|
||||||
|
|
||||||
import qutebrowser.utils.url as urlutils
|
import qutebrowser.utils.url as urlutils
|
||||||
|
import qutebrowser.utils.message as message
|
||||||
import qutebrowser.commands.utils as cmdutils
|
import qutebrowser.commands.utils as cmdutils
|
||||||
|
|
||||||
|
|
||||||
@ -38,13 +39,8 @@ class CurCommandDispatcher(QObject):
|
|||||||
|
|
||||||
Attributes:
|
Attributes:
|
||||||
_tabs: The TabbedBrowser object.
|
_tabs: The TabbedBrowser object.
|
||||||
|
|
||||||
Signals:
|
|
||||||
temp_message: Connected to TabbedBrowser signal.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
temp_message = pyqtSignal(str)
|
|
||||||
|
|
||||||
def __init__(self, parent):
|
def __init__(self, parent):
|
||||||
"""Constructor.
|
"""Constructor.
|
||||||
|
|
||||||
@ -266,16 +262,13 @@ class CurCommandDispatcher(QObject):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
sel: True to use primary selection, False to use clipboard
|
sel: True to use primary selection, False to use clipboard
|
||||||
|
|
||||||
Emit:
|
|
||||||
temp_message to display a temporary message.
|
|
||||||
"""
|
"""
|
||||||
clip = QApplication.clipboard()
|
clip = QApplication.clipboard()
|
||||||
url = urlutils.urlstring(self._tabs.currentWidget().url())
|
url = urlutils.urlstring(self._tabs.currentWidget().url())
|
||||||
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
||||||
clip.setText(url, mode)
|
clip.setText(url, mode)
|
||||||
self.temp_message.emit('URL yanked to {}'.format(
|
message.info('URL yanked to {}'.format('primary selection' if sel
|
||||||
'primary selection' if sel else 'clipboard'))
|
else 'clipboard'))
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='yanktitle')
|
@cmdutils.register(instance='mainwindow.tabs.cur', name='yanktitle')
|
||||||
def yank_title(self, sel=False):
|
def yank_title(self, sel=False):
|
||||||
@ -285,16 +278,13 @@ class CurCommandDispatcher(QObject):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
sel: True to use primary selection, False to use clipboard
|
sel: True to use primary selection, False to use clipboard
|
||||||
|
|
||||||
Emit:
|
|
||||||
temp_message to display a temporary message.
|
|
||||||
"""
|
"""
|
||||||
clip = QApplication.clipboard()
|
clip = QApplication.clipboard()
|
||||||
title = self._tabs.tabText(self._tabs.currentIndex())
|
title = self._tabs.tabText(self._tabs.currentIndex())
|
||||||
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
mode = QClipboard.Selection if sel else QClipboard.Clipboard
|
||||||
clip.setText(title, mode)
|
clip.setText(title, mode)
|
||||||
self.temp_message.emit('Title yanked to {}'.format(
|
message.info('Title yanked to {}'.format('primary selection' if sel
|
||||||
'primary selection' if sel else 'clipboard'))
|
else 'clipboard'))
|
||||||
|
|
||||||
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoomin')
|
@cmdutils.register(instance='mainwindow.tabs.cur', name='zoomin')
|
||||||
def zoom_in(self, count=1):
|
def zoom_in(self, count=1):
|
||||||
|
@ -60,14 +60,11 @@ class BrowserTab(QWebView):
|
|||||||
arg 1: The address to open
|
arg 1: The address to open
|
||||||
arg 2: Whether to open the tab in the background
|
arg 2: Whether to open the tab in the background
|
||||||
linkHovered: QWebPages linkHovered signal exposed.
|
linkHovered: QWebPages linkHovered signal exposed.
|
||||||
temp_message: Show a temporary message in the statusbar.
|
|
||||||
arg: Message to be shown.
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
scroll_pos_changed = pyqtSignal(int, int)
|
scroll_pos_changed = pyqtSignal(int, int)
|
||||||
open_tab = pyqtSignal('QUrl', bool)
|
open_tab = pyqtSignal('QUrl', bool)
|
||||||
linkHovered = pyqtSignal(str, str, str)
|
linkHovered = pyqtSignal(str, str, str)
|
||||||
temp_message = pyqtSignal(str)
|
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
super().__init__(parent)
|
super().__init__(parent)
|
||||||
@ -123,13 +120,10 @@ class BrowserTab(QWebView):
|
|||||||
|
|
||||||
Args:
|
Args:
|
||||||
offset: The offset in the zoom level list.
|
offset: The offset in the zoom level list.
|
||||||
|
|
||||||
Emit:
|
|
||||||
temp_message: Emitted with new zoom level.
|
|
||||||
"""
|
"""
|
||||||
level = self._zoom.getitem(offset)
|
level = self._zoom.getitem(offset)
|
||||||
self.setZoomFactor(float(level) / 100)
|
self.setZoomFactor(float(level) / 100)
|
||||||
self.temp_message.emit("Zoom level: {}%".format(level))
|
message.info("Zoom level: {}%".format(level))
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def on_link_clicked(self, url):
|
def on_link_clicked(self, url):
|
||||||
|
@ -86,7 +86,6 @@ class MainWindow(QWidget):
|
|||||||
self.status.percentage.set_perc)
|
self.status.percentage.set_perc)
|
||||||
self.tabs.cur_statusbar_message.connect(
|
self.tabs.cur_statusbar_message.connect(
|
||||||
self.status.txt.on_statusbar_message)
|
self.status.txt.on_statusbar_message)
|
||||||
self.tabs.cur_temp_message.connect(self.status.txt.set_temptext)
|
|
||||||
self.tabs.cur_url_changed.connect(self.status.url.set_url)
|
self.tabs.cur_url_changed.connect(self.status.url.set_url)
|
||||||
self.tabs.cur_link_hovered.connect(self.status.url.set_hover_url)
|
self.tabs.cur_link_hovered.connect(self.status.url.set_hover_url)
|
||||||
self.tabs.currentChanged.connect(self.update_inspector)
|
self.tabs.currentChanged.connect(self.update_inspector)
|
||||||
|
@ -62,7 +62,6 @@ class TabbedBrowser(TabWidget):
|
|||||||
cur_load_finished: Current tab finished loading (loadFinished)
|
cur_load_finished: Current tab finished loading (loadFinished)
|
||||||
cur_statusbar_message: Current tab got a statusbar message
|
cur_statusbar_message: Current tab got a statusbar message
|
||||||
(statusBarMessage)
|
(statusBarMessage)
|
||||||
cur_temp_message: Current tab needs to show a temporary message.
|
|
||||||
cur_url_changed: Current URL changed (urlChanged)
|
cur_url_changed: Current URL changed (urlChanged)
|
||||||
cur_link_hovered: Link hovered in current tab (linkHovered)
|
cur_link_hovered: Link hovered in current tab (linkHovered)
|
||||||
cur_scroll_perc_changed: Scroll percentage of current tab changed.
|
cur_scroll_perc_changed: Scroll percentage of current tab changed.
|
||||||
@ -84,7 +83,6 @@ class TabbedBrowser(TabWidget):
|
|||||||
cur_progress = pyqtSignal(int)
|
cur_progress = pyqtSignal(int)
|
||||||
cur_load_started = pyqtSignal()
|
cur_load_started = pyqtSignal()
|
||||||
cur_load_finished = pyqtSignal(bool)
|
cur_load_finished = pyqtSignal(bool)
|
||||||
cur_temp_message = pyqtSignal(str)
|
|
||||||
cur_statusbar_message = pyqtSignal(str)
|
cur_statusbar_message = pyqtSignal(str)
|
||||||
cur_url_changed = pyqtSignal('QUrl')
|
cur_url_changed = pyqtSignal('QUrl')
|
||||||
cur_link_hovered = pyqtSignal(str, str, str)
|
cur_link_hovered = pyqtSignal(str, str, str)
|
||||||
@ -110,7 +108,6 @@ class TabbedBrowser(TabWidget):
|
|||||||
self._space.activated.connect(lambda: self.cur.scroll_page(0, 1))
|
self._space.activated.connect(lambda: self.cur.scroll_page(0, 1))
|
||||||
self._filter = SignalFilter(self)
|
self._filter = SignalFilter(self)
|
||||||
self.cur = CurCommandDispatcher(self)
|
self.cur = CurCommandDispatcher(self)
|
||||||
self.cur.temp_message.connect(self.cur_temp_message)
|
|
||||||
|
|
||||||
def _cb_tab_shutdown(self, tab):
|
def _cb_tab_shutdown(self, tab):
|
||||||
"""Called after a tab has been shut down completely.
|
"""Called after a tab has been shut down completely.
|
||||||
@ -242,7 +239,6 @@ class TabbedBrowser(TabWidget):
|
|||||||
self._filter.create(self.cur_statusbar_message))
|
self._filter.create(self.cur_statusbar_message))
|
||||||
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.temp_message.connect(self._filter.create(self.cur_temp_message))
|
|
||||||
tab.urlChanged.connect(self._filter.create(self.cur_url_changed))
|
tab.urlChanged.connect(self._filter.create(self.cur_url_changed))
|
||||||
tab.titleChanged.connect(self._titleChanged_handler)
|
tab.titleChanged.connect(self._titleChanged_handler)
|
||||||
tab.hintmanager.hint_strings_updated.connect(self.hint_strings_updated)
|
tab.hintmanager.hint_strings_updated.connect(self.hint_strings_updated)
|
||||||
|
Loading…
Reference in New Issue
Block a user