Merge commit 'd3b16bbd075f9e8c8656a402975d776088c2dab8' into pkill-nine/upstream-master-close_messages

This commit is contained in:
Florian Bruhin 2017-03-08 19:19:30 +01:00
commit eb2888a957
4 changed files with 11 additions and 2 deletions

View File

@ -438,6 +438,8 @@ class MainWindow(QWidget):
message.global_bridge.show_message.connect(
self._messageview.show_message)
message.global_bridge.flush()
message.global_bridge.clear_messages.connect(
self._messageview.clear_messages)
message_bridge.s_set_text.connect(status.set_text)
message_bridge.s_maybe_reset_text.connect(status.txt.maybe_reset_text)

View File

@ -82,7 +82,7 @@ class MessageView(QWidget):
self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed)
self._clear_timer = QTimer()
self._clear_timer.timeout.connect(self._clear_messages)
self._clear_timer.timeout.connect(self.clear_messages)
self._set_clear_timer_interval()
objreg.get('config').changed.connect(self._set_clear_timer_interval)
@ -101,7 +101,7 @@ class MessageView(QWidget):
self._clear_timer.setInterval(config.get('ui', 'message-timeout'))
@pyqtSlot()
def _clear_messages(self):
def clear_messages(self):
"""Hide and delete all messages."""
for widget in self._messages:
self._vbox.removeWidget(widget)

View File

@ -137,6 +137,12 @@ def message_warning(text):
message.warning(text)
@cmdutils.register(hide=True)
def clear_messages():
"""Clear all message notifications."""
message.global_bridge.clear_messages.emit()
@cmdutils.register(debug=True)
@cmdutils.argument('typ', choices=['exception', 'segfault'])
def debug_crash(typ='exception'):

View File

@ -194,6 +194,7 @@ class GlobalMessageBridge(QObject):
prompt_done = pyqtSignal(usertypes.KeyMode)
ask_question = pyqtSignal(usertypes.Question, bool)
mode_left = pyqtSignal(usertypes.KeyMode)
clear_messages = pyqtSignal()
def __init__(self, parent=None):
super().__init__(parent)