Skip to content
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

Update Trait Types #728

Merged
merged 6 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions pyface/tasks/task_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


from traits.api import (
Either, Enum, HasStrictTraits, Int, Instance, List, Str, Union,
Enum, HasStrictTraits, Int, Instance, List, Str, Union,
)


Expand Down Expand Up @@ -151,7 +151,7 @@ class Splitter(LayoutContainer):
#: The sub-items of the splitter, which are PaneItems, Tabbed layouts, and
#: other Splitters.
items = List(
Either(
Union(
Instance(PaneItem),
Instance(Tabbed),
Instance("pyface.tasks.task_layout.Splitter"),
Expand All @@ -178,11 +178,11 @@ class DockLayout(LayoutItem):
""" The layout for a main window's dock area.
"""

#: The layouts for the task's dock panes.
left = Either(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
right = Either(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
top = Either(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
bottom = Either(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
# The layouts for the task's dock panes.
left = Union(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
right = Union(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
top = Union(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))
bottom = Union(Instance(PaneItem), Instance(Tabbed), Instance(Splitter))

#: Assignments of dock areas to the window's corners. By default, the top
#: and bottom dock areas extend into both of the top and both of the
Expand Down
2 changes: 1 addition & 1 deletion pyface/tasks/task_window_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class TaskWindowLayout(LayoutContainer):

#: The tasks contained in the window. If an ID is specified, the task will
#: use its default layout. Otherwise, it will use the specified TaskLayout
items = List(Either(Str, Instance(TaskLayout)), pretty_skip=True)
items = List(Union(Str, Instance(TaskLayout)), pretty_skip=True)

#: The position of the window.
position = Tuple(-1, -1)
Expand Down
1 change: 1 addition & 0 deletions pyface/timer/i_timer.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
Property,
Range,
Tuple,
Union,
corranwebster marked this conversation as resolved.
Show resolved Hide resolved
provides,
Union,
)
Expand Down
4 changes: 2 additions & 2 deletions pyface/ui/qt4/fields/text_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
""" The Qt-specific implementation of the text field class """


from traits.api import Trait, provides
from traits.api import Map, provides

from pyface.fields.i_text_field import ITextField, MTextField
from pyface.qt.QtGui import QLineEdit
Expand All @@ -29,7 +29,7 @@
}

# mapped trait for Qt line edit echo modes
Echo = Trait("normal", ECHO_TO_QT_ECHO_MODE)
Echo = Map(ECHO_TO_QT_ECHO_MODE, default_value="normal")


@provides(ITextField)
Expand Down
3 changes: 1 addition & 2 deletions pyface/ui/wx/grid/trait_grid_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
Bool,
Callable,
Dict,
Either,
HasTraits,
Instance,
Int,
Expand Down Expand Up @@ -52,7 +51,7 @@ class TraitGridColumn(GridColumn):

# A dictionary of formats for the display of different types. If it is
# defined as a callable, then that callable must accept a single argument.
formats = Dict(Type, Either(Str, Callable))
formats = Dict(Type, Union(Str, Callable))

# A name to designate the type of this column
typename = Union(None, Str)
Expand Down