-
-
Notifications
You must be signed in to change notification settings - Fork 131
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add CloseEvent to DockItem #303
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,8 @@ | |
from atom.api import Typed, atomref | ||
|
||
from enaml.layout.geometry import Pos, Rect, Size | ||
from enaml.widgets.window import ProxyWindow, CloseEvent | ||
from enaml.widgets.window import ProxyWindow | ||
from enaml.widgets.close_event import CloseEvent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
|
||
from .QtCore import Qt, QPoint, QRect, QSize | ||
from .QtGui import QIcon | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
from atom.api import Atom, Bool | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This file needs a copyright header. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is always a bit unclear to me but can the copyright mention 2013 when the file was created only in 2018 ? |
||
|
||
|
||
class CloseEvent(Atom): | ||
""" An payload object carried by a widget 'closing' event. | ||
|
||
User code can manipulate this object to veto a close event. | ||
|
||
""" | ||
#: The internal accepted state. | ||
_accepted = Bool(True) | ||
|
||
def is_accepted(self): | ||
""" Get whether or not the event is accepted. | ||
|
||
Returns | ||
------- | ||
result : bool | ||
True if the event is accepted, False otherwise. The | ||
default is True. | ||
|
||
""" | ||
return self._accepted | ||
|
||
def accept(self): | ||
""" Accept the close event and allow the widget to be closed. | ||
|
||
""" | ||
self._accepted = True | ||
|
||
def ignore(self): | ||
""" Reject the close event and prevent the widget from closing. | ||
|
||
""" | ||
self._accepted = False |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,6 +15,7 @@ | |
from enaml.layout.geometry import Pos, Rect, Size | ||
|
||
from .container import Container | ||
from .close_event import CloseEvent | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should be imported before |
||
from .widget import Widget, ProxyWidget | ||
|
||
|
||
|
@@ -89,40 +90,6 @@ def close(self): | |
raise NotImplementedError | ||
|
||
|
||
class CloseEvent(Atom): | ||
""" An payload object carried by a window 'closing' event. | ||
|
||
User code can manipulate this object to veto a close event. | ||
|
||
""" | ||
#: The internal accepted state. | ||
_accepted = Bool(True) | ||
|
||
def is_accepted(self): | ||
""" Get whether or not the event is accepted. | ||
|
||
Returns | ||
------- | ||
result : bool | ||
True if the event is accepted, False otherwise. The | ||
default is True. | ||
|
||
""" | ||
return self._accepted | ||
|
||
def accept(self): | ||
""" Accept the close event and allow the window to be closed. | ||
|
||
""" | ||
self._accepted = True | ||
|
||
def ignore(self): | ||
""" Reject the close event and prevent the window from closing. | ||
|
||
""" | ||
self._accepted = False | ||
|
||
|
||
class Window(Widget): | ||
""" A top-level Window component. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there. This is the last one that's out of order.