How to use the envisage.ui.tasks.task_window_event.TaskWindowEvent function in envisage

To help you get started, we’ve selected a few envisage examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enthought / envisage / envisage / ui / tasks / tasks_application.py View on Github external
"""
        from .task_window_event import TaskWindowEvent
        from pyface.tasks.task_window_layout import TaskWindowLayout

        window = self.window_factory(application=self, **traits)

        # Listen for the window events.
        window.on_trait_change(self._on_window_activated, "activated")
        window.on_trait_change(self._on_window_opening, "opening")
        window.on_trait_change(self._on_window_opened, "opened")
        window.on_trait_change(self._on_window_closing, "closing")
        window.on_trait_change(self._on_window_closed, "closed")

        # Event notification.
        self.window_created = TaskWindowEvent(window=window)

        if layout:
            # Create and add tasks.
            for task_id in layout.get_tasks():
                task = self.create_task(task_id)
                if task:
                    window.add_task(task)
                else:
                    logger.error(
                        "Missing factory for task with ID %r", task_id
                    )

            # Apply a suitable layout.
            if restore:
                layout = self._restore_layout_from_state(layout)
        else:
github enthought / envisage / envisage / ui / tasks / tasks_application.py View on Github external
def _on_window_opened(self, window, trait_name, event):
        from .task_window_event import TaskWindowEvent

        self.windows.append(window)

        # Event notification.
        self.window_opened = TaskWindowEvent(window=window)
github robmcmullen / omnivore / omnivore_framework / old-pyface-stuff / framework / application.py View on Github external
def _on_window_closed(self, window, trait_name, event):
            self.windows.remove(window)

            # Event notification.
            self.window_closed = TaskWindowEvent(window=window)

            # Was this the last window?
            if len(self.windows) == 0 and self._explicit_exit:
                self.stop()
github NMGRL / pychron / pychron / envisage / tasks / base_tasks_application.py View on Github external
def _on_window_closed(self, window, trait_name, event):
        self.windows.remove(window)

        # Event notification.
        self.window_closed = TaskWindowEvent(window=window)

        # Was this the last window?
        if len(self.windows) == 0:
            self.stop()
github enthought / envisage / envisage / ui / tasks / tasks_application.py View on Github external
def _on_window_closed(self, window, trait_name, event):
        from .task_window_event import TaskWindowEvent

        self.windows.remove(window)

        # Event notification.
        self.window_closed = TaskWindowEvent(window=window)

        # Was this the last window?
        if len(self.windows) == 0:
            self.stop()
github enthought / envisage / envisage / ui / tasks / task_window_event.py View on Github external
# Enthought library imports.
from traits.api import HasTraits, Instance, Vetoable

# Local imports.
from .task_window import TaskWindow


class TaskWindowEvent(HasTraits):
    """ A task window lifecycle event.
    """

    # The window that the event occurred on.
    window = Instance(TaskWindow)


class VetoableTaskWindowEvent(TaskWindowEvent, Vetoable):
    """ A vetoable task window lifecycle event.
    """

    pass
github robmcmullen / omnivore / omnimon / framework / application.py View on Github external
def _on_window_closed(self, window, trait_name, event):
            self.windows.remove(window)

            # Event notification.
            self.window_closed = TaskWindowEvent(window=window)

            # Was this the last window?
            if len(self.windows) == 0 and self._explicit_exit:
                self.stop()