diff --git a/enaml/qt/q_popup_view.py b/enaml/qt/q_popup_view.py index a54e4278a..2d9b1fa79 100644 --- a/enaml/qt/q_popup_view.py +++ b/enaml/qt/q_popup_view.py @@ -826,7 +826,7 @@ def mousePressEvent(self, event): if not path.isEmpty() and not path.contains(pos): event.accept() self.close() - elif win_type == Qt.ToolTip: + elif win_type == Qt.ToolTip or win_type == Qt.Window: if path.isEmpty() or path.contains(pos): event.accept() self.close() diff --git a/enaml/qt/qt_popup_view.py b/enaml/qt/qt_popup_view.py index 0a219788b..0eb800533 100644 --- a/enaml/qt/qt_popup_view.py +++ b/enaml/qt/qt_popup_view.py @@ -26,6 +26,7 @@ WINDOW_TYPES = { 'popup': Qt.Popup, 'tool_tip': Qt.ToolTip, + 'window': Qt.Window, } diff --git a/enaml/widgets/popup_view.py b/enaml/widgets/popup_view.py index 7f3d82331..f1fa12e5f 100644 --- a/enaml/widgets/popup_view.py +++ b/enaml/widgets/popup_view.py @@ -97,13 +97,24 @@ class PopupView(Widget): #: reference to a transient popup. popup_views = [] - #: The type of the window to create. A 'popup' window will close - #: when the user presses escape or clicks outside of the window. - #: A 'tool_tip' window will close when the user clicks the window. - #: The popup window is useful for showing configuration dialogs, - #: while the tool tip window is useful for notification messages. - #: The window type cannot be changed once the widget is created. - window_type = d_(Enum('popup', 'tool_tip')) + #: The type of the window to create. Each has different behavior. The + #: window type cannot be changed after the widget is created. + #: + #: 'popup' + #: This window will close when the user presses escape or clicks + #: outside of the window. It will block all external interactions + #: until it is closed. + #: + #: 'tool_tip' + #: This window will close when the user clicks inside the window. + #: It stays on top of all the other windows on the desktop. It is + #: useful for showing mouse cursor or desktop notifications. + #: + #: 'window' + #: This window will close when the user clicks inside the window. + #: It stays on top of its parent, but not the other windows on + #: the desktop. It is useful for notifications inside a window. + window_type = d_(Enum('popup', 'tool_tip', 'window')) #: The mode to use for anchoring. The 'parent' mode uses a point #: on the parent or the desktop as the target anchor, the 'cursor' @@ -153,7 +164,7 @@ class PopupView(Widget): #: Whether or not close the popup view on a mouse click. For 'popup' #: windows, this means clicking outside of the view. For 'tool_tip' - #: windows, this means clicking inside of the view. + #: and 'window' windows, this means clicking inside of the view. close_on_click = d_(Bool(True)) #: Whether or not the background of the popup view is translucent. diff --git a/examples/widgets/popup_view.enaml b/examples/widgets/popup_view.enaml index a3ffe1a8d..f682211e5 100644 --- a/examples/widgets/popup_view.enaml +++ b/examples/widgets/popup_view.enaml @@ -116,7 +116,7 @@ enamldef Main(Window): win: clicked :: ConfigPopup(self).show() PushButton: text = 'Show Window Notification' - clicked :: NotificationPopup(win).show() + clicked :: NotificationPopup(win, window_type='window').show() PushButton: text = 'Show Desktop Notification' clicked :: NotificationPopup().show()