Skip to content
This repository has been archived by the owner on May 24, 2021. It is now read-only.

Commit

Permalink
Add a destroy_on_close flag to the base Window class.
Browse files Browse the repository at this point in the history
  • Loading branch information
sccolbert committed Jan 22, 2013
1 parent 79cb115 commit 2a63e8c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion enaml/widgets/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Copyright (c) 2012, Enthought, Inc.
# All rights reserved.
#------------------------------------------------------------------------------
from traits.api import Unicode, Enum, Property, Str, cached_property
from traits.api import Unicode, Enum, Property, Str, Bool, cached_property

from enaml.core.trait_types import EnamlEvent

Expand Down Expand Up @@ -33,6 +33,10 @@ class Window(Widget):
#: value is 'non_modal'.
modality = Enum('non_modal', 'application_modal', 'window_modal')

#: If this value is set to True, the window will be destroyed on
#: the completion of the `closed` event.
destroy_on_close = Bool(True)

#: An event fired when the window is closed.
closed = EnamlEvent

Expand Down Expand Up @@ -91,6 +95,8 @@ def on_action_closed(self, content):
"""
self.closed()
if self.destroy_on_close:
self.destroy()

#--------------------------------------------------------------------------
# Public API
Expand Down

0 comments on commit 2a63e8c

Please sign in to comment.