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

Make TasksApplication.gui expect an IGUI interface, not a GUI instance #301

Merged
merged 5 commits into from
Sep 1, 2020
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion envisage/ui/tasks/tasks_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ class TasksApplication(Application):
active_window = Instance("envisage.ui.tasks.task_window.TaskWindow")

# The Pyface GUI for the application.
gui = Instance("pyface.gui.GUI")
gui = Instance("pyface.i_gui.IGUI")

# Icon for the whole application. Will be used to override all taskWindows
# icons to have the same.
Expand Down
13 changes: 13 additions & 0 deletions envisage/ui/tasks/tests/test_tasks_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,20 @@

from envisage.ui.tasks.api import TasksApplication
from envisage.ui.tasks.tasks_application import DEFAULT_STATE_FILENAME
from pyface.i_gui import IGUI
from traits.api import HasTraits, provides

requires_gui = unittest.skipIf(
os.environ.get("ETS_TOOLKIT", "none") in {"null", "none"},
"Test requires a non-null GUI backend",
)


@provides(IGUI)
class DummyGUI(HasTraits):
pass


@requires_gui
class TestTasksApplication(unittest.TestCase):
def setUp(self):
Expand Down Expand Up @@ -119,3 +126,9 @@ def test_layout_load_pickle_protocol_3(self):

state = app._state
self.assertEqual(state.previous_window_layouts[0].size, (492, 743))

def test_gui_trait_expects_IGUI_interface(self):
# Trivial test where we simply set the trait
# and the test passes because no errors are raised.
app = TasksApplication()
app.gui = DummyGUI()