| 1 |
# (C) Copyright 2007-2025 Enthought, Inc., Austin, TX |
| 2 |
# All rights reserved. |
| 3 |
# |
| 4 |
# This software is provided without warranty under the terms of the BSD |
| 5 |
# license included in LICENSE.txt and may be redistributed only under |
| 6 |
# the conditions described in the aforementioned license. The license |
| 7 |
# is also available online at http://www.enthought.com/licenses/BSD.txt |
| 8 |
# |
| 9 |
# Thanks for using Enthought open source! |
| 10 |
|
| 11 |
# Local imports. |
| 12 |
from attractors.attractors_preferences import AttractorsPreferences |
| 13 |
|
| 14 |
from pyface.tasks.api import TaskWindowLayout |
| 15 |
from traits.api import Bool, Instance, List, Property |
| 16 |
|
| 17 |
# Enthought library imports. |
| 18 |
from envisage.ui.tasks.api import TasksApplication |
| 19 |
|
| 20 |
|
| 21 |
class AttractorsApplication(TasksApplication): |
| 22 |
"""The chaotic attractors Tasks application.""" |
| 23 |
|
| 24 |
#### 'IApplication' interface ############################################# |
| 25 |
|
| 26 |
# The application's globally unique identifier. |
| 27 |
id = "example.attractors" |
| 28 |
|
| 29 |
# The application's user-visible name. |
| 30 |
name = "Attractors" |
| 31 |
|
| 32 |
#### 'TasksApplication' interface ######################################### |
| 33 |
|
| 34 |
# The default window-level layout for the application. |
| 35 |
default_layout = List(TaskWindowLayout) |
| 36 |
|
| 37 |
# Whether to restore the previous application-level layout when the |
| 38 |
# applicaton is started. |
| 39 |
always_use_default_layout = Property(Bool) |
| 40 |
|
| 41 |
#### 'AttractorsApplication' interface #################################### |
| 42 |
|
| 43 |
preferences_helper = Instance(AttractorsPreferences) |
| 44 |
|
| 45 |
########################################################################### |
| 46 |
# Private interface. |
| 47 |
########################################################################### |
| 48 |
|
| 49 |
#### Trait initializers ################################################### |
| 50 |
|
| 51 |
def _default_layout_default(self): |
| 52 |
active_task = self.preferences_helper.default_task |
| 53 |
tasks = [factory.id for factory in self.task_factories] |
| 54 |
return [ |
| 55 |
TaskWindowLayout(*tasks, active_task=active_task, size=(800, 600)) |
| 56 |
] |
| 57 |
|
| 58 |
def _preferences_helper_default(self): |
| 59 |
return AttractorsPreferences(preferences=self.preferences) |
| 60 |
|
| 61 |
#### Trait property getter/setters ######################################## |
| 62 |
|
| 63 |
def _get_always_use_default_layout(self): |
| 64 |
return self.preferences_helper.always_use_default_layout |