From 78060fc879ac9f99492e87cb8f0d9c5d0ace0d8f Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 22 Apr 2014 10:08:56 +0200 Subject: [PATCH] Get rid of temp_message signal --- TODO | 1 - qutebrowser/browser/curcommand.py | 22 ++++++---------------- qutebrowser/widgets/browsertab.py | 8 +------- qutebrowser/widgets/mainwindow.py | 1 - qutebrowser/widgets/tabbedbrowser.py | 4 ---- 5 files changed, 7 insertions(+), 29 deletions(-) diff --git a/TODO b/TODO index 17cd4f75d..d416d77bd 100644 --- a/TODO +++ b/TODO @@ -11,7 +11,6 @@ Style ===== Refactor completion widget mess (initializing / changing completions) -Check if we can get rid of temp_message Major features ============== diff --git a/qutebrowser/browser/curcommand.py b/qutebrowser/browser/curcommand.py index 26b30b33b..d6dd6f359 100644 --- a/qutebrowser/browser/curcommand.py +++ b/qutebrowser/browser/curcommand.py @@ -18,11 +18,12 @@ """The main tabbed browser widget.""" 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.QtPrintSupport import QPrintPreviewDialog import qutebrowser.utils.url as urlutils +import qutebrowser.utils.message as message import qutebrowser.commands.utils as cmdutils @@ -38,13 +39,8 @@ class CurCommandDispatcher(QObject): Attributes: _tabs: The TabbedBrowser object. - - Signals: - temp_message: Connected to TabbedBrowser signal. """ - temp_message = pyqtSignal(str) - def __init__(self, parent): """Constructor. @@ -266,16 +262,13 @@ class CurCommandDispatcher(QObject): Args: sel: True to use primary selection, False to use clipboard - - Emit: - temp_message to display a temporary message. """ clip = QApplication.clipboard() url = urlutils.urlstring(self._tabs.currentWidget().url()) mode = QClipboard.Selection if sel else QClipboard.Clipboard clip.setText(url, mode) - self.temp_message.emit('URL yanked to {}'.format( - 'primary selection' if sel else 'clipboard')) + message.info('URL yanked to {}'.format('primary selection' if sel + else 'clipboard')) @cmdutils.register(instance='mainwindow.tabs.cur', name='yanktitle') def yank_title(self, sel=False): @@ -285,16 +278,13 @@ class CurCommandDispatcher(QObject): Args: sel: True to use primary selection, False to use clipboard - - Emit: - temp_message to display a temporary message. """ clip = QApplication.clipboard() title = self._tabs.tabText(self._tabs.currentIndex()) mode = QClipboard.Selection if sel else QClipboard.Clipboard clip.setText(title, mode) - self.temp_message.emit('Title yanked to {}'.format( - 'primary selection' if sel else 'clipboard')) + message.info('Title yanked to {}'.format('primary selection' if sel + else 'clipboard')) @cmdutils.register(instance='mainwindow.tabs.cur', name='zoomin') def zoom_in(self, count=1): diff --git a/qutebrowser/widgets/browsertab.py b/qutebrowser/widgets/browsertab.py index cf676d977..1278aca93 100644 --- a/qutebrowser/widgets/browsertab.py +++ b/qutebrowser/widgets/browsertab.py @@ -60,14 +60,11 @@ class BrowserTab(QWebView): arg 1: The address to open arg 2: Whether to open the tab in the background 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) open_tab = pyqtSignal('QUrl', bool) linkHovered = pyqtSignal(str, str, str) - temp_message = pyqtSignal(str) def __init__(self, parent=None): super().__init__(parent) @@ -123,13 +120,10 @@ class BrowserTab(QWebView): Args: offset: The offset in the zoom level list. - - Emit: - temp_message: Emitted with new zoom level. """ level = self._zoom.getitem(offset) self.setZoomFactor(float(level) / 100) - self.temp_message.emit("Zoom level: {}%".format(level)) + message.info("Zoom level: {}%".format(level)) @pyqtSlot(str) def on_link_clicked(self, url): diff --git a/qutebrowser/widgets/mainwindow.py b/qutebrowser/widgets/mainwindow.py index cf604e571..eb10b51c9 100644 --- a/qutebrowser/widgets/mainwindow.py +++ b/qutebrowser/widgets/mainwindow.py @@ -86,7 +86,6 @@ class MainWindow(QWidget): self.status.percentage.set_perc) self.tabs.cur_statusbar_message.connect( 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_link_hovered.connect(self.status.url.set_hover_url) self.tabs.currentChanged.connect(self.update_inspector) diff --git a/qutebrowser/widgets/tabbedbrowser.py b/qutebrowser/widgets/tabbedbrowser.py index 6b555397f..1a2ebb232 100644 --- a/qutebrowser/widgets/tabbedbrowser.py +++ b/qutebrowser/widgets/tabbedbrowser.py @@ -62,7 +62,6 @@ class TabbedBrowser(TabWidget): cur_load_finished: Current tab finished loading (loadFinished) cur_statusbar_message: Current tab got a statusbar message (statusBarMessage) - cur_temp_message: Current tab needs to show a temporary message. cur_url_changed: Current URL changed (urlChanged) cur_link_hovered: Link hovered in current tab (linkHovered) cur_scroll_perc_changed: Scroll percentage of current tab changed. @@ -84,7 +83,6 @@ class TabbedBrowser(TabWidget): cur_progress = pyqtSignal(int) cur_load_started = pyqtSignal() cur_load_finished = pyqtSignal(bool) - cur_temp_message = pyqtSignal(str) cur_statusbar_message = pyqtSignal(str) cur_url_changed = pyqtSignal('QUrl') 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._filter = SignalFilter(self) self.cur = CurCommandDispatcher(self) - self.cur.temp_message.connect(self.cur_temp_message) def _cb_tab_shutdown(self, tab): """Called after a tab has been shut down completely. @@ -242,7 +239,6 @@ class TabbedBrowser(TabWidget): self._filter.create(self.cur_statusbar_message)) tab.scroll_pos_changed.connect( 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.titleChanged.connect(self._titleChanged_handler) tab.hintmanager.hint_strings_updated.connect(self.hint_strings_updated)