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

fixes issue #87 #88

Merged
merged 4 commits into from Jun 4, 2013
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions pyface/tasks/task_layout.py
Expand Up @@ -3,7 +3,7 @@
import sys

# Enthought library imports.
from traits.api import Either, Enum, HasStrictTraits, Int, List, Str, This
from traits.api import Either, Enum, HasStrictTraits, Int, Instance, List, Str, This
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is no longer used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done



class LayoutItem(HasStrictTraits):
Expand Down Expand Up @@ -132,7 +132,8 @@ class Splitter(LayoutContainer):

# The sub-items of the splitter, which are PaneItems, Tabbed layouts, and
# other Splitters.
items = List(Either(PaneItem, Tabbed, This), pretty_skip=True)
items = List(Either(PaneItem, Tabbed,
Instance('pyface.tasks.api.Splitter')), pretty_skip=True)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should refer to pyface.tasks.task_layout.Splitter to avoid unnecessarily importing the api module.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done


class HSplitter(Splitter):
""" A convenience class for horizontal splitters.
Expand Down
35 changes: 35 additions & 0 deletions pyface/tasks/tests/test_task_layout.py
@@ -0,0 +1,35 @@
# Standard library imports.
import unittest

# Enthought library imports.
from pyface.tasks.api import HSplitter, PaneItem, Tabbed, VSplitter


class LayoutItemsTestCase(unittest.TestCase):
""" Testing that the layout types play nice with each other.

This is a regression test for issue #87
(https://github.com/enthought/pyface/issues/87)

"""

def setUp(self):
self.items = [HSplitter(), PaneItem(), Tabbed(), VSplitter()]

def test_hsplitter_items(self):
layout = HSplitter(*self.items)
self.assertEqual(layout.items, self.items)

def test_tabbed_items(self):
# Tabbed items only accept PaneItems
items = [PaneItem(), PaneItem()]
layout = Tabbed(*items)
self.assertEqual(layout.items, items)

def test_vsplitter_items(self):
layout = VSplitter(*self.items)
self.assertEqual(layout.items, self.items)


if __name__ == '__main__':
unittest.main()