Skip to content

Commit 687faa6

Browse files
committed
Word-wrap on, and timeout=None will show forever
1 parent 4c0c4ae commit 687faa6

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

QNotifications/QNotification.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def __init__(self, message, category, *args, **kwargs):
6464
# Create the layout
6565
self.message_display = QtWidgets.QLabel()
6666
self.message_display.setObjectName("message")
67+
self.message_display.setWordWrap(True)
6768

6869
# Create a button that can close notifications
6970
close_button = QtWidgets.QPushButton(u"\u2715")

QNotifications/QNotificationArea.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def setExitEffect(self, effect, duration=500):
175175

176176
# Events
177177
@QtCore.pyqtSlot('QString', 'QString', int)
178-
def display(self, message, category, timeout=0):
178+
def display(self, message, category, timeout=5000):
179179
""" Displays a notification
180180
181181
Parameters
@@ -185,8 +185,8 @@ def display(self, message, category, timeout=0):
185185
category : str
186186
The type of notification that should be shown. Adheres to bootstrap
187187
standards which are [primary, success, info, warning, danger]
188-
timeout : int (default: 0)
189-
The duration for which the notification should be shown. If 0 then
188+
timeout : int (default: 5000)
189+
The duration for which the notification should be shown. If None then
190190
the notification will be shown indefinitely
191191
"""
192192
notification = QNotification(message, category, self)
@@ -200,7 +200,7 @@ def display(self, message, category, timeout=0):
200200
notification.display()
201201

202202
self.adjustSize()
203-
if timeout > 0:
203+
if not timeout is None and timeout > 0:
204204
QtCore.QTimer.singleShot(timeout,
205205
lambda : self.remove(notification))
206206

0 commit comments

Comments
 (0)